refactor: make the project model fields accessible by getters
This commit is contained in:
parent
bcf620a575
commit
e39b6bca2a
@ -6,8 +6,18 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[diesel(table_name = crate::schema::projects)]
|
#[diesel(table_name = crate::schema::projects)]
|
||||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||||
pub struct Project {
|
pub struct Project {
|
||||||
pub(crate) id: i32,
|
id: i32,
|
||||||
pub(crate) title: String,
|
title: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Project {
|
||||||
|
pub fn id(&self) -> i32 {
|
||||||
|
self.id
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn title(&self) -> &str {
|
||||||
|
&self.title
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, Serialize, Deserialize)]
|
#[derive(Insertable, Serialize, Deserialize)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user