on_a_roll/models/
projects.rs1use crate::schema::projects;
2use diesel::prelude::*;
3
4pub const DEFAULT_PROJECT_TITLE: &str = "New Project";
5pub const DEFAULT_PROJECT_STATUS: &str = "Planning";
6#[derive(Debug, Queryable, Selectable)]
7#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
8pub struct Project {
9 pub id: i32,
10 pub title: String,
11 pub description: Option<String>,
12 pub status: String,
13}
14#[derive(Insertable)]
15#[diesel(table_name = projects)]
16pub struct NewProject<'a> {
17 pub title: Option<&'a str>,
18 pub description: Option<&'a str>,
19 pub status: Option<&'a str>,
20}
21#[derive(AsChangeset, Identifiable)]
22#[diesel(table_name = projects)]
23pub struct UpdateProject<'a> {
24 pub id: i32,
25 pub title: Option<&'a str>,
26 pub description: Option<&'a str>,
27 pub status: Option<&'a str>,
28}