feat: list sorting #42
@ -1,3 +1,4 @@
|
|||||||
|
use std::cmp::Ordering;
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use crate::schema::projects;
|
use crate::schema::projects;
|
||||||
use diesel::prelude::*;
|
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)]
|
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||||
#[diesel(table_name = projects)]
|
#[diesel(table_name = projects)]
|
||||||
pub struct NewProject {
|
pub struct NewProject {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user