1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
use uuid::Uuid; use crate::schema::issue; use crate::schema::series; #[derive(Debug, PartialEq, DbEnum, juniper::GraphQLEnum)] #[DieselType = "Series_type"] pub enum SeriesType { Journal, #[db_rename = "book-series"] BookSeries, } #[derive(Queryable)] pub struct Series { pub series_id: Uuid, pub series_type: SeriesType, pub series_name: String, pub issn_print: String, pub issn_digital: String, pub series_url: Option<String>, pub imprint_id: Uuid, } #[derive(juniper::GraphQLInputObject, Insertable)] #[table_name = "series"] pub struct NewSeries { pub series_type: SeriesType, pub series_name: String, pub issn_print: String, pub issn_digital: String, pub series_url: Option<String>, pub imprint_id: Uuid, } #[derive(Queryable)] pub struct Issue { pub series_id: Uuid, pub work_id: Uuid, pub issue_ordinal: i32, } #[derive(juniper::GraphQLInputObject, Insertable)] #[table_name = "issue"] pub struct NewIssue { pub series_id: Uuid, pub work_id: Uuid, pub issue_ordinal: i32, }