feat: list sorting #42

Merged
matous-volf merged 9 commits from feat/list-sorting into main 2024-09-09 17:09:22 +00:00
Showing only changes of commit 8614c33810 - Show all commits

View File

@ -1,3 +1,4 @@
use std::cmp::Ordering;
use chrono::NaiveDateTime;
use crate::schema::projects;
use diesel::prelude::*;
@ -35,6 +36,20 @@ impl Project {
}
}
impl Eq for Project {}
impl PartialOrd<Self> for Project {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Project {
fn cmp(&self, other: &Self) -> Ordering {
self.title().cmp(other.title())
}
}
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
#[diesel(table_name = projects)]
pub struct NewProject {