feat: add a project model

This commit is contained in:
Matouš Volf
2024-08-17 00:23:05 +02:00
parent cb68d5dd0d
commit 6b13e56840
5 changed files with 34 additions and 0 deletions

1
src/models/mod.rs Normal file
View File

@ -0,0 +1 @@
pub(crate) mod project;

17
src/models/project.rs Normal file
View File

@ -0,0 +1,17 @@
use crate::schema::projects;
use diesel::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Queryable, Selectable, Serialize, Deserialize)]
#[diesel(table_name = crate::schema::projects)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct Project {
pub(crate) id: i32,
pub(crate) title: String,
}
#[derive(Insertable, Serialize, Deserialize)]
#[diesel(table_name = projects)]
pub struct NewProject<'a> {
pub title: &'a str,
}