From ed22a7b4183765be3c1509dcec34cadcc9b57cfd Mon Sep 17 00:00:00 2001 From: Rh4096 Date: Thu, 15 Aug 2024 17:27:09 +0700 Subject: [PATCH] skibidi crabs 2 --- prts-server/src/models/account/mod.rs | 1 + prts-server/src/models/account/theme.rs | 36 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 prts-server/src/models/account/theme.rs diff --git a/prts-server/src/models/account/mod.rs b/prts-server/src/models/account/mod.rs index ad8a830..007235a 100644 --- a/prts-server/src/models/account/mod.rs +++ b/prts-server/src/models/account/mod.rs @@ -14,6 +14,7 @@ pub mod skin; pub mod social; pub mod status; pub mod sync; +pub mod theme; pub use sync::*; diff --git a/prts-server/src/models/account/theme.rs b/prts-server/src/models/account/theme.rs new file mode 100644 index 0000000..64a24d2 --- /dev/null +++ b/prts-server/src/models/account/theme.rs @@ -0,0 +1,36 @@ +use std::collections::HashMap; + +use serde::{Deserialize, Serialize}; + +use crate::utils::time::time; + +#[derive(Deserialize, Serialize, Default)] +pub struct HomeTheme { + selected: String, + themes: HashMap, +} + +impl HomeTheme { + pub fn new() -> Self { + Self::default() + } + + pub fn select_theme(&mut self, id: String) { + self.selected = id + } + + pub fn set_theme(&mut self, id: String) { + self.themes.insert(id, Theme::default()); + } +} + +#[derive(Deserialize, Serialize)] +pub struct Theme { + unlock: u64, +} + +impl Default for Theme { + fn default() -> Self { + Self { unlock: time() } + } +}