refactors

This commit is contained in:
vextrixes committed 2026-11-01 02:36:22 +01:00
1 parent 7b53c2db88
commit b4e4b03e67
32 files changed
+414 -361

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
use crate::{Endpoint, HomeworkList};
use crate::{Endpoint, Homeworks};
use std::marker::PhantomData;
pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint<i64, ()> = Endpoint::Get {
@@ -16,7 +16,7 @@ pub const HOMEWORK_DONE_ENDPOINT: Endpoint<bool, ()> = Endpoint::Get {
};
/// Query 'from' and 'to' (Datetime)
pub const HOMEWORKS_ENDPOINT: Endpoint<HomeworkList, ()> = Endpoint::Get {
pub const HOMEWORKS_ENDPOINT: Endpoint<Homeworks, ()> = Endpoint::Get {
url: "/api/3/homeworks",
auth: true,
_types: PhantomData,
+3 -3
View File
@@ -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<FixedOffset>,
@@ -25,6 +25,6 @@ pub struct HomeworkItem {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct HomeworkList {
pub homeworks: Vec<HomeworkItem>,
pub struct Homeworks {
pub homeworks: Vec<Homework>,
}
+112
View File
@@ -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<String>,
pub balance: f64,
pub spent: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundPaymentInfo {
pub instructions: Option<String>,
pub bank_account: Option<String>,
pub variable_symbol: Option<i64>,
pub specific_symbol: i64,
pub amount: f64,
pub message: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundMonthly {
pub date: DateTime<FixedOffset>,
pub monthly_balance: f64,
pub items: Vec<ClassFundRecord>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundRecord {
pub description: Option<String>,
pub date: DateTime<FixedOffset>,
pub amount: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundSummary {
pub student_name_with_class: Option<String>,
pub balance: f64,
pub spent: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherDocumentDetailStudent {
pub full_name_with_class: Option<String>,
pub amount: f64,
pub status: Option<PaymentsTeacherStudentStatus>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherDocumentDetail {
pub title: Option<String>,
pub amount: f64,
pub date: DateTime<FixedOffset>,
pub student_count: i64,
pub students: Option<Vec<ClassFundTeacherDocumentDetailStudent>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherDocumentsItem {
pub id: i64,
pub title: Option<String>,
pub date: DateTime<FixedOffset>,
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<FixedOffset>,
pub monthly_balance: f64,
pub items: Vec<ClassFundTeacherDocumentsItem>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherStudentsItem {
pub variable_symbol: i64,
pub name: Option<String>,
pub registration_number: Option<i64>,
pub balance: f64,
pub status: PaymentsTeacherStudentStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherSummaryClass {
pub abbrev: Option<String>,
pub class_id: Option<String>,
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<String>,
pub allowed_classes: Option<Vec<ClassFundTeacherSummaryClass>>,
}
+8
View File
@@ -0,0 +1,8 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum PaymentsTeacherStudentStatus {
Active,
Canceled,
}
+6 -2
View File
@@ -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::*;
@@ -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<String>,
pub balance: f64,
pub spent: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundPaymentInfo {
pub instructions: Option<String>,
pub bank_account: Option<String>,
pub variable_symbol: Option<i64>,
pub specific_symbol: i64,
pub amount: f64,
pub message: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundMonthly {
pub date: DateTime<FixedOffset>,
pub monthly_balance: f64,
pub items: Vec<ClassFundRecord>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundRecord {
pub description: Option<String>,
pub date: DateTime<FixedOffset>,
pub amount: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundSummary {
pub student_name_with_class: Option<String>,
pub balance: f64,
pub spent: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherDocumentDetailStudent {
pub full_name_with_class: Option<String>,
pub amount: f64,
pub status: Option<PaymentsTeacherStudentStatus>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherDocumentDetail {
pub title: Option<String>,
pub amount: f64,
pub date: DateTime<FixedOffset>,
pub student_count: i64,
pub students: Option<Vec<ClassFundTeacherDocumentDetailStudent>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherDocumentsItem {
pub id: i64,
pub title: Option<String>,
pub date: DateTime<FixedOffset>,
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<FixedOffset>,
pub monthly_balance: f64,
pub items: Vec<ClassFundTeacherDocumentsItem>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherStudentsItem {
pub variable_symbol: i64,
pub name: Option<String>,
pub registration_number: Option<i64>,
pub balance: f64,
pub status: PaymentsTeacherStudentStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassFundTeacherSummaryClass {
pub abbrev: Option<String>,
pub class_id: Option<String>,
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<String>,
pub allowed_classes: Option<Vec<ClassFundTeacherSummaryClass>>,
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------
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 {
+2 -2
View File
@@ -1,5 +1,5 @@
mod endpoints;
mod subject_types;
mod subject;
pub use endpoints::*;
pub use subject_types::*;
pub use subject::*;
@@ -1,11 +1,5 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Subjects {
pub subjects: Vec<Subject>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Subject {
@@ -21,3 +15,9 @@ pub struct Subject {
pub teacher_home_phone: Option<String>,
pub teacher_mobile_phone: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Subjects {
pub subjects: Vec<Subject>,
}
+8
View File
@@ -0,0 +1,8 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum ChangeDisplayType {
OriginalTeacher,
SubstituteTeacher,
}
+11
View File
@@ -0,0 +1,11 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ChangeLessonInfo {
class_abbrev: Option<String>,
group_abbrev: Option<String>,
is_class_group: Option<bool>,
subject_abbrev: Option<String>,
room_abbrev: Option<String>,
}
+17
View File
@@ -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<Vec<DayCycleInfo>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DayCycleInfo {
pub date: DateTime<FixedOffset>,
pub code: Option<String>,
pub abbrev: Option<String>,
pub name: Option<String>,
}
+10
View File
@@ -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::*;
+17
View File
@@ -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<Subject>,
pub day: DateTime<FixedOffset>,
pub hours: String,
pub change_type: SubstitutionChangeType,
pub description: String,
pub time: String,
pub change_lesson_info: Option<ChangeLessonInfo>,
pub change_display_type: Option<ChangeDisplayType>,
pub atom_type: Option<AtomType>,
}
@@ -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,
}
+1 -59
View File
@@ -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<FixedOffset>,
pub changes: Vec<SubstitutionChange>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubstitutionChange {
pub change_subject: Option<Subject>,
pub day: DateTime<FixedOffset>,
pub hours: String,
pub change_type: SubstitutionChangeType,
pub description: String,
pub time: String,
pub change_lesson_info: Option<ChangeLessonInfo>,
pub change_display_type: Option<ChangeDisplayType>,
pub atom_type: Option<AtomType>,
}
#[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<String>,
group_abbrev: Option<String>,
is_class_group: Option<bool>,
subject_abbrev: Option<String>,
room_abbrev: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubstitutionCycles {
pub cycles_info: Option<Vec<DayCycleInfo>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DayCycleInfo {
pub date: DateTime<FixedOffset>,
pub code: Option<String>,
pub abbrev: Option<String>,
pub name: Option<String>,
}
+2
View File
@@ -1,5 +1,7 @@
mod endpoints;
mod teaching;
mod teaching_theme;
pub use endpoints::*;
pub use teaching::*;
pub use teaching_theme::*;
+1 -30
View File
@@ -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<TeachingTheme>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TeachingTheme {
pub date: DateTime<FixedOffset>,
pub theme: String,
pub note: String,
pub lesson_label: String,
pub hour_caption: Option<String>,
pub start: Option<u16>,
pub duration: Option<u16>,
}
#[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<String>,
pub teacher_web: Option<String>,
pub teacher_school_phone: Option<String>,
pub teacher_home_phone: Option<String>,
pub teacher_mobile_phone: Option<String>,
}
+14
View File
@@ -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<FixedOffset>,
pub theme: String,
pub note: String,
pub lesson_label: String,
pub hour_caption: Option<String>,
pub start: Option<u16>,
pub duration: Option<u16>,
}
+18
View File
@@ -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<String>,
pub group_id: Option<String>,
pub subject_id: Option<String>,
pub teacher_id: Option<String>,
pub room_id: Option<String>,
pub student_id: Option<String>,
pub change: Option<TimetableChange>,
}
+9
View File
@@ -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,
}
+26
View File
@@ -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<String>,
pub subject_id: Option<String>,
pub teacher_id: Option<String>,
pub room_id: Option<String>,
pub is_last_room_lesson: bool,
pub cycle_ids: Vec<String>,
pub homeworks: Vec<HomeworkInfo>,
pub homework_ids: Vec<String>,
pub change: Option<TimetableChange>,
pub theme: Option<String>,
pub assistants: Vec<Assistant>,
pub notice: Option<String>,
pub planned_clasification: Option<PlannedClassification>,
pub week_theme: Option<String>,
pub lesson_release: LessonRelease,
pub start: Option<i64>,
pub duration: Option<i64>,
}
+9
View File
@@ -0,0 +1,9 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum AtomType {
Hour,
Pause,
TimeBlock,
}
+13
View File
@@ -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,
}
+15
View File
@@ -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<Atom>,
pub day_of_week: i64,
pub date: DateTime<FixedOffset>,
pub day_description: String,
pub day_type: DateTime<FixedOffset>,
pub assistance_atoms: Vec<AssistanceAtom>,
}
+8
View File
@@ -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,
}
+12
View File
@@ -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<i64>,
pub duration: Option<i64>,
}
+8
View File
@@ -0,0 +1,8 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum LessonRelease {
NoChange,
Released,
}
+24
View File
@@ -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::*;
+7
View File
@@ -0,0 +1,7 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PlannedClassification {
pub description: Option<String>,
}
+1 -141
View File
@@ -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<StdType>,
pub students: Vec<StdType>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableChange {
pub day: DateTime<FixedOffset>,
pub hours: String,
pub changetype: Changetype,
pub description: String,
pub time: String,
pub change_subject: Option<StdType>,
pub type_abbrev: Option<String>,
pub type_name: Option<String>,
pub atom_type: Option<AtomType>,
pub start: Option<i64>,
pub duration: Option<i64>,
}
#[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<String>,
}
#[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<String>,
pub id: String,
pub abbre: Option<String>,
pub name: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Day {
pub atoms: Vec<Atom>,
pub day_of_week: i64,
pub date: DateTime<FixedOffset>,
pub day_description: String,
pub day_type: DateTime<FixedOffset>,
pub assistance_atoms: Vec<AssistanceAtom>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Atom {
pub hour_id: i64,
pub group_ids: Vec<String>,
pub subject_id: Option<String>,
pub teacher_id: Option<String>,
pub room_id: Option<String>,
pub is_last_room_lesson: bool,
pub cycle_ids: Vec<String>,
pub homeworks: Vec<HomeworkInfo>,
pub homework_ids: Vec<String>,
pub change: Option<TimetableChange>,
pub theme: Option<String>,
pub assistants: Vec<Assistant>,
pub notice: Option<String>,
pub planned_clasification: Option<PlannedClasification>,
pub week_theme: Option<String>,
pub lesson_release: LessonRelease,
pub start: Option<i64>,
pub duration: Option<i64>,
}
#[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<String>,
pub group_id: Option<String>,
pub subject_id: Option<String>,
pub teacher_id: Option<String>,
pub room_id: Option<String>,
pub student_id: Option<String>,
pub change: Option<TimetableChange>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PlannedClasification {
pub description: Option<String>,
}
#[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<i64>,
pub duration: Option<i64>,
}
+20
View File
@@ -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<FixedOffset>,
pub hours: String,
pub changetype: Changetype,
pub description: String,
pub time: String,
pub change_subject: Option<StdType>,
pub type_abbrev: Option<String>,
pub type_name: Option<String>,
pub atom_type: Option<AtomType>,
pub start: Option<i64>,
pub duration: Option<i64>,
}
+10
View File
@@ -0,0 +1,10 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Group {
pub class_id: Option<String>,
pub id: String,
pub abbre: Option<String>,
pub name: Option<String>,
}