added setting modules

This commit is contained in:
vextrixes committed 2026-10-27 23:56:59 +01:00
1 parent 4a83f16a8b
commit 3280306dc0
5 files changed
+126 -7

No files matched your search

+1 -3
View File
@@ -9,7 +9,6 @@ mod gdpr;
mod homework; //TDOS
//marking
mod marks;
mod modules;
mod payments;
mod semester;
mod stdtype;
@@ -32,7 +31,6 @@ pub use gdpr::{
};
pub use homework::{HomeworkList, HomeworkListItem};
pub use marks::{Mark, MarkConfirmationStatus, Marks, SubjectMarks};
pub use modules::*;
pub use payments::*;
pub use semester::{
CertificateTerm, CertificateTerms, FinalMark, PedagogicalMeasure, PedagogicalMeasures,
@@ -47,4 +45,4 @@ pub use substitutions::{
};
pub use teaching::{Lesson, Teaching, TeachingTheme};
pub use timetable::*;
pub use user::{SchoolType, UserInfo, UserInfoStudent, UserType};
pub use user::*;
+7
View File
@@ -0,0 +1,7 @@
mod modules;
mod setting_modules;
mod user;
pub use modules::*;
pub use setting_modules::*;
pub use user::*;
File renamed without changes.
+116
View File
@@ -0,0 +1,116 @@
use chrono::{DateTime, FixedOffset};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ModulesSetting {
pub common: CommonModuleSettings,
pub komens: Option<KomensModuleSettings>,
pub marking: Option<MarkinModuleSettings>,
pub timetable: Option<TimetableModuleSettings>,
pub class_book: Option<ClassbookModuleSettings>,
pub emergency: EmergencyModuleSettings,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct CommonModuleSettings {
pub actual_semester: ActualSemester,
pub actual_school_year: Option<ActualSchoolYear>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ActualSemester {
pub semester_id: Option<String>,
pub from: DateTime<FixedOffset>,
pub to: DateTime<FixedOffset>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ActualSchoolYear {
pub id: String,
pub name: String,
pub effective_start_date: DateTime<FixedOffset>,
pub effective_end_date: DateTime<FixedOffset>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct KomensModuleSettings {
pub upload_folder_verified: bool,
pub current_school_year_start_date: DateTime<FixedOffset>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MarkinModuleSettings {
pub required_classification_confirmation: bool,
pub classification_confirmation_classes_list: Vec<String>,
pub classification_confirmation_notification: bool,
pub number_of_days_classification_confirmation_notifications: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableModuleSettings {
pub display_type: TimetableDisplayType,
pub header_type: TimetableHeaderType,
pub days_definition: Vec<TimetableSettingsDayDefinition>,
pub hours_definition: Vec<TimetableSettingsHourDefinition>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum TimetableDisplayType {
Classic,
Flexi,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum TimetableHeaderType {
HourIndex,
TimeLine,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableSettingsDayDefinition {
pub id: String,
pub name: String,
pub caption: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimetableSettingsHourDefinition {
pub id: i64,
pub caption: String,
pub start: i64,
pub duration: i64,
pub is_visible: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ClassbookModuleSettings {
pub absence_calculation_type: AbsenceCalculationType,
pub absence_calculation_period: ActualSemester,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum AbsenceCalculationType {
Duration,
Lessons,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct EmergencyModuleSettings {
pub firestore_db_name: String,
pub emergency_server_url: String,
pub is_sms_licensed: bool,
}
+2 -4
View File
@@ -1,8 +1,6 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
use crate::{Module, SchoolClass};
use crate::{Module, SchoolClass, user::ModulesSetting};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
@@ -19,7 +17,7 @@ pub struct UserInfo {
pub user_type_text: String,
pub study_year: Option<i64>,
pub enabled_modules: Vec<Module>,
pub setting_modules: HashMap<String, Value>, // TODO: Setting Module
pub setting_modules: ModulesSetting,
pub full_user_name: Option<String>,
pub students: Vec<UserInfoStudent>,
}