add: stacks mode and sort

This commit is contained in:
trisua 2025-05-09 15:56:19 -04:00
parent 281e9bea44
commit d174b44f57
9 changed files with 272 additions and 18 deletions

View file

@ -15,6 +15,34 @@ impl Default for StackPrivacy {
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum StackMode {
/// `users` vec contains ID of users to INCLUDE into the timeline;
/// every other user is excluded
Include,
/// `users` vec contains ID of users to EXCLUDE from the timeline;
/// every other user is included
Exclude,
}
impl Default for StackMode {
fn default() -> Self {
Self::Include
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum StackSort {
Created,
Likes,
}
impl Default for StackSort {
fn default() -> Self {
Self::Created
}
}
#[derive(Serialize, Deserialize)]
pub struct UserStack {
pub id: usize,
@ -23,6 +51,8 @@ pub struct UserStack {
pub name: String,
pub users: Vec<usize>,
pub privacy: StackPrivacy,
pub mode: StackMode,
pub sort: StackSort,
}
impl UserStack {
@ -35,6 +65,8 @@ impl UserStack {
name,
users,
privacy: StackPrivacy::default(),
mode: StackMode::default(),
sort: StackSort::default(),
}
}
}