added enums

This commit is contained in:
vextrixes committed 2026-10-27 21:53:56 +01:00
1 parent 9560daf027
commit 442816aa1f
6 files changed
+142 -17

No files matched your search

+28 -3
View File
@@ -1,6 +1,8 @@
use chrono::{DateTime, FixedOffset};
use serde::{Deserialize, Serialize};
use crate::UserType;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GdprCommissioners {
@@ -23,12 +25,12 @@ pub struct GdprCommissioner {
#[serde(rename_all = "PascalCase")]
pub struct GdprConsent {
pub id: i64,
pub person_type: String, //UserType Enum "controller","parents","student","teacher"
pub person_type: UserType,
pub person_id: String,
pub created: DateTime<FixedOffset>,
pub validity: String, //enum "endOfStudy","endOfStudyPlusYears","toAppeal","unknown", "validity"
pub validity: GdprValidity,
pub valid_from: DateTime<FixedOffset>,
pub state: String, //Enum ConsentState "agreed", "cancelled", "disagreed", "expired", "newConsent", "revokeRequested", "revoked", "unknown"
pub state: GdprConsentState,
pub title: Option<String>,
pub personal_data: Option<String>,
pub usage_purpose: Option<String>,
@@ -38,6 +40,29 @@ pub struct GdprConsent {
pub body: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GdprValidity {
EndOfStudy,
EndOfStudyPlusYears,
ToAppeal,
Unknown,
Validity,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GdprConsentState {
Agreed,
Cancelled,
Disagreed,
Expired,
NewConsent,
RevokeRequested,
Revoked,
Unknown,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GdprConsentRights {
+9 -4
View File
@@ -25,9 +25,12 @@ pub use api_info::ApiInfo;
pub use attachment::AttachmentInfo;
pub use error::{Error, ModelState, StringArray};
pub use events::{Event, EventTime, EventType, Events};
pub use gdpr::{GdprCommissioner, GdprCommissioners, GdprConsent, GdprConsentRights};
pub use gdpr::{
GdprCommissioner, GdprCommissioners, GdprConsent, GdprConsentRights, GdprConsentState,
GdprValidity,
};
pub use homework::{HomeworkList, HomeworkListItem};
pub use marks::{Mark, Marks, SubjectMarks};
pub use marks::{Mark, MarkConfirmationStatus, Marks, SubjectMarks};
pub use payments::*;
pub use semester::{
CertificateTerm, CertificateTerms, FinalMark, PedagogicalMeasure, PedagogicalMeasures,
@@ -38,7 +41,9 @@ pub use stdtype::{
Teacher, TeacherSet, TimetableStudent,
};
pub use subjects::{Subject, Subjects};
pub use substitutions::{ChangeLessonInfo, SubstitutionChange, Substitutions};
pub use substitutions::{
ChangeDisplayType, ChangeLessonInfo, SubstitutionChange, SubstitutionChangeType, Substitutions,
};
pub use teaching::{Lesson, Teaching, TeachingTheme};
pub use timetable::*;
pub use user::{Module, UserInfo, UserInfoStudent};
pub use user::{Module, UserInfo, UserInfoStudent, UserType, SchoolType};
+10 -1
View File
@@ -35,7 +35,7 @@ pub struct Mark {
pub calculated_mark_text: String,
pub max_points: i64,
pub is_predictor_mark: bool,
pub mark_confirmation_state: String, // Option<MarkConfirmationStatus> enum "Confirmed", "DoesNotRequireConfirmation","Unconfirmed", "UnconfirmedAfterChange"
pub mark_confirmation_state: MarkConfirmationStatus,
pub caption: Option<String>,
pub theme: Option<String>,
pub mark_text: Option<String>,
@@ -49,3 +49,12 @@ pub struct Mark {
pub confirmed_by: Option<String>,
pub verbal_evaluation: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MarkConfirmationStatus {
Confirmed,
DoesNotRequireConfirmation,
Unconfirmed,
UnconfirmedAfterChange,
}
+23 -4
View File
@@ -1,7 +1,7 @@
use chrono::{DateTime, FixedOffset};
use serde::{Deserialize, Serialize};
use crate::Subject;
use crate::{AtomType, Subject};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
@@ -17,12 +17,31 @@ pub struct SubstitutionChange {
pub change_subject: Option<Subject>,
pub day: DateTime<FixedOffset>,
pub hours: String,
pub change_type: String, //enum "Absence", "Added", "Canceled", "NoChange", "Removed", "RoomChanged", "Substitution"
pub change_type: SubstitutionChangeType,
pub description: String,
pub time: String,
pub change_lesson_info: Option<ChangeLessonInfo>,
pub change_display_type: Option<String>, //enum "OriginalTeacher", "SubstituteTeacher"
pub atom_type: Option<String>, //enum "Hour","Pause", "TimeBlock"
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)]
+30 -3
View File
@@ -22,17 +22,37 @@ pub struct Timetable {
pub struct TimetableChange {
pub day: DateTime<FixedOffset>,
pub hours: String,
pub changetype: String, //enum "Absence", "Added", "Canceled","NoChange", "Removed", "RoomChanged", "Substitution"
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<String>, // enum "Hour", "Pause", "TimeBlock"
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 {
@@ -84,11 +104,18 @@ pub struct Atom {
pub notice: Option<String>,
pub planned_clasification: Option<PlannedClasification>,
pub week_theme: Option<String>,
pub lesson_release: String, //enum LessonRelease: "NoChange", "Released"
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 {
+42 -2
View File
@@ -15,7 +15,7 @@ pub struct UserInfo {
pub full_name: String, //check nullable
pub school_organization_name: Option<String>,
pub school_type: Option<String>,
pub user_type: String, //Enum "controller", "parents", "student", "teacher"
pub user_type: UserType,
pub user_type_text: String,
pub study_year: Option<i64>,
pub enabled_modules: Vec<Module>,
@@ -24,6 +24,15 @@ pub struct UserInfo {
pub students: Vec<UserInfoStudent>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum UserType {
Controller,
Parents,
Student,
Teacher,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Module {
@@ -36,6 +45,37 @@ pub struct Module {
pub struct UserInfoStudent {
pub full_name: String,
pub class: Vec<SchoolClass>,
pub school_type: String, //Enum "BasicArtSchool","BasicPracticalSchool","BasicSchool","BasicSpecialSchool","BoardingHouse","ChildrensHome","Club","Conservatory","EconomicSection","Gymnasium","HigerProfessionalSchool","Kindergarten","OtherSchool","OtherType","PracticalSchool","SchoolCanteen","SchoolClub","SchoolService","SecondarySchool","SecondaryVocationalSchool","SportGymnasium","SuperiorOrganization","TechnicalSchool","University","Unknown","VocationalSchool"
pub school_type: SchoolType,
pub study_year: Option<i64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub enum SchoolType {
BasicArtSchool,
BasicPracticalSchool,
BasicSchool,
BasicSpecialSchool,
BoardingHouse,
ChildrensHome,
Club,
Conservatory,
EconomicSection,
Gymnasium,
HigerProfessionalSchool,
Kindergarten,
OtherSchool,
OtherType,
PracticalSchool,
SchoolCanteen,
SchoolClub,
SchoolService,
SecondarySchool,
SecondaryVocationalSchool,
SportGymnasium,
SuperiorOrganization,
TechnicalSchool,
University,
Unknown,
VocationalSchool,
}