adding query structs for dancer and shows

main
Zynh0722 2023-11-05 12:03:33 -08:00
parent d290ccf8d0
commit b17c2ac1b0
1 changed files with 20 additions and 0 deletions

View File

@ -21,6 +21,26 @@ pub struct Drink {
pub time: chrono::NaiveDateTime, pub time: chrono::NaiveDateTime,
} }
#[derive(Identifiable, Queryable, Selectable, Debug)]
#[diesel(table_name = crate::schema::dancers)]
#[diesel(check_for_backend(diesel::mysql::Mysql))]
pub struct Dancer {
pub id: u32,
pub stage_name: String,
pub name: String,
}
#[derive(Identifiable, Queryable, Selectable, Debug)]
#[diesel(belongs_to(Dancer, foreign_key = dancer))]
#[diesel(table_name = crate::schema::shows)]
#[diesel(check_for_backend(diesel::mysql::Mysql))]
pub struct Show {
pub id: u32,
pub dancer: u32,
pub start: chrono::NaiveDateTime,
pub end: Option<chrono::NaiveDateTime>,
}
#[derive(Insertable, Debug)] #[derive(Insertable, Debug)]
#[diesel(table_name = crate::schema::drinks)] #[diesel(table_name = crate::schema::drinks)]
#[diesel(check_for_backend(diesel::mysql::Mysql))] #[diesel(check_for_backend(diesel::mysql::Mysql))]