Add much stuff for rewrite
This commit is contained in:
parent
4261141c3a
commit
bd44dc3183
37 changed files with 1356 additions and 2551 deletions
src/db
|
@ -23,7 +23,7 @@ pub struct Schedule {
|
|||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
#[table_name = "schedules"]
|
||||
#[diesel(table_name = crate::db::schema::schedules)]
|
||||
pub struct NewSchedule<'a> {
|
||||
pub uid: &'a EmgauwaUid,
|
||||
pub name: &'a str,
|
||||
|
@ -31,26 +31,27 @@ pub struct NewSchedule<'a> {
|
|||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, AsExpression, FromSqlRow, PartialEq, Clone)]
|
||||
#[sql_type = "Binary"]
|
||||
pub struct Periods(pub(crate) Vec<Period>);
|
||||
#[diesel(sql_type = Binary)]
|
||||
pub struct Periods(pub Vec<Period>);
|
||||
|
||||
#[derive(Debug, Serialize, Identifiable, Queryable, Clone)]
|
||||
#[diesel(table_name = crate::db::schema::tags)]
|
||||
pub struct Tag {
|
||||
pub id: i32,
|
||||
pub tag: String,
|
||||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
#[table_name = "tags"]
|
||||
#[diesel(table_name = crate::db::schema::tags)]
|
||||
pub struct NewTag<'a> {
|
||||
pub tag: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Associations, Identifiable)]
|
||||
#[belongs_to(Relay)]
|
||||
#[belongs_to(Schedule)]
|
||||
#[belongs_to(Tag)]
|
||||
#[table_name = "junction_tag"]
|
||||
#[diesel(belongs_to(Relay))]
|
||||
#[diesel(belongs_to(Schedule))]
|
||||
#[diesel(belongs_to(Tag))]
|
||||
#[diesel(table_name = crate::db::schema::junction_tag)]
|
||||
pub struct JunctionTag {
|
||||
pub id: i32,
|
||||
pub tag_id: i32,
|
||||
|
@ -59,7 +60,7 @@ pub struct JunctionTag {
|
|||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
#[table_name = "junction_tag"]
|
||||
#[diesel(table_name = crate::db::schema::junction_tag)]
|
||||
pub struct NewJunctionTag {
|
||||
pub tag_id: i32,
|
||||
pub relay_id: Option<i32>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue