Track space sort keys

This commit is contained in:
2026-05-08 05:40:46 -04:00
parent 820054ff23
commit bce489c119
3 changed files with 93 additions and 4 deletions
+13
View File
@@ -19,6 +19,7 @@ pub struct Space {
default_profile_id: ProfileId,
archive_policy: ArchivePolicy,
sidebar_width_px: u16,
sort_key: u64,
created_at: SystemTime,
updated_at: SystemTime,
}
@@ -30,6 +31,7 @@ impl Space {
icon: impl Into<String>,
accent_hex: u32,
default_profile_id: ProfileId,
sort_key: u64,
) -> Self {
let created_at = SystemTime::now();
Self {
@@ -40,6 +42,7 @@ impl Space {
default_profile_id,
archive_policy: ArchivePolicy::Manual,
sidebar_width_px: DEFAULT_SIDEBAR_WIDTH_PX,
sort_key,
created_at,
updated_at: created_at,
}
@@ -95,6 +98,16 @@ impl Space {
self.record_update();
}
#[must_use]
pub fn sort_key(&self) -> u64 {
self.sort_key
}
pub fn set_sort_key(&mut self, sort_key: u64) {
self.sort_key = sort_key;
self.record_update();
}
#[must_use]
pub fn created_at(&self) -> SystemTime {
self.created_at