Add timetable datatypes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
vextrixesandCopilot committed 2026-10-25 15:15:26 +00:00
1 parent 085d95f423
commit 7a7406b53a
3 files changed
+86 -1

No files matched your search

+5
View File
@@ -12,6 +12,7 @@ mod stdtype;
mod subjects;
mod substitutions;
mod themes;
mod timetable;
mod user;
mod webmodules;
mod what_if;
@@ -33,6 +34,10 @@ pub use stdtype::StdType;
pub use subjects::{Subject, Subjects};
pub use substitutions::{SubstitutionChange, Substitutions};
pub use themes::{Theme, Themes};
pub use timetable::{
Timetable, TimetableAtom, TimetableChange, TimetableClass, TimetableDay, TimetableGroup,
TimetableHour,
};
pub use user::{Module, User};
pub use webmodules::{Webmodule, Webmodules};
pub use what_if::{WhatIfResult, WhatIfResultMark, WhatIfStartingEnviromentMark};
+80
View File
@@ -0,0 +1,80 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::StdType;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Timetable {
pub hours: Vec<TimetableHour>,
pub days: Vec<TimetableDay>,
pub classes: Vec<TimetableClass>,
pub groups: Vec<TimetableGroup>,
pub subjects: Vec<StdType>,
pub teachers: Vec<StdType>,
pub rooms: Vec<StdType>,
pub cycles: Vec<StdType>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableHour {
pub id: u8,
pub caption: String,
pub begin_time: String,
pub end_time: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableDay {
pub atoms: Vec<TimetableAtom>,
pub day_of_week: u8,
pub date: DateTime<Utc>,
pub day_description: String,
pub day_type: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableAtom {
pub hour_id: u8,
pub group_ids: Vec<String>,
pub subject_id: Option<String>,
pub teacher_id: Option<String>,
pub room_id: Option<String>,
pub cycle_ids: Vec<String>,
pub change: Option<TimetableChange>,
pub homework_ids: Vec<String>,
pub theme: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableChange {
pub change_subject: Option<String>,
pub day: DateTime<Utc>,
pub hours: String,
pub change_type: String,
pub description: String,
pub time: String,
pub type_abbrev: Option<String>,
pub type_name: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableClass {
pub id: String,
pub abbrev: String,
pub name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableGroup {
pub class_id: String,
pub id: String,
pub abbrev: String,
pub name: String,
}
+1 -1
View File
@@ -14,7 +14,7 @@
- [x] subjects
- [x] substitutions
- [x] themes
- [ ] timetable
- [x] timetable
- [x] user
- [x] user SettingModules
- [x] web