refactor: make the project model fields accessible by getters

This commit is contained in:
Matouš Volf 2024-08-17 11:43:22 +02:00
parent bcf620a575
commit e39b6bca2a

View File

@ -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)]