diff --git a/src/homework/endpoints.rs b/src/homework/endpoints.rs index a6b3f0b..b0a74f7 100644 --- a/src/homework/endpoints.rs +++ b/src/homework/endpoints.rs @@ -1,4 +1,4 @@ -use crate::{Endpoint, HomeworkList}; +use crate::{Endpoint, Homeworks}; use std::marker::PhantomData; pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint = Endpoint::Get { @@ -16,7 +16,7 @@ pub const HOMEWORK_DONE_ENDPOINT: Endpoint = Endpoint::Get { }; /// Query 'from' and 'to' (Datetime) -pub const HOMEWORKS_ENDPOINT: Endpoint = Endpoint::Get { +pub const HOMEWORKS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/homeworks", auth: true, _types: PhantomData, diff --git a/src/homework/homeworks.rs b/src/homework/homeworks.rs index 9962e46..f44e107 100644 --- a/src/homework/homeworks.rs +++ b/src/homework/homeworks.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct HomeworkItem { +pub struct Homework { #[serde(rename = "ID")] pub id: String, pub date_start: DateTime, @@ -25,6 +25,6 @@ pub struct HomeworkItem { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct HomeworkList { - pub homeworks: Vec, +pub struct Homeworks { + pub homeworks: Vec, } diff --git a/src/payments/class_fund.rs b/src/payments/class_fund.rs new file mode 100644 index 0000000..9554cde --- /dev/null +++ b/src/payments/class_fund.rs @@ -0,0 +1,112 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +use crate::PaymentsTeacherStudentStatus; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassfundSummary { + pub student_name_with_class: Option, + pub balance: f64, + pub spent: f64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundPaymentInfo { + pub instructions: Option, + pub bank_account: Option, + pub variable_symbol: Option, + pub specific_symbol: i64, + pub amount: f64, + pub message: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundMonthly { + pub date: DateTime, + pub monthly_balance: f64, + pub items: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundRecord { + pub description: Option, + pub date: DateTime, + pub amount: f64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundSummary { + pub student_name_with_class: Option, + pub balance: f64, + pub spent: f64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundTeacherDocumentDetailStudent { + pub full_name_with_class: Option, + pub amount: f64, + pub status: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundTeacherDocumentDetail { + pub title: Option, + pub amount: f64, + pub date: DateTime, + pub student_count: i64, + pub students: Option>, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundTeacherDocumentsItem { + pub id: i64, + pub title: Option, + pub date: DateTime, + pub total_amount: f64, + pub amount_per_student: f64, + pub student_count: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundTeacherDocumentsMonthly { + pub date: DateTime, + pub monthly_balance: f64, + pub items: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundTeacherStudentsItem { + pub variable_symbol: i64, + pub name: Option, + pub registration_number: Option, + pub balance: f64, + pub status: PaymentsTeacherStudentStatus, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundTeacherSummaryClass { + pub abbrev: Option, + pub class_id: Option, + pub balance: f64, + pub amount_to_pay: f64, + pub debtors: i64, + pub spent: f64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ClassFundTeacherSummary { + pub teacher_name: Option, + pub allowed_classes: Option>, +} diff --git a/src/payments/common.rs b/src/payments/common.rs new file mode 100644 index 0000000..9e6c83c --- /dev/null +++ b/src/payments/common.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum PaymentsTeacherStudentStatus { + Active, + Canceled, +} diff --git a/src/payments/mod.rs b/src/payments/mod.rs index 09b0528..126d754 100644 --- a/src/payments/mod.rs +++ b/src/payments/mod.rs @@ -1,5 +1,9 @@ +mod class_fund; +mod common; mod endpoints; -mod payments; +mod regular_payments; +pub use class_fund::*; +pub use common::*; pub use endpoints::*; -pub use payments::*; +pub use regular_payments::*; diff --git a/src/payments/payments.rs b/src/payments/regular_payments.rs similarity index 53% rename from src/payments/payments.rs rename to src/payments/regular_payments.rs index a30ad76..9d59165 100644 --- a/src/payments/payments.rs +++ b/src/payments/regular_payments.rs @@ -1,115 +1,7 @@ use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassfundSummary { - pub student_name_with_class: Option, - pub balance: f64, - pub spent: f64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundPaymentInfo { - pub instructions: Option, - pub bank_account: Option, - pub variable_symbol: Option, - pub specific_symbol: i64, - pub amount: f64, - pub message: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundMonthly { - pub date: DateTime, - pub monthly_balance: f64, - pub items: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundRecord { - pub description: Option, - pub date: DateTime, - pub amount: f64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundSummary { - pub student_name_with_class: Option, - pub balance: f64, - pub spent: f64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundTeacherDocumentDetailStudent { - pub full_name_with_class: Option, - pub amount: f64, - pub status: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundTeacherDocumentDetail { - pub title: Option, - pub amount: f64, - pub date: DateTime, - pub student_count: i64, - pub students: Option>, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundTeacherDocumentsItem { - pub id: i64, - pub title: Option, - pub date: DateTime, - pub total_amount: f64, - pub amount_per_student: f64, - pub student_count: i64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundTeacherDocumentsMonthly { - pub date: DateTime, - pub monthly_balance: f64, - pub items: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundTeacherStudentsItem { - pub variable_symbol: i64, - pub name: Option, - pub registration_number: Option, - pub balance: f64, - pub status: PaymentsTeacherStudentStatus, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundTeacherSummaryClass { - pub abbrev: Option, - pub class_id: Option, - pub balance: f64, - pub amount_to_pay: f64, - pub debtors: i64, - pub spent: f64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ClassFundTeacherSummary { - pub teacher_name: Option, - pub allowed_classes: Option>, -} - -//------------------------------------------------------------------------------------------------------------------------------------------------------------ +use crate::PaymentsTeacherStudentStatus; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] @@ -224,13 +116,6 @@ pub struct RegularPrescription { pub students_count: i64, } -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub enum PaymentsTeacherStudentStatus { - Active, - Canceled, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub enum RegularPaymentStatus { diff --git a/src/subjects/mod.rs b/src/subjects/mod.rs index 1056ce2..f11d6df 100644 --- a/src/subjects/mod.rs +++ b/src/subjects/mod.rs @@ -1,5 +1,5 @@ mod endpoints; -mod subject_types; +mod subject; pub use endpoints::*; -pub use subject_types::*; +pub use subject::*; diff --git a/src/subjects/subject_types.rs b/src/subjects/subject.rs similarity index 100% rename from src/subjects/subject_types.rs rename to src/subjects/subject.rs index 8e80101..8830eeb 100644 --- a/src/subjects/subject_types.rs +++ b/src/subjects/subject.rs @@ -1,11 +1,5 @@ use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Subjects { - pub subjects: Vec, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Subject { @@ -21,3 +15,9 @@ pub struct Subject { pub teacher_home_phone: Option, pub teacher_mobile_phone: Option, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Subjects { + pub subjects: Vec, +} diff --git a/src/substitutions/change_display_type.rs b/src/substitutions/change_display_type.rs new file mode 100644 index 0000000..3c30239 --- /dev/null +++ b/src/substitutions/change_display_type.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum ChangeDisplayType { + OriginalTeacher, + SubstituteTeacher, +} diff --git a/src/substitutions/change_lesson_info.rs b/src/substitutions/change_lesson_info.rs new file mode 100644 index 0000000..0880556 --- /dev/null +++ b/src/substitutions/change_lesson_info.rs @@ -0,0 +1,11 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ChangeLessonInfo { + class_abbrev: Option, + group_abbrev: Option, + is_class_group: Option, + subject_abbrev: Option, + room_abbrev: Option, +} diff --git a/src/substitutions/day_cycle_info.rs b/src/substitutions/day_cycle_info.rs new file mode 100644 index 0000000..ba3dad1 --- /dev/null +++ b/src/substitutions/day_cycle_info.rs @@ -0,0 +1,17 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct SubstitutionCycles { + pub cycles_info: Option>, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct DayCycleInfo { + pub date: DateTime, + pub code: Option, + pub abbrev: Option, + pub name: Option, +} diff --git a/src/substitutions/mod.rs b/src/substitutions/mod.rs index c516495..c2fe22c 100644 --- a/src/substitutions/mod.rs +++ b/src/substitutions/mod.rs @@ -1,5 +1,15 @@ +mod change_display_type; +mod change_lesson_info; +mod day_cycle_info; mod endpoints; +mod substitution_change; +mod substitution_change_type; mod substitutions; +pub use change_display_type::*; +pub use change_lesson_info::*; +pub use day_cycle_info::*; pub use endpoints::*; +pub use substitution_change::*; +pub use substitution_change_type::*; pub use substitutions::*; diff --git a/src/substitutions/substitution_change.rs b/src/substitutions/substitution_change.rs new file mode 100644 index 0000000..9e674e3 --- /dev/null +++ b/src/substitutions/substitution_change.rs @@ -0,0 +1,17 @@ +use crate::{AtomType, ChangeDisplayType, ChangeLessonInfo, Subject, SubstitutionChangeType}; +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct SubstitutionChange { + pub change_subject: Option, + pub day: DateTime, + pub hours: String, + pub change_type: SubstitutionChangeType, + pub description: String, + pub time: String, + pub change_lesson_info: Option, + pub change_display_type: Option, + pub atom_type: Option, +} diff --git a/src/substitutions/substitution_change_type.rs b/src/substitutions/substitution_change_type.rs new file mode 100644 index 0000000..3d057a1 --- /dev/null +++ b/src/substitutions/substitution_change_type.rs @@ -0,0 +1,13 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum SubstitutionChangeType { + Absence, + Added, + Canceled, + NoChange, + Removed, + RoomChanged, + Substitution, +} diff --git a/src/substitutions/substitutions.rs b/src/substitutions/substitutions.rs index 7c15efe..8f203f6 100644 --- a/src/substitutions/substitutions.rs +++ b/src/substitutions/substitutions.rs @@ -1,4 +1,4 @@ -use crate::{AtomType, Subject}; +use crate::SubstitutionChange; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; @@ -9,61 +9,3 @@ pub struct Substitutions { pub to: DateTime, pub changes: Vec, } - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SubstitutionChange { - pub change_subject: Option, - pub day: DateTime, - pub hours: String, - pub change_type: SubstitutionChangeType, - pub description: String, - pub time: String, - pub change_lesson_info: Option, - pub change_display_type: Option, - pub atom_type: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub enum SubstitutionChangeType { - Absence, - Added, - Canceled, - NoChange, - Removed, - RoomChanged, - Substitution, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub enum ChangeDisplayType { - OriginalTeacher, - SubstituteTeacher, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ChangeLessonInfo { - class_abbrev: Option, - group_abbrev: Option, - is_class_group: Option, - subject_abbrev: Option, - room_abbrev: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SubstitutionCycles { - pub cycles_info: Option>, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct DayCycleInfo { - pub date: DateTime, - pub code: Option, - pub abbrev: Option, - pub name: Option, -} diff --git a/src/teaching/mod.rs b/src/teaching/mod.rs index 9e0c119..f742f12 100644 --- a/src/teaching/mod.rs +++ b/src/teaching/mod.rs @@ -1,5 +1,7 @@ mod endpoints; mod teaching; +mod teaching_theme; pub use endpoints::*; pub use teaching::*; +pub use teaching_theme::*; diff --git a/src/teaching/teaching.rs b/src/teaching/teaching.rs index c65cdb8..99677d5 100644 --- a/src/teaching/teaching.rs +++ b/src/teaching/teaching.rs @@ -1,5 +1,4 @@ -use crate::Subject; -use chrono::{DateTime, FixedOffset}; +use crate::{Subject, TeachingTheme}; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] @@ -8,31 +7,3 @@ pub struct Teaching { pub subject: Subject, pub themes: Vec, } - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct TeachingTheme { - pub date: DateTime, - pub theme: String, - pub note: String, - pub lesson_label: String, - pub hour_caption: Option, - pub start: Option, - pub duration: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Lesson { - pub subject_id: String, - pub subject_name: String, - pub subject_abbrev: String, - pub teacher_id: String, - pub teacher_name: String, - pub teacher_abbrev: String, - pub teacher_email: Option, - pub teacher_web: Option, - pub teacher_school_phone: Option, - pub teacher_home_phone: Option, - pub teacher_mobile_phone: Option, -} diff --git a/src/teaching/teaching_theme.rs b/src/teaching/teaching_theme.rs new file mode 100644 index 0000000..d75c39d --- /dev/null +++ b/src/teaching/teaching_theme.rs @@ -0,0 +1,14 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TeachingTheme { + pub date: DateTime, + pub theme: String, + pub note: String, + pub lesson_label: String, + pub hour_caption: Option, + pub start: Option, + pub duration: Option, +} diff --git a/src/timetable/assistance_atom.rs b/src/timetable/assistance_atom.rs new file mode 100644 index 0000000..eb5cafc --- /dev/null +++ b/src/timetable/assistance_atom.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +use crate::TimetableChange; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AssistanceAtom { + pub hour_id: i64, + pub start: i64, + pub duration: i64, + pub class_id: Option, + pub group_id: Option, + pub subject_id: Option, + pub teacher_id: Option, + pub room_id: Option, + pub student_id: Option, + pub change: Option, +} diff --git a/src/timetable/assistant.rs b/src/timetable/assistant.rs new file mode 100644 index 0000000..8744c1c --- /dev/null +++ b/src/timetable/assistant.rs @@ -0,0 +1,9 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Assistant { + pub id: String, + pub is_present: bool, + pub student_id: String, +} diff --git a/src/timetable/atom.rs b/src/timetable/atom.rs new file mode 100644 index 0000000..a0d6aaa --- /dev/null +++ b/src/timetable/atom.rs @@ -0,0 +1,26 @@ +use serde::{Deserialize, Serialize}; + +use crate::{Assistant, HomeworkInfo, LessonRelease, PlannedClassification, TimetableChange}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Atom { + pub hour_id: i64, + pub group_ids: Vec, + pub subject_id: Option, + pub teacher_id: Option, + pub room_id: Option, + pub is_last_room_lesson: bool, + pub cycle_ids: Vec, + pub homeworks: Vec, + pub homework_ids: Vec, + pub change: Option, + pub theme: Option, + pub assistants: Vec, + pub notice: Option, + pub planned_clasification: Option, + pub week_theme: Option, + pub lesson_release: LessonRelease, + pub start: Option, + pub duration: Option, +} diff --git a/src/timetable/atom_type.rs b/src/timetable/atom_type.rs new file mode 100644 index 0000000..8e33411 --- /dev/null +++ b/src/timetable/atom_type.rs @@ -0,0 +1,9 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum AtomType { + Hour, + Pause, + TimeBlock, +} diff --git a/src/timetable/change_type.rs b/src/timetable/change_type.rs new file mode 100644 index 0000000..826e16b --- /dev/null +++ b/src/timetable/change_type.rs @@ -0,0 +1,13 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum Changetype { + Absence, + Added, + Canceled, + NoChange, + Removed, + RoomChanged, + Substitution, +} diff --git a/src/timetable/day.rs b/src/timetable/day.rs new file mode 100644 index 0000000..d860e02 --- /dev/null +++ b/src/timetable/day.rs @@ -0,0 +1,15 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +use crate::{AssistanceAtom, Atom}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Day { + pub atoms: Vec, + pub day_of_week: i64, + pub date: DateTime, + pub day_description: String, + pub day_type: DateTime, + pub assistance_atoms: Vec, +} diff --git a/src/timetable/homework_info.rs b/src/timetable/homework_info.rs new file mode 100644 index 0000000..65455c6 --- /dev/null +++ b/src/timetable/homework_info.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct HomeworkInfo { + pub id: String, + pub text: String, +} diff --git a/src/timetable/hour.rs b/src/timetable/hour.rs new file mode 100644 index 0000000..197992c --- /dev/null +++ b/src/timetable/hour.rs @@ -0,0 +1,12 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Hour { + pub id: i64, + pub caption: String, + pub begin_time: String, + pub end_time: String, + pub start: Option, + pub duration: Option, +} diff --git a/src/timetable/lesson_release.rs b/src/timetable/lesson_release.rs new file mode 100644 index 0000000..482611e --- /dev/null +++ b/src/timetable/lesson_release.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum LessonRelease { + NoChange, + Released, +} diff --git a/src/timetable/mod.rs b/src/timetable/mod.rs index bb2f873..8fb5280 100644 --- a/src/timetable/mod.rs +++ b/src/timetable/mod.rs @@ -1,5 +1,29 @@ +mod assistance_atom; +mod assistant; +mod atom; +mod atom_type; +mod change_type; +mod day; mod endpoints; +mod homework_info; +mod hour; +mod lesson_release; +mod planned_classification; mod timetable; +mod timetable_change; +mod timetable_group; +pub use assistance_atom::*; +pub use assistant::*; +pub use atom::*; +pub use atom_type::*; +pub use change_type::*; +pub use day::*; pub use endpoints::*; +pub use homework_info::*; +pub use hour::*; +pub use lesson_release::*; +pub use planned_classification::*; pub use timetable::*; +pub use timetable_change::*; +pub use timetable_group::*; diff --git a/src/timetable/planned_classification.rs b/src/timetable/planned_classification.rs new file mode 100644 index 0000000..1977be5 --- /dev/null +++ b/src/timetable/planned_classification.rs @@ -0,0 +1,7 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct PlannedClassification { + pub description: Option, +} diff --git a/src/timetable/timetable.rs b/src/timetable/timetable.rs index 2f8953a..0b0c5b7 100644 --- a/src/timetable/timetable.rs +++ b/src/timetable/timetable.rs @@ -1,5 +1,4 @@ -use crate::StdType; -use chrono::{DateTime, FixedOffset}; +use crate::{Day, Group, Hour, StdType}; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] @@ -15,142 +14,3 @@ pub struct Timetable { pub cycles: Vec, pub students: Vec, } - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct TimetableChange { - pub day: DateTime, - pub hours: String, - pub changetype: Changetype, - pub description: String, - pub time: String, - pub change_subject: Option, - pub type_abbrev: Option, - pub type_name: Option, - pub atom_type: Option, - pub start: Option, - pub duration: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub enum Changetype { - Absence, - Added, - Canceled, - NoChange, - Removed, - RoomChanged, - Substitution, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub enum AtomType { - Hour, - Pause, - TimeBlock, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct PlannedClassification { - pub description: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct HomeworkInfo { - pub id: String, - pub text: String, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Group { - pub class_id: Option, - pub id: String, - pub abbre: Option, - pub name: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Day { - pub atoms: Vec, - pub day_of_week: i64, - pub date: DateTime, - pub day_description: String, - pub day_type: DateTime, - pub assistance_atoms: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Atom { - pub hour_id: i64, - pub group_ids: Vec, - pub subject_id: Option, - pub teacher_id: Option, - pub room_id: Option, - pub is_last_room_lesson: bool, - pub cycle_ids: Vec, - pub homeworks: Vec, - pub homework_ids: Vec, - pub change: Option, - pub theme: Option, - pub assistants: Vec, - pub notice: Option, - pub planned_clasification: Option, - pub week_theme: Option, - pub lesson_release: LessonRelease, - pub start: Option, - pub duration: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub enum LessonRelease { - NoChange, - Released, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Assistant { - pub id: String, - pub is_present: bool, - pub student_id: String, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AssistanceAtom { - pub hour_id: i64, - pub start: i64, - pub duration: i64, - pub class_id: Option, - pub group_id: Option, - pub subject_id: Option, - pub teacher_id: Option, - pub room_id: Option, - pub student_id: Option, - pub change: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct PlannedClasification { - pub description: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Hour { - pub id: i64, - pub caption: String, - pub begin_time: String, - pub end_time: String, - pub start: Option, - pub duration: Option, -} diff --git a/src/timetable/timetable_change.rs b/src/timetable/timetable_change.rs new file mode 100644 index 0000000..9c28896 --- /dev/null +++ b/src/timetable/timetable_change.rs @@ -0,0 +1,20 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +use crate::{AtomType, Changetype, StdType}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct TimetableChange { + pub day: DateTime, + pub hours: String, + pub changetype: Changetype, + pub description: String, + pub time: String, + pub change_subject: Option, + pub type_abbrev: Option, + pub type_name: Option, + pub atom_type: Option, + pub start: Option, + pub duration: Option, +} diff --git a/src/timetable/timetable_group.rs b/src/timetable/timetable_group.rs new file mode 100644 index 0000000..4b56361 --- /dev/null +++ b/src/timetable/timetable_group.rs @@ -0,0 +1,10 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Group { + pub class_id: Option, + pub id: String, + pub abbre: Option, + pub name: Option, +}