From 2adf27dbed5148d49d353c1bdf8b75e052de8123 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Wed, 28 Oct 2026 22:37:05 +0100 Subject: [PATCH 01/22] added some endpoints --- src/auth/endpoints.rs | 22 ++++ src/auth/login.rs | 9 ++ src/auth/mod.rs | 8 +- src/endpoints.rs | 20 ++++ src/events.rs | 2 + src/homeworks/endpoints.rs | 25 +++++ src/{ => homeworks}/homework.rs | 0 src/homeworks/mod.rs | 5 + src/lib.rs | 10 +- src/marks/endpoints.rs | 22 ++++ src/marks/mod.rs | 5 + src/{marks.rs => marks/subject_marks.rs} | 2 +- src/subjects/endpoints.rs | 9 ++ src/subjects/mod.rs | 5 + .../subject_types.rs} | 0 src/user/endpoints.rs | 15 +++ src/user/mod.rs | 2 + tracker.md | 102 +++++++++++++++++- 18 files changed, 254 insertions(+), 9 deletions(-) create mode 100644 src/auth/endpoints.rs create mode 100644 src/endpoints.rs create mode 100644 src/homeworks/endpoints.rs rename src/{ => homeworks}/homework.rs (100%) create mode 100644 src/homeworks/mod.rs create mode 100644 src/marks/endpoints.rs create mode 100644 src/marks/mod.rs rename src/{marks.rs => marks/subject_marks.rs} (97%) create mode 100644 src/subjects/endpoints.rs create mode 100644 src/subjects/mod.rs rename src/{subjects.rs => subjects/subject_types.rs} (100%) create mode 100644 src/user/endpoints.rs diff --git a/src/auth/endpoints.rs b/src/auth/endpoints.rs new file mode 100644 index 0000000..e7b9a5d --- /dev/null +++ b/src/auth/endpoints.rs @@ -0,0 +1,22 @@ +use std::marker::PhantomData; + +use crate::{ContentType, Endpoint, LoginSuccess, OpenIdDiscovery, auth::login::LoginRequest}; + +pub const LOGIN_ENDPOINT: Endpoint = Endpoint::Post { + url: "/api/login", + auth: false, + content_type: ContentType::Urlencoded, + _types: PhantomData, +}; + +pub const OPEN_ID_DISCOVERY_ENDPOINT: Endpoint = Endpoint::Get { + url: "/.well-known/openid-configuration", + auth: false, + _types: PhantomData, +}; + +pub const LOGIN_TOKEN_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/logintoken", + auth: true, + _types: PhantomData, +}; diff --git a/src/auth/login.rs b/src/auth/login.rs index c7716c8..90d9b8e 100644 --- a/src/auth/login.rs +++ b/src/auth/login.rs @@ -15,6 +15,15 @@ pub struct LoginSuccess { pub app_version: String, } +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub struct LoginRequest { + client_id: String, + grant_type: String, + username: String, + password: String, +} + #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum TokenType { diff --git a/src/auth/mod.rs b/src/auth/mod.rs index 6da0d2a..c897508 100644 --- a/src/auth/mod.rs +++ b/src/auth/mod.rs @@ -1,7 +1,9 @@ +mod endpoints; mod login; mod open_id_discovery; mod user_jwt_claim; -pub use login::{LoginSuccess, TokenType}; -pub use open_id_discovery::OpenIdDiscovery; -pub use user_jwt_claim::UserJwtClaim; +pub use endpoints::*; +pub use login::*; +pub use open_id_discovery::*; +pub use user_jwt_claim::*; diff --git a/src/endpoints.rs b/src/endpoints.rs new file mode 100644 index 0000000..b26ae89 --- /dev/null +++ b/src/endpoints.rs @@ -0,0 +1,20 @@ +use std::marker::PhantomData; + +pub enum Endpoint { + Get { + url: &'static str, + auth: bool, + _types: PhantomData (Response, Request)>, + }, + Post { + url: &'static str, + auth: bool, + content_type: ContentType, + _types: PhantomData (Response, Request)>, + }, +} + +pub enum ContentType { + Urlencoded, + Json, +} diff --git a/src/events.rs b/src/events.rs index 9c35ef5..cd4fb40 100644 --- a/src/events.rs +++ b/src/events.rs @@ -2,6 +2,8 @@ use crate::{Room, RoomSet, SchoolClass, SchoolClassSet, StdType, Student, Teache use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; +/// /api/3/events GET body response +/// Get /api/3/events/my GET body response #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Events { diff --git a/src/homeworks/endpoints.rs b/src/homeworks/endpoints.rs new file mode 100644 index 0000000..8df1c77 --- /dev/null +++ b/src/homeworks/endpoints.rs @@ -0,0 +1,25 @@ +use std::marker::PhantomData; + +use crate::{Endpoint, HomeworkList}; + +pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint<(), i64> = Endpoint::Get { + url: "/api/3/homeworks/count-actual", + auth: true, + _types: PhantomData, +}; + +/// ID = homework ID (String) +/// finished = homework state (bool) +pub const HOMEWORK_DONE_ENDPOINT: Endpoint<(), bool> = Endpoint::Get { + url: "api/3/homeworks/:id/student-done/:finished", + auth: true, + _types: PhantomData, +}; + + +/// Query from and to (Datetime) +pub const HOMEWORKS_ENDPOINT: Endpoint<(), HomeworkList> = Endpoint::Get { + url: "api/3/homeworks", + auth: true, + _types: PhantomData, +}; \ No newline at end of file diff --git a/src/homework.rs b/src/homeworks/homework.rs similarity index 100% rename from src/homework.rs rename to src/homeworks/homework.rs diff --git a/src/homeworks/mod.rs b/src/homeworks/mod.rs new file mode 100644 index 0000000..e10cf70 --- /dev/null +++ b/src/homeworks/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod homework; + +pub use endpoints::*; +pub use homework::*; diff --git a/src/lib.rs b/src/lib.rs index dbaec2d..7ed1a5a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,11 +4,12 @@ mod attachment; //campaign mod auth; mod campaign; +mod endpoints; mod error; mod events; mod gdpr; //komens -mod homework; //TDOS +mod homeworks; //TDOS //marking mod marks; mod payments; @@ -27,14 +28,15 @@ pub use api_info::ApiInfo; pub use attachment::AttachmentInfo; pub use auth::*; pub use campaign::Campaign; +pub use endpoints::*; pub use error::{Error, ModelState, StringArray}; pub use events::{Event, EventTime, EventType, Events}; pub use gdpr::{ GdprCommissioner, GdprCommissioners, GdprConsent, GdprConsentRights, GdprConsentState, GdprValidity, }; -pub use homework::{HomeworkList, HomeworkListItem}; -pub use marks::{Mark, MarkConfirmationStatus, Marks, SubjectMarks}; +pub use homeworks::*; +pub use marks::*; pub use payments::*; pub use semester::{ CertificateTerm, CertificateTerms, FinalMark, PedagogicalMeasure, PedagogicalMeasures, @@ -43,7 +45,7 @@ pub use stdtype::{ Room, RoomSet, SchoolClass, SchoolClassSet, StdClassGroup, StdType, StdTypeNullable, Student, Teacher, TeacherSet, TimetableStudent, }; -pub use subjects::{Subject, Subjects}; +pub use subjects::*; pub use substitutions::{ ChangeDisplayType, ChangeLessonInfo, SubstitutionChange, SubstitutionChangeType, Substitutions, }; diff --git a/src/marks/endpoints.rs b/src/marks/endpoints.rs new file mode 100644 index 0000000..5c6a55c --- /dev/null +++ b/src/marks/endpoints.rs @@ -0,0 +1,22 @@ +use std::marker::PhantomData; + +use crate::{ContentType, Endpoint, Marks}; + +pub const CONFIRM_MARKS_ENDPOINT: Endpoint<(), Vec> = Endpoint::Post { + url: "/api/3/marks/SetClassificationConfirmation", + auth: true, + content_type: ContentType::Json, + _types: PhantomData, +}; + +pub const COUNT_NEW_MARKS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/marks/count-new", + auth: true, + _types: PhantomData, +}; + +pub const MARKS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/marks", + auth: true, + _types: PhantomData, +}; diff --git a/src/marks/mod.rs b/src/marks/mod.rs new file mode 100644 index 0000000..1530cc9 --- /dev/null +++ b/src/marks/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod subject_marks; + +pub use endpoints::*; +pub use subject_marks::*; diff --git a/src/marks.rs b/src/marks/subject_marks.rs similarity index 97% rename from src/marks.rs rename to src/marks/subject_marks.rs index 3c02a26..ddac43f 100644 --- a/src/marks.rs +++ b/src/marks/subject_marks.rs @@ -27,7 +27,7 @@ pub struct SubjectMarks { pub struct Mark { pub mark_date: DateTime, pub edit_date: DateTime, - pub is_invalid_date: Option, + pub is_invalid_date: bool, pub teacher_id: Option, pub subject_id: String, pub is_new: bool, diff --git a/src/subjects/endpoints.rs b/src/subjects/endpoints.rs new file mode 100644 index 0000000..8ee5e49 --- /dev/null +++ b/src/subjects/endpoints.rs @@ -0,0 +1,9 @@ +use std::marker::PhantomData; + +use crate::{Endpoint, Subjects}; + +pub const SUBJECTS_ENDPOINT: Endpoint<(), Subjects> = Endpoint::Get { + url: "/api/3/subjects", + auth: true, + _types: PhantomData, +}; diff --git a/src/subjects/mod.rs b/src/subjects/mod.rs new file mode 100644 index 0000000..1056ce2 --- /dev/null +++ b/src/subjects/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod subject_types; + +pub use endpoints::*; +pub use subject_types::*; diff --git a/src/subjects.rs b/src/subjects/subject_types.rs similarity index 100% rename from src/subjects.rs rename to src/subjects/subject_types.rs diff --git a/src/user/endpoints.rs b/src/user/endpoints.rs new file mode 100644 index 0000000..9d4f301 --- /dev/null +++ b/src/user/endpoints.rs @@ -0,0 +1,15 @@ +use std::marker::PhantomData; + +use crate::{Endpoint, UserInfo}; + +pub const USER_INFO_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/user", + auth: true, + _types: PhantomData, +}; + +pub const STUDENT_AT_SCHOOL_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/user/student-at-school", + auth: true, + _types: PhantomData, +}; diff --git a/src/user/mod.rs b/src/user/mod.rs index fd87e59..ae4154d 100644 --- a/src/user/mod.rs +++ b/src/user/mod.rs @@ -1,7 +1,9 @@ +mod endpoints; mod modules; mod setting_modules; mod user_info; +pub use endpoints::*; pub use modules::*; pub use setting_modules::*; pub use user_info::*; diff --git a/tracker.md b/tracker.md index 1c2135a..34248c2 100644 --- a/tracker.md +++ b/tracker.md @@ -24,4 +24,104 @@ - [ ] OpenApi schema generation - [ ] documentation - [ ] tests -- [ ] constructors \ No newline at end of file +- [ ] constructors + +# Endpoints +- [ ] /api/3/komens/message/:messageId/mark-as-read +- [x] /api/3/marks +- [x] /api/3/homeworks/:id/student-done/:finished +- [ ] /api/3/marking/atoms/:atomId/headers +- [ ] /api/3/payments/classfund/teacher/students/:classId +- [ ] /api/3/classbook/lessonTags +- [ ] /api/3/komens/messages/rating/:messageId +- [ ] /api/3/absence/student +- [ ] /api/3/webmodule +- [ ] /api/3/timetable/actual +- [ ] /api/3/payments/classfund/teacher/document/detail/:documentId +- [ ] /api/3 +- [ ] /api/3/komens/attachment/:id +- [ ] /api/3/subjects/themes/:subjectId +- [ ] /api/3/payments/classfund +- [ ] /api/3/gdpr/consents/person/child +- [ ] /api/3/komens/concept/:conceptId +- [ ] /api/3/marks/measures +- [ ] /api/3/unregister-user-notification +- [ ] /api/3/gdpr/consent/:id/agree +- [x] /api/3/marks/count-new +- [ ] /api/3/komens/concept +- [ ] /api/3/timetable/permanent +- [ ] /api/3/komens/messages/noticeboard +- [ ] /api/3/komens/messages/apology/:messageId +- [ ] /api/3/komens/messages/received/:messageId +- [x] /api/3/user +- [ ] /api/3/payments/regularpayments/detail/:paymentId +- [ ] /api/3/substitutions +- [ ] /api/3/marks/what-if +- [ ] /api/3/gdpr/commissioner/send-objection +- [ ] /api/3/gdpr/consents/person/new +- [ ] /api/3/lesson/:lessonId/absence +- [ ] /api/3/payments/regularpayments/summary +- [ ] /api/3/emergency/startemergency +- [ ] /api/3/timetable/permanent/class/:classId +- [ ] /api/3/gdpr/commissioner/send-report +- [ ] /api/3/komens/message/:messageId/mark-as-unhidden +- [ ] /api/3/lesson/:lessonId/studentsTimetable +- [ ] /api/3/marks/final +- [ ] /api/3/timetable/student/:studentId +- [ ] /api/3/marking/atom/:atomId/headerOptions +- [ ] /api/3/gdpr/consent/:id/disagree +- [ ] /api/3/komens/messages/sent +- [ ] /api/3/emergency/configuration +- [ ] /api/3/komens/message +- [ ] /api/3/komens/message/:messageId/mark-as-hidden +- [ ] /api/3/lesson/:lessonId/past +- [ ] /api/3/komens/attachment +- [ ] /api/3/komens/messages/received +- [ ] /api/3/login/:token +- [ ] /api/3/komens/concepts +- [ ] /api/3/komens/messages/received/unread +- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId +- [ ] /api/3/timetable/actual/class/:classId +- [ ] /api/3/gdpr/consents/person +- [ ] /api/3/komens/messages/unread +- [ ] /api/3/absence +- [ ] /api/3/komens/message/:messageId/mark-as-confirmed +- [ ] /api/3/komens/messages/apology +- [ ] /api/3/events +- [ ] /api/3/komens/concepts/count +- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students +- [ ] /api/3/payments/regularpayments +- [ ] /api/3/komens/messages/noticeboard/:messageId& +- [ ] /api/3/komens/message-types/reply/:messageId +- [ ] /api/3/payments/regularpayments/teacher/prescriptions +- [x] /api/3/marks/SetClassificationConfirmation +- [x] /api/3/homeworks/count-actual +- [ ] /api/3/gdpr/consent/:id/revoke-request +- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students/:studentId +- [ ] /api/3/marking/atoms +- [ ] /api/3/absence/canexcuse/:studentId +- [ ] /api/3/komens/rating-templates +- [ ] /api/3/emergency/participantsselection +- [ ] /api/3/komens/messages/noticeboard/unread +- [ ] /api/3/komens/message-types +- [ ] /api/3/events/my +- [ ] /api/3/gdpr/commissioners +- [ ] /api/3/classbook/:recordId +- [ ] /api/3/marking/marks/:atomId +- [ ] /api/3/substitutions/cycles +- [x] /api/3/logintoken +- [ ] /api/3/komens/message-types/edit/:messageId +- [ ] /api/3/payments/classfund/teacher/documents/:classId +- [ ] /api/3/payments/classfund/summary +- [ ] /api/3/register-notification +- [ ] /api/3/payments/classfund/paymentsinfo +- [ ] /api/3/komens/messages/rating +- [ ] /api/3/komens/message/:messageId +- [x] /api/3/homeworks +- [x] /api/3/subjects +- [ ] /api/3/classbook +- [x] /api/3/user/student-at-school +- [ ] /api/3/payments/classfund/teacher/summary +- [ ] /api/3/komens/messages/sent/:messageId +- [x] /api/login +- [x] /.well-known/openid-configuration \ No newline at end of file From dd48a53be9f048338a07db1502b5874d9d915041 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:08:56 +0100 Subject: [PATCH 02/22] added event endpoints --- src/absence.rs | 8 ++++++++ src/events/endpoints.rs | 15 +++++++++++++++ src/{events.rs => events/event.rs} | 2 -- src/{homeworks => events}/mod.rs | 4 ++-- src/{homeworks => homework}/endpoints.rs | 7 +++---- .../homework.rs => homework/homeworks.rs} | 0 src/homework/mod.rs | 5 +++++ src/lib.rs | 8 ++++---- 8 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 src/events/endpoints.rs rename src/{events.rs => events/event.rs} (93%) rename src/{homeworks => events}/mod.rs (52%) rename src/{homeworks => homework}/endpoints.rs (86%) rename src/{homeworks/homework.rs => homework/homeworks.rs} (100%) create mode 100644 src/homework/mod.rs diff --git a/src/absence.rs b/src/absence.rs index 389725e..ebfe0d1 100644 --- a/src/absence.rs +++ b/src/absence.rs @@ -33,3 +33,11 @@ pub struct SubjectAbsence { pub school: u16, pub distance_teaching: u16, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct SubjectAbsenceOverviewResponse { + pub percentage_threshold: f64, + pub absences: Option>, + pub absences_per_subject: Option>, +} diff --git a/src/events/endpoints.rs b/src/events/endpoints.rs new file mode 100644 index 0000000..bdd3773 --- /dev/null +++ b/src/events/endpoints.rs @@ -0,0 +1,15 @@ +use std::marker::PhantomData; + +use crate::{Endpoint, Events}; + +pub const EVENTS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/events", + auth: true, + _types: PhantomData, +}; + +pub const MY_EVENTS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/events/my", + auth: true, + _types: PhantomData, +}; diff --git a/src/events.rs b/src/events/event.rs similarity index 93% rename from src/events.rs rename to src/events/event.rs index cd4fb40..9c35ef5 100644 --- a/src/events.rs +++ b/src/events/event.rs @@ -2,8 +2,6 @@ use crate::{Room, RoomSet, SchoolClass, SchoolClassSet, StdType, Student, Teache use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -/// /api/3/events GET body response -/// Get /api/3/events/my GET body response #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Events { diff --git a/src/homeworks/mod.rs b/src/events/mod.rs similarity index 52% rename from src/homeworks/mod.rs rename to src/events/mod.rs index e10cf70..2dc3044 100644 --- a/src/homeworks/mod.rs +++ b/src/events/mod.rs @@ -1,5 +1,5 @@ mod endpoints; -mod homework; +mod event; pub use endpoints::*; -pub use homework::*; +pub use event::*; diff --git a/src/homeworks/endpoints.rs b/src/homework/endpoints.rs similarity index 86% rename from src/homeworks/endpoints.rs rename to src/homework/endpoints.rs index 8df1c77..16619f7 100644 --- a/src/homeworks/endpoints.rs +++ b/src/homework/endpoints.rs @@ -11,15 +11,14 @@ pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint<(), i64> = Endpoint::Get { /// ID = homework ID (String) /// finished = homework state (bool) pub const HOMEWORK_DONE_ENDPOINT: Endpoint<(), bool> = Endpoint::Get { - url: "api/3/homeworks/:id/student-done/:finished", + url: "api/3/homeworks/:id/student-done/:finished", auth: true, _types: PhantomData, }; - /// Query from and to (Datetime) pub const HOMEWORKS_ENDPOINT: Endpoint<(), HomeworkList> = Endpoint::Get { - url: "api/3/homeworks", + url: "api/3/homeworks", auth: true, _types: PhantomData, -}; \ No newline at end of file +}; diff --git a/src/homeworks/homework.rs b/src/homework/homeworks.rs similarity index 100% rename from src/homeworks/homework.rs rename to src/homework/homeworks.rs diff --git a/src/homework/mod.rs b/src/homework/mod.rs new file mode 100644 index 0000000..a461b3c --- /dev/null +++ b/src/homework/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod homeworks; + +pub use endpoints::*; +pub use homeworks::*; diff --git a/src/lib.rs b/src/lib.rs index 7ed1a5a..8b7b3ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,7 @@ mod error; mod events; mod gdpr; //komens -mod homeworks; //TDOS +mod homework; //TDOS //marking mod marks; mod payments; @@ -23,19 +23,19 @@ mod user; //TODOS //webmodules //predictor -pub use absence::{AbsenceDay, StudentAbsenceOverviewResponse, SubjectAbsence}; +pub use absence::*; pub use api_info::ApiInfo; pub use attachment::AttachmentInfo; pub use auth::*; pub use campaign::Campaign; pub use endpoints::*; pub use error::{Error, ModelState, StringArray}; -pub use events::{Event, EventTime, EventType, Events}; +pub use events::*; pub use gdpr::{ GdprCommissioner, GdprCommissioners, GdprConsent, GdprConsentRights, GdprConsentState, GdprValidity, }; -pub use homeworks::*; +pub use homework::*; pub use marks::*; pub use payments::*; pub use semester::{ From 01607db3e441474ba0b7f8ab003773b410b614f9 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:07:19 +0100 Subject: [PATCH 03/22] added teaching endpoints --- src/homework/endpoints.rs | 4 ++-- src/lib.rs | 2 +- src/teaching/endpoints.rs | 10 ++++++++++ src/teaching/mod.rs | 5 +++++ src/{ => teaching}/teaching.rs | 0 tracker.md | 6 +++--- 6 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 src/teaching/endpoints.rs create mode 100644 src/teaching/mod.rs rename src/{ => teaching}/teaching.rs (100%) diff --git a/src/homework/endpoints.rs b/src/homework/endpoints.rs index 16619f7..ca3710f 100644 --- a/src/homework/endpoints.rs +++ b/src/homework/endpoints.rs @@ -11,12 +11,12 @@ pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint<(), i64> = Endpoint::Get { /// ID = homework ID (String) /// finished = homework state (bool) pub const HOMEWORK_DONE_ENDPOINT: Endpoint<(), bool> = Endpoint::Get { - url: "api/3/homeworks/:id/student-done/:finished", + url: "api/3/homeworks/{id}/student-done/{finished}", auth: true, _types: PhantomData, }; -/// Query from and to (Datetime) +/// Query 'from' and 'to' (Datetime) pub const HOMEWORKS_ENDPOINT: Endpoint<(), HomeworkList> = Endpoint::Get { url: "api/3/homeworks", auth: true, diff --git a/src/lib.rs b/src/lib.rs index 8b7b3ab..c158512 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,6 +49,6 @@ pub use subjects::*; pub use substitutions::{ ChangeDisplayType, ChangeLessonInfo, SubstitutionChange, SubstitutionChangeType, Substitutions, }; -pub use teaching::{Lesson, Teaching, TeachingTheme}; +pub use teaching::*; pub use timetable::*; pub use user::*; diff --git a/src/teaching/endpoints.rs b/src/teaching/endpoints.rs new file mode 100644 index 0000000..3592e88 --- /dev/null +++ b/src/teaching/endpoints.rs @@ -0,0 +1,10 @@ +use std::marker::PhantomData; + +use crate::{Endpoint, Teaching}; + +/// Subject ID = String +pub const TEACHING_ENDPOINT: Endpoint<(), Teaching> = Endpoint::Get { + url: "/api/3/subjects/themes/{subjectId}", + auth: true, + _types: PhantomData, +}; diff --git a/src/teaching/mod.rs b/src/teaching/mod.rs new file mode 100644 index 0000000..9e0c119 --- /dev/null +++ b/src/teaching/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod teaching; + +pub use endpoints::*; +pub use teaching::*; diff --git a/src/teaching.rs b/src/teaching/teaching.rs similarity index 100% rename from src/teaching.rs rename to src/teaching/teaching.rs diff --git a/tracker.md b/tracker.md index 34248c2..f22119c 100644 --- a/tracker.md +++ b/tracker.md @@ -40,7 +40,7 @@ - [ ] /api/3/payments/classfund/teacher/document/detail/:documentId - [ ] /api/3 - [ ] /api/3/komens/attachment/:id -- [ ] /api/3/subjects/themes/:subjectId +- [x] /api/3/subjects/themes/:subjectId - [ ] /api/3/payments/classfund - [ ] /api/3/gdpr/consents/person/child - [ ] /api/3/komens/concept/:conceptId @@ -87,7 +87,7 @@ - [ ] /api/3/absence - [ ] /api/3/komens/message/:messageId/mark-as-confirmed - [ ] /api/3/komens/messages/apology -- [ ] /api/3/events +- [x] /api/3/events - [ ] /api/3/komens/concepts/count - [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students - [ ] /api/3/payments/regularpayments @@ -104,7 +104,7 @@ - [ ] /api/3/emergency/participantsselection - [ ] /api/3/komens/messages/noticeboard/unread - [ ] /api/3/komens/message-types -- [ ] /api/3/events/my +- [x] /api/3/events/my - [ ] /api/3/gdpr/commissioners - [ ] /api/3/classbook/:recordId - [ ] /api/3/marking/marks/:atomId From 32b2d69a4323aa2700c7f872044cd546b7dcfd0d Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:35:19 +0100 Subject: [PATCH 04/22] added substitutions endpoints --- src/lib.rs | 8 +++----- src/{ => others}/api_info.rs | 0 src/others/endpoints.rs | 15 +++++++++++++++ src/others/mod.rs | 5 +++++ src/substitutions/endpoints.rs | 15 +++++++++++++++ src/substitutions/mod.rs | 5 +++++ src/{ => substitutions}/substitutions.rs | 15 +++++++++++++++ tracker.md | 4 ++-- 8 files changed, 60 insertions(+), 7 deletions(-) rename src/{ => others}/api_info.rs (100%) create mode 100644 src/others/endpoints.rs create mode 100644 src/others/mod.rs create mode 100644 src/substitutions/endpoints.rs create mode 100644 src/substitutions/mod.rs rename src/{ => substitutions}/substitutions.rs (78%) diff --git a/src/lib.rs b/src/lib.rs index c158512..c728c09 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ mod absence; -mod api_info; mod attachment; +mod others; //campaign mod auth; mod campaign; @@ -24,7 +24,6 @@ mod user; //TODOS //predictor pub use absence::*; -pub use api_info::ApiInfo; pub use attachment::AttachmentInfo; pub use auth::*; pub use campaign::Campaign; @@ -37,6 +36,7 @@ pub use gdpr::{ }; pub use homework::*; pub use marks::*; +pub use others::*; pub use payments::*; pub use semester::{ CertificateTerm, CertificateTerms, FinalMark, PedagogicalMeasure, PedagogicalMeasures, @@ -46,9 +46,7 @@ pub use stdtype::{ Teacher, TeacherSet, TimetableStudent, }; pub use subjects::*; -pub use substitutions::{ - ChangeDisplayType, ChangeLessonInfo, SubstitutionChange, SubstitutionChangeType, Substitutions, -}; +pub use substitutions::*; pub use teaching::*; pub use timetable::*; pub use user::*; diff --git a/src/api_info.rs b/src/others/api_info.rs similarity index 100% rename from src/api_info.rs rename to src/others/api_info.rs diff --git a/src/others/endpoints.rs b/src/others/endpoints.rs new file mode 100644 index 0000000..50cbfa6 --- /dev/null +++ b/src/others/endpoints.rs @@ -0,0 +1,15 @@ +use std::marker::PhantomData; + +use crate::{ApiInfo, Endpoint}; + +pub const API_V3_INFO_ENDPOINT: Endpoint<(), ApiInfo> = Endpoint::Get { + url: "/api/3", + auth: false, + _types: PhantomData, +}; + +pub const APIS_INFO_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { + url: "/api", + auth: false, + _types: PhantomData, +}; diff --git a/src/others/mod.rs b/src/others/mod.rs new file mode 100644 index 0000000..6053aa5 --- /dev/null +++ b/src/others/mod.rs @@ -0,0 +1,5 @@ +mod api_info; +mod endpoints; + +pub use api_info::*; +pub use endpoints::*; diff --git a/src/substitutions/endpoints.rs b/src/substitutions/endpoints.rs new file mode 100644 index 0000000..1f24737 --- /dev/null +++ b/src/substitutions/endpoints.rs @@ -0,0 +1,15 @@ +use std::marker::PhantomData; + +use crate::{Endpoint, SubstitutionCycles, Substitutions}; + +pub const SUBSTITUTIONS_ENDPOINT: Endpoint<(), Substitutions> = Endpoint::Get { + url: "/api/3/substitutions", + auth: true, + _types: PhantomData, +}; + +pub const SUBSTITUTION_CYCLES_ENDPOINT: Endpoint<(), SubstitutionCycles> = Endpoint::Get { + url: "/api/3/substitutions/cycles", + auth: true, + _types: PhantomData, +}; diff --git a/src/substitutions/mod.rs b/src/substitutions/mod.rs new file mode 100644 index 0000000..c516495 --- /dev/null +++ b/src/substitutions/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod substitutions; + +pub use endpoints::*; +pub use substitutions::*; diff --git a/src/substitutions.rs b/src/substitutions/substitutions.rs similarity index 78% rename from src/substitutions.rs rename to src/substitutions/substitutions.rs index 359f9d2..4a3e453 100644 --- a/src/substitutions.rs +++ b/src/substitutions/substitutions.rs @@ -53,3 +53,18 @@ pub struct ChangeLessonInfo { 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/tracker.md b/tracker.md index f22119c..e418479 100644 --- a/tracker.md +++ b/tracker.md @@ -55,7 +55,7 @@ - [ ] /api/3/komens/messages/received/:messageId - [x] /api/3/user - [ ] /api/3/payments/regularpayments/detail/:paymentId -- [ ] /api/3/substitutions +- [x] /api/3/substitutions - [ ] /api/3/marks/what-if - [ ] /api/3/gdpr/commissioner/send-objection - [ ] /api/3/gdpr/consents/person/new @@ -108,7 +108,7 @@ - [ ] /api/3/gdpr/commissioners - [ ] /api/3/classbook/:recordId - [ ] /api/3/marking/marks/:atomId -- [ ] /api/3/substitutions/cycles +- [x] /api/3/substitutions/cycles - [x] /api/3/logintoken - [ ] /api/3/komens/message-types/edit/:messageId - [ ] /api/3/payments/classfund/teacher/documents/:classId From 6236099ae18e8c33447123d0e04006a5bf2a88a9 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:15:12 +0100 Subject: [PATCH 05/22] added payment endpoints --- src/payments/endpoints.rs | 105 ++++++++++++++++++++++ src/payments/mod.rs | 5 ++ src/{ => payments}/payments.rs | 157 ++++++++++++++++++++------------- tracker.md | 26 +++--- 4 files changed, 219 insertions(+), 74 deletions(-) create mode 100644 src/payments/endpoints.rs create mode 100644 src/payments/mod.rs rename src/{ => payments}/payments.rs (60%) diff --git a/src/payments/endpoints.rs b/src/payments/endpoints.rs new file mode 100644 index 0000000..1779c11 --- /dev/null +++ b/src/payments/endpoints.rs @@ -0,0 +1,105 @@ +use std::marker::PhantomData; + +use crate::{ + ClassFundMonthly, ClassFundPaymentInfo, ClassFundSummary, ClassFundTeacherDocumentDetail, + ClassFundTeacherDocumentsMonthly, ClassFundTeacherStudentsItem, ClassFundTeacherSummary, + Endpoint, RegularPayment, RegularPaymentDetail, RegularPaymentsSummary, RegularPrescription, + RegularPrescriptionDetail, RegularPrescriptionStudent, RegularPrescriptionStudentDetail, +}; + +pub const CLASS_FUND_PAYMENT_INFO_ENDPOINT: Endpoint<(), ClassFundPaymentInfo> = Endpoint::Get { + url: "/api/3/payments/classfund/paymentsinfo", + auth: true, + _types: PhantomData, +}; + +pub const REGULAR_PAYMENTS_INFO_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { + url: "/api/3/payments/regularpayments", + auth: true, + _types: PhantomData, +}; + +pub const REGULAR_PAYMENTS_SUMMARY_ENDPOINT: Endpoint<(), RegularPaymentsSummary> = Endpoint::Get { + url: "/api/3/payments/regularpayments/summary", + auth: true, + _types: PhantomData, +}; + +pub const CLASS_FUND_INFO_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { + url: "/api/3/payments/classfund", + auth: true, + _types: PhantomData, +}; + +pub const CLASS_FUND_SUMMARY_ENDPOINT: Endpoint<(), ClassFundSummary> = Endpoint::Get { + url: "/api/3/payments/classfund/summary", + auth: true, + _types: PhantomData, +}; + +pub const REGULAR_PAYMENT_DETAIL_ENDPOINT: Endpoint<(), RegularPaymentDetail> = Endpoint::Get { + url: "/api/3/payments/regularpayments/detail/{paymentId}", + auth: true, + _types: PhantomData, +}; + +pub const CLASS_FUND_TEACHER_DOCUMENT_DETAIL_ENDPOINT: Endpoint< + (), + ClassFundTeacherDocumentDetail, +> = Endpoint::Get { + url: "/api/3/payments/classfund/teacher/document/detail/{documentId}", + auth: true, + _types: PhantomData, +}; + +pub const REGULAR_PRESCRIPTIONS_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { + url: "/api/3/payments/regularpayments/teacher/prescriptions", + auth: true, + _types: PhantomData, +}; + +pub const CLASS_FUND_TEACHER_STUDENTS_ENDPOINT: Endpoint<(), Vec> = + Endpoint::Get { + url: "/api/3/payments/classfund/teacher/students/{classId}", + auth: true, + _types: PhantomData, + }; + +pub const CLASS_FUND_TEACHER_DOCUMENTS_ENDPOINT: Endpoint< + (), + Vec, +> = Endpoint::Get { + url: "/api/3/payments/classfund/teacher/documents/{classId}", + auth: true, + _types: PhantomData, +}; + +pub const CLASS_FUND_TEACHER_SUMMARY_ENDPOINT: Endpoint<(), ClassFundTeacherSummary> = + Endpoint::Get { + url: "/api/3/payments/classfund/teacher/summary", + auth: true, + _types: PhantomData, + }; + +pub const REGULAR_PRESCRIPTION_DETAIL_ENDPOINT: Endpoint<(), RegularPrescriptionDetail> = + Endpoint::Get { + url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}", + auth: true, + _types: PhantomData, + }; + +pub const REGULAR_PRESCRIPTION_STUDENT_DETAIL_ENDPOINT: Endpoint< + (), + RegularPrescriptionStudentDetail, +> = Endpoint::Get { + url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}/students/{studentId}", + auth: true, + _types: PhantomData, +}; + +pub const REGULAR_PRESCRIPTION_STUDENTS_ENDPOINT: Endpoint<(), Vec> = + Endpoint::Get { + url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}/students", + auth: true, + _types: PhantomData, + }; diff --git a/src/payments/mod.rs b/src/payments/mod.rs new file mode 100644 index 0000000..09b0528 --- /dev/null +++ b/src/payments/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod payments; + +pub use endpoints::*; +pub use payments::*; diff --git a/src/payments.rs b/src/payments/payments.rs similarity index 60% rename from src/payments.rs rename to src/payments/payments.rs index ac73533..a30ad76 100644 --- a/src/payments.rs +++ b/src/payments/payments.rs @@ -12,93 +12,101 @@ pub struct ClassfundSummary { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ClassFundPaymentInfo { - instructions: Option, - bank_account: Option, - variable_symbol: Option, - specific_symbol: i64, - amount: f64, - message: Option, + 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 { - description: Option, - date: DateTime, - amount: f64, + pub description: Option, + pub date: DateTime, + pub amount: f64, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ClassFundSummary { - student_name_with_class: Option, - balance: f64, - spent: f64, + pub student_name_with_class: Option, + pub balance: f64, + pub spent: f64, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ClassFundTeacherDocumentDetailStudent { - full_name_with_class: Option, - amount: f64, - status: Option, //Option, enum "Active" "Canceled" + pub full_name_with_class: Option, + pub amount: f64, + pub status: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ClassFundTeacherDocumentDetail { - title: Option, - amount: f64, - date: DateTime, - student_count: i64, - students: Option>, + 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 { - id: i64, - title: Option, - date: DateTime, - total_amount: f64, - amount_per_student: f64, - student_count: i64, + 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 { - date: DateTime, - monthly_balance: f64, - items: Vec, + pub date: DateTime, + pub monthly_balance: f64, + pub items: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ClassFundTeacherStudentsItem { - variable_symbol: i64, - name: Option, - registration_number: Option, - balance: f64, - status: String, //PaymentsTeacherStudentStatus, enum "Active" "Canceled + 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 { - abbrev: Option, - class_id: Option, - balance: f64, - amount_to_pay: f64, - debtors: i64, - spent: f64, + 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 { - teacher_name: Option, - allowed_classes: Option>, + pub teacher_name: Option, + pub allowed_classes: Option>, } //------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -106,26 +114,26 @@ pub struct ClassFundTeacherSummary { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct RegularPaymentDetail { - title: Option, - due_date: DateTime, - amount: f64, - original_amount: f64, - status: String, //r16 = "BeforeDueDate", "NotPaid", "Paid", "PartiallyPaid" - bank_account: Option, - variable_symbol: Option, - specific_symbol: Option, - message: Option, + pub title: Option, + pub due_date: DateTime, + pub amount: f64, + pub original_amount: f64, + pub status: RegularPaymentStatus, + pub bank_account: Option, + pub variable_symbol: Option, + pub specific_symbol: Option, + pub message: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct RegularPayment { - payment_id: i64, - title: Option, - due_date: DateTime, - amount: f64, - status: String, //r16 = "BeforeDueDate", "NotPaid", "Paid", "PartiallyPaid" - original_amount: f64, + pub payment_id: i64, + pub title: Option, + pub due_date: DateTime, + pub amount: f64, + pub status: RegularPaymentStatus, + pub original_amount: f64, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -154,7 +162,7 @@ pub struct RegularPrescriptionDetail { pub payment_type_id: i64, pub payment_type_name: Option, pub amount: f64, - pub state: String, //r16 = "Paid", "PaidNotActive","unknown","Unpaid", "UnpaidNotActive" + pub state: RegularPrescription, pub due_date_max: DateTime, pub bank_account: Option, pub specific_symbol: Option, @@ -187,7 +195,7 @@ pub struct RegularPrescriptionStudentDetail { pub title: Option, pub balance: f64, pub total_regulation_amount: f64, - pub status: String, //PaymentsTeacherStudentStatus, enum "Active" "Canceled" + pub status: PaymentsTeacherStudentStatus, pub document_lines: Option>, pub regulation_lines: Option>, } @@ -200,7 +208,7 @@ pub struct RegularPrescriptionStudent { pub first_name: Option, pub full_name: Option, pub balance: f64, - pub status: String, //PaymentsTeacherStudentStatus, enum "Active" "Canceled" + pub status: PaymentsTeacherStudentStatus, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -211,7 +219,34 @@ pub struct RegularPrescription { pub payment_type_id: i64, pub payment_type_name: Option, pub amount: f64, - pub state: String, //PaymentsTeacherStudentStatus, enum "Active" "Canceled" + pub state: PaymentsTeacherStudentStatus, pub due_date_max: Option>, 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 { + BeforeDueDate, + NotPaid, + Paid, + PartiallyPaid, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum RegularPrescriptionState { + Paid, + PaidNotActive, + #[serde(rename = "unknown")] + Unknown, + Unpaid, + UnpaidNotActive, +} diff --git a/tracker.md b/tracker.md index e418479..09b0cf3 100644 --- a/tracker.md +++ b/tracker.md @@ -6,7 +6,7 @@ - [ ] class book - [x] events - [x] auth -- [ ] error +- [ ] errors - [x] gdpr - [x] homeworks - [ ] komens @@ -31,17 +31,17 @@ - [x] /api/3/marks - [x] /api/3/homeworks/:id/student-done/:finished - [ ] /api/3/marking/atoms/:atomId/headers -- [ ] /api/3/payments/classfund/teacher/students/:classId +- [x] /api/3/payments/classfund/teacher/students/:classId - [ ] /api/3/classbook/lessonTags - [ ] /api/3/komens/messages/rating/:messageId - [ ] /api/3/absence/student - [ ] /api/3/webmodule - [ ] /api/3/timetable/actual -- [ ] /api/3/payments/classfund/teacher/document/detail/:documentId +- [x] /api/3/payments/classfund/teacher/document/detail/:documentId - [ ] /api/3 - [ ] /api/3/komens/attachment/:id - [x] /api/3/subjects/themes/:subjectId -- [ ] /api/3/payments/classfund +- [x] /api/3/payments/classfund - [ ] /api/3/gdpr/consents/person/child - [ ] /api/3/komens/concept/:conceptId - [ ] /api/3/marks/measures @@ -54,13 +54,13 @@ - [ ] /api/3/komens/messages/apology/:messageId - [ ] /api/3/komens/messages/received/:messageId - [x] /api/3/user -- [ ] /api/3/payments/regularpayments/detail/:paymentId +- [x] /api/3/payments/regularpayments/detail/:paymentId - [x] /api/3/substitutions - [ ] /api/3/marks/what-if - [ ] /api/3/gdpr/commissioner/send-objection - [ ] /api/3/gdpr/consents/person/new - [ ] /api/3/lesson/:lessonId/absence -- [ ] /api/3/payments/regularpayments/summary +- [x] /api/3/payments/regularpayments/summary - [ ] /api/3/emergency/startemergency - [ ] /api/3/timetable/permanent/class/:classId - [ ] /api/3/gdpr/commissioner/send-report @@ -80,7 +80,7 @@ - [ ] /api/3/login/:token - [ ] /api/3/komens/concepts - [ ] /api/3/komens/messages/received/unread -- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId +- [x] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId - [ ] /api/3/timetable/actual/class/:classId - [ ] /api/3/gdpr/consents/person - [ ] /api/3/komens/messages/unread @@ -93,11 +93,11 @@ - [ ] /api/3/payments/regularpayments - [ ] /api/3/komens/messages/noticeboard/:messageId& - [ ] /api/3/komens/message-types/reply/:messageId -- [ ] /api/3/payments/regularpayments/teacher/prescriptions +- [x] /api/3/payments/regularpayments/teacher/prescriptions - [x] /api/3/marks/SetClassificationConfirmation - [x] /api/3/homeworks/count-actual - [ ] /api/3/gdpr/consent/:id/revoke-request -- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students/:studentId +- [x] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students/:studentId - [ ] /api/3/marking/atoms - [ ] /api/3/absence/canexcuse/:studentId - [ ] /api/3/komens/rating-templates @@ -111,17 +111,17 @@ - [x] /api/3/substitutions/cycles - [x] /api/3/logintoken - [ ] /api/3/komens/message-types/edit/:messageId -- [ ] /api/3/payments/classfund/teacher/documents/:classId -- [ ] /api/3/payments/classfund/summary +- [x] /api/3/payments/classfund/teacher/documents/:classId +- [x] /api/3/payments/classfund/summary - [ ] /api/3/register-notification -- [ ] /api/3/payments/classfund/paymentsinfo +- [x] /api/3/payments/classfund/paymentsinfo - [ ] /api/3/komens/messages/rating - [ ] /api/3/komens/message/:messageId - [x] /api/3/homeworks - [x] /api/3/subjects - [ ] /api/3/classbook - [x] /api/3/user/student-at-school -- [ ] /api/3/payments/classfund/teacher/summary +- [x] /api/3/payments/classfund/teacher/summary - [ ] /api/3/komens/messages/sent/:messageId - [x] /api/login - [x] /.well-known/openid-configuration \ No newline at end of file From 1d1b7a30f350106566b165d3bbd4da26ba1bb90c Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 02:29:22 +0100 Subject: [PATCH 06/22] added absence endpoints --- src/absence.rs | 43 ------------- src/absence/absence.rs | 132 +++++++++++++++++++++++++++++++++++++++ src/absence/endpoints.rs | 36 +++++++++++ src/absence/mod.rs | 5 ++ src/endpoints.rs | 6 ++ tracker.md | 8 +-- 6 files changed, 183 insertions(+), 47 deletions(-) delete mode 100644 src/absence.rs create mode 100644 src/absence/absence.rs create mode 100644 src/absence/endpoints.rs create mode 100644 src/absence/mod.rs diff --git a/src/absence.rs b/src/absence.rs deleted file mode 100644 index ebfe0d1..0000000 --- a/src/absence.rs +++ /dev/null @@ -1,43 +0,0 @@ -use chrono::FixedOffset; -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct StudentAbsenceOverviewResponse { - pub percentage_threshold: f64, //TODO: cutom type (u8) - pub absences: Vec, - pub absences_per_subject: Option>, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AbsenceDay { - pub date: chrono::DateTime, - pub unsolved: u16, - pub ok: u16, - pub missed: u16, - pub late: u16, - pub soon: u16, - pub school: u16, - pub distance_teaching: u16, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SubjectAbsence { - pub subject_name: String, - pub lessons_count: u16, - pub base: u16, - pub late: u16, - pub soon: u16, - pub school: u16, - pub distance_teaching: u16, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SubjectAbsenceOverviewResponse { - pub percentage_threshold: f64, - pub absences: Option>, - pub absences_per_subject: Option>, -} diff --git a/src/absence/absence.rs b/src/absence/absence.rs new file mode 100644 index 0000000..1cafb2e --- /dev/null +++ b/src/absence/absence.rs @@ -0,0 +1,132 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +use crate::{Hour, StdType, StdTypeNullable}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct StudentAbsenceOverviewResponse { + pub percentage_threshold: f64, //TODO: cutom type (u8) + pub absences: Vec, + pub absences_per_subject: Option>, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceDay { + pub date: chrono::DateTime, + pub unsolved: u16, + pub ok: u16, + pub missed: u16, + pub late: u16, + pub soon: u16, + pub school: u16, + pub distance_teaching: u16, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct SubjectAbsence { + pub subject_name: String, + pub lessons_count: u16, + pub base: u16, + pub late: u16, + pub soon: u16, + pub school: u16, + pub distance_teaching: u16, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct SubjectAbsenceOverviewResponse { + pub percentage_threshold: f64, + pub absences: Option>, + pub absences_per_subject: Option>, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct StudentTimetableAbsenceResponse { + pub student: Option, + pub days: Vec, + pub absent_type_options: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceTypeOption { + pub absent_type: AbsentType, + pub absent_kind_enabled: bool, + pub absent_kind_required: bool, + pub absent_note_enabled: bool, + pub next_absent_type: AbsentType, + pub absent_kinds: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum AbsentType { + Absent, + AbsentLate, + AbsentMiss, + AbsentOk, + AbsentSchool, + AbsentSoon, + DistanceTeaching, + NoAbsent, +} + +type StudentInfo = StdTypeNullable; +type AbsenceKind = StdType; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceSubject { + pub id: String, + pub abbrev: Option, + pub name: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceDayResponse { + pub date: DateTime, + pub absences: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Absence { + pub minutes: i64, + pub absent_type: AbsentType, + pub hour_id: String, + pub start: i64, + pub duration: i64, + pub hour_index: Option, + pub absent_kind_id: Option, + pub notice: Option, + pub student_id: Option, + pub subject: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ExcuseAbsenceResponse { + pub absences: Vec, + pub hours: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceRecord { + pub minutes: i64, + pub absent_type: AbsentType, + pub hour_id: Option, + pub date: DateTime, + pub start: i64, + pub duration: i64, + pub absent_kind_id: Option, + pub notice: Option, + pub student_id: Option, + pub apology_id: Option, +} diff --git a/src/absence/endpoints.rs b/src/absence/endpoints.rs new file mode 100644 index 0000000..1b70b8a --- /dev/null +++ b/src/absence/endpoints.rs @@ -0,0 +1,36 @@ +use std::marker::PhantomData; + +use crate::{ + ContentType, Endpoint, ExcuseAbsenceResponse, StudentAbsenceOverviewResponse, + StudentTimetableAbsenceResponse, +}; + +pub const CAN_STUDENT_EXCUSE_ABSENCE_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/absence/canexcuse/{studentId}", + auth: true, + _types: PhantomData, +}; + +pub const GET_STUDENT_ABSENCE_ENDPOINT: Endpoint = + Endpoint::Get { + url: "/api/3/absence/student", + auth: true, + _types: PhantomData, + }; + +pub const GET_STUDENT_TIMETABLE_WITH_ABSENCES_ENDPOINT: Endpoint< + StudentTimetableAbsenceResponse, + (), +> = Endpoint::Get { + url: "/api/3/timetable/student/{studentId}", + auth: true, + _types: PhantomData, +}; + +pub const EXCUSE_KOMENS_ABSENCE_ENDPOINT: Endpoint = Endpoint::Put { + //TODO unknown behaviour (and request type) // probably bsenceRecord or AbsenceRecordWithSubject + url: "/api/3/absence", + auth: true, + content_type: ContentType::Json, + _types: PhantomData, +}; diff --git a/src/absence/mod.rs b/src/absence/mod.rs new file mode 100644 index 0000000..d7fb00d --- /dev/null +++ b/src/absence/mod.rs @@ -0,0 +1,5 @@ +mod absence; +mod endpoints; + +pub use absence::*; +pub use endpoints::*; diff --git a/src/endpoints.rs b/src/endpoints.rs index b26ae89..9c7a8a1 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -12,6 +12,12 @@ pub enum Endpoint { content_type: ContentType, _types: PhantomData (Response, Request)>, }, + Put { + url: &'static str, + auth: bool, + content_type: ContentType, + _types: PhantomData (Response, Request)>, + }, } pub enum ContentType { diff --git a/tracker.md b/tracker.md index 09b0cf3..88b56c5 100644 --- a/tracker.md +++ b/tracker.md @@ -34,7 +34,7 @@ - [x] /api/3/payments/classfund/teacher/students/:classId - [ ] /api/3/classbook/lessonTags - [ ] /api/3/komens/messages/rating/:messageId -- [ ] /api/3/absence/student +- [x] /api/3/absence/student - [ ] /api/3/webmodule - [ ] /api/3/timetable/actual - [x] /api/3/payments/classfund/teacher/document/detail/:documentId @@ -67,7 +67,7 @@ - [ ] /api/3/komens/message/:messageId/mark-as-unhidden - [ ] /api/3/lesson/:lessonId/studentsTimetable - [ ] /api/3/marks/final -- [ ] /api/3/timetable/student/:studentId +- [x] /api/3/timetable/student/:studentId - [ ] /api/3/marking/atom/:atomId/headerOptions - [ ] /api/3/gdpr/consent/:id/disagree - [ ] /api/3/komens/messages/sent @@ -84,7 +84,7 @@ - [ ] /api/3/timetable/actual/class/:classId - [ ] /api/3/gdpr/consents/person - [ ] /api/3/komens/messages/unread -- [ ] /api/3/absence +- [x] /api/3/absence - [ ] /api/3/komens/message/:messageId/mark-as-confirmed - [ ] /api/3/komens/messages/apology - [x] /api/3/events @@ -99,7 +99,7 @@ - [ ] /api/3/gdpr/consent/:id/revoke-request - [x] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students/:studentId - [ ] /api/3/marking/atoms -- [ ] /api/3/absence/canexcuse/:studentId +- [x] /api/3/absence/canexcuse/:studentId - [ ] /api/3/komens/rating-templates - [ ] /api/3/emergency/participantsselection - [ ] /api/3/komens/messages/noticeboard/unread From b3e6c145a35e1a1fa05af385125aa780f68a0557 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 02:37:56 +0100 Subject: [PATCH 07/22] added semester --- src/homework/endpoints.rs | 6 +++--- src/lib.rs | 4 +--- src/semester/endpoints.rs | 15 +++++++++++++++ src/semester/mod.rs | 5 +++++ src/{ => semester}/semester.rs | 0 tracker.md | 4 ++-- 6 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 src/semester/endpoints.rs create mode 100644 src/semester/mod.rs rename src/{ => semester}/semester.rs (100%) diff --git a/src/homework/endpoints.rs b/src/homework/endpoints.rs index ca3710f..c5367cb 100644 --- a/src/homework/endpoints.rs +++ b/src/homework/endpoints.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::{Endpoint, HomeworkList}; -pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint<(), i64> = Endpoint::Get { +pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/homeworks/count-actual", auth: true, _types: PhantomData, @@ -10,14 +10,14 @@ pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint<(), i64> = Endpoint::Get { /// ID = homework ID (String) /// finished = homework state (bool) -pub const HOMEWORK_DONE_ENDPOINT: Endpoint<(), bool> = Endpoint::Get { +pub const HOMEWORK_DONE_ENDPOINT: Endpoint = Endpoint::Get { url: "api/3/homeworks/{id}/student-done/{finished}", auth: true, _types: PhantomData, }; /// Query 'from' and 'to' (Datetime) -pub const HOMEWORKS_ENDPOINT: Endpoint<(), HomeworkList> = Endpoint::Get { +pub const HOMEWORKS_ENDPOINT: Endpoint = Endpoint::Get { url: "api/3/homeworks", auth: true, _types: PhantomData, diff --git a/src/lib.rs b/src/lib.rs index c728c09..8e67459 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,9 +38,7 @@ pub use homework::*; pub use marks::*; pub use others::*; pub use payments::*; -pub use semester::{ - CertificateTerm, CertificateTerms, FinalMark, PedagogicalMeasure, PedagogicalMeasures, -}; +pub use semester::*; pub use stdtype::{ Room, RoomSet, SchoolClass, SchoolClassSet, StdClassGroup, StdType, StdTypeNullable, Student, Teacher, TeacherSet, TimetableStudent, diff --git a/src/semester/endpoints.rs b/src/semester/endpoints.rs new file mode 100644 index 0000000..e83270b --- /dev/null +++ b/src/semester/endpoints.rs @@ -0,0 +1,15 @@ +use std::marker::PhantomData; + +use crate::{CertificateTerms, Endpoint, PedagogicalMeasures}; + +pub const GET_CERTIFICATE_TERMS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/marks/final", + auth: true, + _types: PhantomData, +}; + +pub const GET_PEDAGOGICAL_MEASURES_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/marks/measures", + auth: true, + _types: PhantomData, +}; \ No newline at end of file diff --git a/src/semester/mod.rs b/src/semester/mod.rs new file mode 100644 index 0000000..2d7088b --- /dev/null +++ b/src/semester/mod.rs @@ -0,0 +1,5 @@ +mod semester; +mod endpoints; + +pub use semester::*; +pub use endpoints::*; \ No newline at end of file diff --git a/src/semester.rs b/src/semester/semester.rs similarity index 100% rename from src/semester.rs rename to src/semester/semester.rs diff --git a/tracker.md b/tracker.md index 88b56c5..405d76e 100644 --- a/tracker.md +++ b/tracker.md @@ -44,7 +44,7 @@ - [x] /api/3/payments/classfund - [ ] /api/3/gdpr/consents/person/child - [ ] /api/3/komens/concept/:conceptId -- [ ] /api/3/marks/measures +- [x] /api/3/marks/measures - [ ] /api/3/unregister-user-notification - [ ] /api/3/gdpr/consent/:id/agree - [x] /api/3/marks/count-new @@ -66,7 +66,7 @@ - [ ] /api/3/gdpr/commissioner/send-report - [ ] /api/3/komens/message/:messageId/mark-as-unhidden - [ ] /api/3/lesson/:lessonId/studentsTimetable -- [ ] /api/3/marks/final +- [x] /api/3/marks/final - [x] /api/3/timetable/student/:studentId - [ ] /api/3/marking/atom/:atomId/headerOptions - [ ] /api/3/gdpr/consent/:id/disagree From 48fde73a7341ffca40b4b8f3c901771e82a07e71 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 02:42:13 +0100 Subject: [PATCH 08/22] fixes --- src/others/endpoints.rs | 4 ++-- src/payments/endpoints.rs | 22 +++++++++++----------- src/semester/endpoints.rs | 2 +- src/semester/mod.rs | 4 ++-- src/subjects/endpoints.rs | 2 +- src/substitutions/endpoints.rs | 4 ++-- src/teaching/endpoints.rs | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/others/endpoints.rs b/src/others/endpoints.rs index 50cbfa6..7faa858 100644 --- a/src/others/endpoints.rs +++ b/src/others/endpoints.rs @@ -2,13 +2,13 @@ use std::marker::PhantomData; use crate::{ApiInfo, Endpoint}; -pub const API_V3_INFO_ENDPOINT: Endpoint<(), ApiInfo> = Endpoint::Get { +pub const API_V3_INFO_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3", auth: false, _types: PhantomData, }; -pub const APIS_INFO_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { +pub const APIS_INFO_ENDPOINT: Endpoint, ()> = Endpoint::Get { url: "/api", auth: false, _types: PhantomData, diff --git a/src/payments/endpoints.rs b/src/payments/endpoints.rs index 1779c11..9398bd0 100644 --- a/src/payments/endpoints.rs +++ b/src/payments/endpoints.rs @@ -7,37 +7,37 @@ use crate::{ RegularPrescriptionDetail, RegularPrescriptionStudent, RegularPrescriptionStudentDetail, }; -pub const CLASS_FUND_PAYMENT_INFO_ENDPOINT: Endpoint<(), ClassFundPaymentInfo> = Endpoint::Get { +pub const CLASS_FUND_PAYMENT_INFO_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/classfund/paymentsinfo", auth: true, _types: PhantomData, }; -pub const REGULAR_PAYMENTS_INFO_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { +pub const REGULAR_PAYMENTS_INFO_ENDPOINT: Endpoint, ()> = Endpoint::Get { url: "/api/3/payments/regularpayments", auth: true, _types: PhantomData, }; -pub const REGULAR_PAYMENTS_SUMMARY_ENDPOINT: Endpoint<(), RegularPaymentsSummary> = Endpoint::Get { +pub const REGULAR_PAYMENTS_SUMMARY_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/regularpayments/summary", auth: true, _types: PhantomData, }; -pub const CLASS_FUND_INFO_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { +pub const CLASS_FUND_INFO_ENDPOINT: Endpoint, ()> = Endpoint::Get { url: "/api/3/payments/classfund", auth: true, _types: PhantomData, }; -pub const CLASS_FUND_SUMMARY_ENDPOINT: Endpoint<(), ClassFundSummary> = Endpoint::Get { +pub const CLASS_FUND_SUMMARY_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/classfund/summary", auth: true, _types: PhantomData, }; -pub const REGULAR_PAYMENT_DETAIL_ENDPOINT: Endpoint<(), RegularPaymentDetail> = Endpoint::Get { +pub const REGULAR_PAYMENT_DETAIL_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/regularpayments/detail/{paymentId}", auth: true, _types: PhantomData, @@ -52,13 +52,13 @@ pub const CLASS_FUND_TEACHER_DOCUMENT_DETAIL_ENDPOINT: Endpoint< _types: PhantomData, }; -pub const REGULAR_PRESCRIPTIONS_ENDPOINT: Endpoint<(), Vec> = Endpoint::Get { +pub const REGULAR_PRESCRIPTIONS_ENDPOINT: Endpoint, ()> = Endpoint::Get { url: "/api/3/payments/regularpayments/teacher/prescriptions", auth: true, _types: PhantomData, }; -pub const CLASS_FUND_TEACHER_STUDENTS_ENDPOINT: Endpoint<(), Vec> = +pub const CLASS_FUND_TEACHER_STUDENTS_ENDPOINT: Endpoint, ()> = Endpoint::Get { url: "/api/3/payments/classfund/teacher/students/{classId}", auth: true, @@ -74,14 +74,14 @@ pub const CLASS_FUND_TEACHER_DOCUMENTS_ENDPOINT: Endpoint< _types: PhantomData, }; -pub const CLASS_FUND_TEACHER_SUMMARY_ENDPOINT: Endpoint<(), ClassFundTeacherSummary> = +pub const CLASS_FUND_TEACHER_SUMMARY_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/classfund/teacher/summary", auth: true, _types: PhantomData, }; -pub const REGULAR_PRESCRIPTION_DETAIL_ENDPOINT: Endpoint<(), RegularPrescriptionDetail> = +pub const REGULAR_PRESCRIPTION_DETAIL_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}", auth: true, @@ -97,7 +97,7 @@ pub const REGULAR_PRESCRIPTION_STUDENT_DETAIL_ENDPOINT: Endpoint< _types: PhantomData, }; -pub const REGULAR_PRESCRIPTION_STUDENTS_ENDPOINT: Endpoint<(), Vec> = +pub const REGULAR_PRESCRIPTION_STUDENTS_ENDPOINT: Endpoint, ()> = Endpoint::Get { url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}/students", auth: true, diff --git a/src/semester/endpoints.rs b/src/semester/endpoints.rs index e83270b..c023000 100644 --- a/src/semester/endpoints.rs +++ b/src/semester/endpoints.rs @@ -12,4 +12,4 @@ pub const GET_PEDAGOGICAL_MEASURES_ENDPOINT: Endpoint = url: "/api/3/marks/measures", auth: true, _types: PhantomData, -}; \ No newline at end of file +}; diff --git a/src/semester/mod.rs b/src/semester/mod.rs index 2d7088b..e2b6723 100644 --- a/src/semester/mod.rs +++ b/src/semester/mod.rs @@ -1,5 +1,5 @@ -mod semester; mod endpoints; +mod semester; +pub use endpoints::*; pub use semester::*; -pub use endpoints::*; \ No newline at end of file diff --git a/src/subjects/endpoints.rs b/src/subjects/endpoints.rs index 8ee5e49..d899928 100644 --- a/src/subjects/endpoints.rs +++ b/src/subjects/endpoints.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::{Endpoint, Subjects}; -pub const SUBJECTS_ENDPOINT: Endpoint<(), Subjects> = Endpoint::Get { +pub const SUBJECTS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/subjects", auth: true, _types: PhantomData, diff --git a/src/substitutions/endpoints.rs b/src/substitutions/endpoints.rs index 1f24737..729a6e7 100644 --- a/src/substitutions/endpoints.rs +++ b/src/substitutions/endpoints.rs @@ -2,13 +2,13 @@ use std::marker::PhantomData; use crate::{Endpoint, SubstitutionCycles, Substitutions}; -pub const SUBSTITUTIONS_ENDPOINT: Endpoint<(), Substitutions> = Endpoint::Get { +pub const SUBSTITUTIONS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/substitutions", auth: true, _types: PhantomData, }; -pub const SUBSTITUTION_CYCLES_ENDPOINT: Endpoint<(), SubstitutionCycles> = Endpoint::Get { +pub const SUBSTITUTION_CYCLES_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/substitutions/cycles", auth: true, _types: PhantomData, diff --git a/src/teaching/endpoints.rs b/src/teaching/endpoints.rs index 3592e88..a0f60ee 100644 --- a/src/teaching/endpoints.rs +++ b/src/teaching/endpoints.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; use crate::{Endpoint, Teaching}; /// Subject ID = String -pub const TEACHING_ENDPOINT: Endpoint<(), Teaching> = Endpoint::Get { +pub const TEACHING_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/subjects/themes/{subjectId}", auth: true, _types: PhantomData, From 3a0aa1e117e921f5ae1baa65a64eeb12877f4d7b Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 14:48:24 +0100 Subject: [PATCH 09/22] added gdpr endpoints --- src/gdpr/endpoints.rs | 63 ++++++++++++++++++++++++++++++++++++++++++ src/{ => gdpr}/gdpr.rs | 6 ++++ src/gdpr/mod.rs | 5 ++++ src/lib.rs | 5 +--- 4 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 src/gdpr/endpoints.rs rename src/{ => gdpr}/gdpr.rs (91%) create mode 100644 src/gdpr/mod.rs diff --git a/src/gdpr/endpoints.rs b/src/gdpr/endpoints.rs new file mode 100644 index 0000000..7360f53 --- /dev/null +++ b/src/gdpr/endpoints.rs @@ -0,0 +1,63 @@ +use std::marker::PhantomData; + +use crate::{ContentType, Endpoint, GdprCommissioners, GdprConsents}; + +pub const SEND_GDPR_OBJECTION_ENDPOINT: Endpoint<(), String> = Endpoint::Post { + url: "/api/3/payments/classfund/paymentsinfo", + auth: true, + content_type: ContentType::Json, + _types: PhantomData, +}; + +pub const GDPR_CONSENT_REVOKE_ENDPOINT: Endpoint<(), ()> = Endpoint::Put { + url: "/api/3/gdpr/consent/{id}/revoke-request", + auth: true, + content_type: ContentType::Json, + _types: PhantomData, +}; + +pub const GDPR_CONSENT_AGREE_ENDPOINT: Endpoint<(), ()> = Endpoint::Put { + url: "/api/3/gdpr/consent/{id}/agree", + auth: true, + content_type: ContentType::Json, + _types: PhantomData, +}; + +pub const GDPR_CONSENT_DISAGREE_ENDPOINT: Endpoint<(), ()> = Endpoint::Put { + url: "/api/3/gdpr/consent/{id}/disagree", + auth: true, + content_type: ContentType::Json, + _types: PhantomData, +}; + +pub const GDPR_CONSENTS_COUNT_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/gdpr/consents/person/new", + auth: true, + _types: PhantomData, +}; + +pub const SEND_GDPR_REPORT_ENDPOINT: Endpoint<(), ()> = Endpoint::Post { + // unknown request type + url: "/api/3/gdpr/commissioner/send-report", + auth: true, + content_type: ContentType::Json, + _types: PhantomData, +}; + +pub const GET_GDPR_COMMISSIONERS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/gdpr/commissioners", + auth: true, + _types: PhantomData, +}; + +pub const GET_GDPR_CHILD_CONSENTS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/gdpr/consents/person/child", + auth: true, + _types: PhantomData, +}; + +pub const GET_GDPR_CONSENTS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/gdpr/consents/person", + auth: true, + _types: PhantomData, +}; diff --git a/src/gdpr.rs b/src/gdpr/gdpr.rs similarity index 91% rename from src/gdpr.rs rename to src/gdpr/gdpr.rs index 959f4ee..a2bedaf 100644 --- a/src/gdpr.rs +++ b/src/gdpr/gdpr.rs @@ -70,3 +70,9 @@ pub struct GdprConsentRights { pub can_disagree: bool, pub can_revoke_request: bool, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct GdprConsents { + pub person_consents: Vec, +} diff --git a/src/gdpr/mod.rs b/src/gdpr/mod.rs new file mode 100644 index 0000000..2079a5b --- /dev/null +++ b/src/gdpr/mod.rs @@ -0,0 +1,5 @@ +mod endpoints; +mod gdpr; + +pub use endpoints::*; +pub use gdpr::*; diff --git a/src/lib.rs b/src/lib.rs index 8e67459..18023de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,10 +30,7 @@ pub use campaign::Campaign; pub use endpoints::*; pub use error::{Error, ModelState, StringArray}; pub use events::*; -pub use gdpr::{ - GdprCommissioner, GdprCommissioners, GdprConsent, GdprConsentRights, GdprConsentState, - GdprValidity, -}; +pub use gdpr::*; pub use homework::*; pub use marks::*; pub use others::*; From 5b002084fb120a5dfc7a8ac82194e3badb4cf6fe Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 14:51:43 +0100 Subject: [PATCH 10/22] typo fix --- src/absence/endpoints.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/absence/endpoints.rs b/src/absence/endpoints.rs index 1b70b8a..354fa78 100644 --- a/src/absence/endpoints.rs +++ b/src/absence/endpoints.rs @@ -28,7 +28,7 @@ pub const GET_STUDENT_TIMETABLE_WITH_ABSENCES_ENDPOINT: Endpoint< }; pub const EXCUSE_KOMENS_ABSENCE_ENDPOINT: Endpoint = Endpoint::Put { - //TODO unknown behaviour (and request type) // probably bsenceRecord or AbsenceRecordWithSubject + //TODO unknown behaviour (and request type) // probably absenceRecord or AbsenceRecordWithSubject url: "/api/3/absence", auth: true, content_type: ContentType::Json, From 945497e83d98ee24223efdeb817277cd271dccfa Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 14:54:30 +0100 Subject: [PATCH 11/22] updated tracker --- tracker.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tracker.md b/tracker.md index 405d76e..d4add0a 100644 --- a/tracker.md +++ b/tracker.md @@ -42,11 +42,11 @@ - [ ] /api/3/komens/attachment/:id - [x] /api/3/subjects/themes/:subjectId - [x] /api/3/payments/classfund -- [ ] /api/3/gdpr/consents/person/child +- [x] /api/3/gdpr/consents/person/child - [ ] /api/3/komens/concept/:conceptId - [x] /api/3/marks/measures - [ ] /api/3/unregister-user-notification -- [ ] /api/3/gdpr/consent/:id/agree +- [x] /api/3/gdpr/consent/:id/agree - [x] /api/3/marks/count-new - [ ] /api/3/komens/concept - [ ] /api/3/timetable/permanent @@ -57,19 +57,19 @@ - [x] /api/3/payments/regularpayments/detail/:paymentId - [x] /api/3/substitutions - [ ] /api/3/marks/what-if -- [ ] /api/3/gdpr/commissioner/send-objection -- [ ] /api/3/gdpr/consents/person/new +- [x] /api/3/gdpr/commissioner/send-objection +- [x] /api/3/gdpr/consents/person/new - [ ] /api/3/lesson/:lessonId/absence - [x] /api/3/payments/regularpayments/summary - [ ] /api/3/emergency/startemergency - [ ] /api/3/timetable/permanent/class/:classId -- [ ] /api/3/gdpr/commissioner/send-report +- [x] /api/3/gdpr/commissioner/send-report - [ ] /api/3/komens/message/:messageId/mark-as-unhidden - [ ] /api/3/lesson/:lessonId/studentsTimetable - [x] /api/3/marks/final - [x] /api/3/timetable/student/:studentId - [ ] /api/3/marking/atom/:atomId/headerOptions -- [ ] /api/3/gdpr/consent/:id/disagree +- [x] /api/3/gdpr/consent/:id/disagree - [ ] /api/3/komens/messages/sent - [ ] /api/3/emergency/configuration - [ ] /api/3/komens/message @@ -96,7 +96,7 @@ - [x] /api/3/payments/regularpayments/teacher/prescriptions - [x] /api/3/marks/SetClassificationConfirmation - [x] /api/3/homeworks/count-actual -- [ ] /api/3/gdpr/consent/:id/revoke-request +- [x] /api/3/gdpr/consent/:id/revoke-request - [x] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students/:studentId - [ ] /api/3/marking/atoms - [x] /api/3/absence/canexcuse/:studentId From 443302659570616861beb30957f0f318c9725ecb Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:02:36 +0100 Subject: [PATCH 12/22] fixes --- src/gdpr/endpoints.rs | 2 +- src/homework/endpoints.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gdpr/endpoints.rs b/src/gdpr/endpoints.rs index 7360f53..af65a43 100644 --- a/src/gdpr/endpoints.rs +++ b/src/gdpr/endpoints.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; use crate::{ContentType, Endpoint, GdprCommissioners, GdprConsents}; pub const SEND_GDPR_OBJECTION_ENDPOINT: Endpoint<(), String> = Endpoint::Post { - url: "/api/3/payments/classfund/paymentsinfo", + url: "/api/3/gdpr/commissioner/send-objection", auth: true, content_type: ContentType::Json, _types: PhantomData, diff --git a/src/homework/endpoints.rs b/src/homework/endpoints.rs index c5367cb..586edf1 100644 --- a/src/homework/endpoints.rs +++ b/src/homework/endpoints.rs @@ -11,14 +11,14 @@ pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint = Endpoint::Get { /// ID = homework ID (String) /// finished = homework state (bool) pub const HOMEWORK_DONE_ENDPOINT: Endpoint = Endpoint::Get { - url: "api/3/homeworks/{id}/student-done/{finished}", + url: "/api/3/homeworks/{id}/student-done/{finished}", auth: true, _types: PhantomData, }; /// Query 'from' and 'to' (Datetime) pub const HOMEWORKS_ENDPOINT: Endpoint = Endpoint::Get { - url: "api/3/homeworks", + url: "/api/3/homeworks", auth: true, _types: PhantomData, }; From 16cc34d2a70f81cf018a080f634354728c72e4a6 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:48:29 +0100 Subject: [PATCH 13/22] moved attachments and campaingn to others --- src/lib.rs | 4 ---- src/{ => others}/attachment.rs | 0 src/{ => others}/campaign.rs | 0 src/others/mod.rs | 4 ++++ 4 files changed, 4 insertions(+), 4 deletions(-) rename src/{ => others}/attachment.rs (100%) rename src/{ => others}/campaign.rs (100%) diff --git a/src/lib.rs b/src/lib.rs index 18023de..8aede1c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,7 @@ mod absence; -mod attachment; mod others; //campaign mod auth; -mod campaign; mod endpoints; mod error; mod events; @@ -24,9 +22,7 @@ mod user; //TODOS //predictor pub use absence::*; -pub use attachment::AttachmentInfo; pub use auth::*; -pub use campaign::Campaign; pub use endpoints::*; pub use error::{Error, ModelState, StringArray}; pub use events::*; diff --git a/src/attachment.rs b/src/others/attachment.rs similarity index 100% rename from src/attachment.rs rename to src/others/attachment.rs diff --git a/src/campaign.rs b/src/others/campaign.rs similarity index 100% rename from src/campaign.rs rename to src/others/campaign.rs diff --git a/src/others/mod.rs b/src/others/mod.rs index 6053aa5..b37524e 100644 --- a/src/others/mod.rs +++ b/src/others/mod.rs @@ -1,5 +1,9 @@ mod api_info; +mod attachment; +mod campaign; mod endpoints; pub use api_info::*; +pub use attachment::*; +pub use campaign::*; pub use endpoints::*; From 2f86b90cda1c143e457904e6a679d6373dbd64bb Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sat, 31 Oct 2026 23:57:36 +0100 Subject: [PATCH 14/22] added timetable endpoints --- src/lib.rs | 2 +- src/timetable/endpoints.rs | 29 +++++++++++++++++++++++++++++ src/timetable/mod.rs | 5 +++++ src/{ => timetable}/timetable.rs | 0 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/timetable/endpoints.rs create mode 100644 src/timetable/mod.rs rename src/{ => timetable}/timetable.rs (100%) diff --git a/src/lib.rs b/src/lib.rs index 8aede1c..033ae80 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ mod subjects; mod substitutions; mod teaching; mod timetable; -mod user; //TODOS +mod user; //webmodules //predictor diff --git a/src/timetable/endpoints.rs b/src/timetable/endpoints.rs new file mode 100644 index 0000000..6c2cb44 --- /dev/null +++ b/src/timetable/endpoints.rs @@ -0,0 +1,29 @@ +use std::marker::PhantomData; + +use crate::{Endpoint, Timetable}; + +pub const PERNAMENT_TIMETABLE_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/timetable/permanent", + auth: true, + _types: PhantomData, +}; + +pub const PERNAMENT_TIMETABLE_CLASS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/timetable/permanent/class/{classId}", + auth: true, + _types: PhantomData, +}; + + +pub const WEEK_TIMETABLE_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/timetable/actual", + auth: true, + _types: PhantomData, +}; + + +pub const WEEK_TIMETABLE_CLASS_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/timetable/actual/class/{classId}", + auth: true, + _types: PhantomData, +}; diff --git a/src/timetable/mod.rs b/src/timetable/mod.rs new file mode 100644 index 0000000..151e3d2 --- /dev/null +++ b/src/timetable/mod.rs @@ -0,0 +1,5 @@ +mod timetable; +mod endpoints; + +pub use timetable::*; +pub use endpoints::*; \ No newline at end of file diff --git a/src/timetable.rs b/src/timetable/timetable.rs similarity index 100% rename from src/timetable.rs rename to src/timetable/timetable.rs From 1b632b8a4c293c0338634d0c00b5792db23a95ec Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:12:02 +0100 Subject: [PATCH 15/22] removed old error types --- src/error.rs | 24 ------------------------ src/lib.rs | 7 +------ 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 src/error.rs diff --git a/src/error.rs b/src/error.rs deleted file mode 100644 index 8eb4723..0000000 --- a/src/error.rs +++ /dev/null @@ -1,24 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Error { - pub message: String, - pub model_state: ModelState, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ModelState { - #[serde(rename = "$type")] - pub type_name: String, - #[serde(rename = "from")] - pub from: StringArray, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct StringArray { - #[serde(rename = "$type")] - pub type_name: String, - #[serde(rename = "$values")] - pub values: Vec, -} diff --git a/src/lib.rs b/src/lib.rs index 033ae80..6b2622f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,6 @@ mod others; //campaign mod auth; mod endpoints; -mod error; mod events; mod gdpr; //komens @@ -24,7 +23,6 @@ mod user; pub use absence::*; pub use auth::*; pub use endpoints::*; -pub use error::{Error, ModelState, StringArray}; pub use events::*; pub use gdpr::*; pub use homework::*; @@ -32,10 +30,7 @@ pub use marks::*; pub use others::*; pub use payments::*; pub use semester::*; -pub use stdtype::{ - Room, RoomSet, SchoolClass, SchoolClassSet, StdClassGroup, StdType, StdTypeNullable, Student, - Teacher, TeacherSet, TimetableStudent, -}; +pub use stdtype::*; pub use subjects::*; pub use substitutions::*; pub use teaching::*; From df592e30f4176053f398fc6e5cb81723416c96ab Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:14:37 +0100 Subject: [PATCH 16/22] updated progress in tracker.md --- tracker.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tracker.md b/tracker.md index d4add0a..1cd78bc 100644 --- a/tracker.md +++ b/tracker.md @@ -36,9 +36,9 @@ - [ ] /api/3/komens/messages/rating/:messageId - [x] /api/3/absence/student - [ ] /api/3/webmodule -- [ ] /api/3/timetable/actual +- [x] /api/3/timetable/actual - [x] /api/3/payments/classfund/teacher/document/detail/:documentId -- [ ] /api/3 +- [x] /api/3 - [ ] /api/3/komens/attachment/:id - [x] /api/3/subjects/themes/:subjectId - [x] /api/3/payments/classfund @@ -49,7 +49,7 @@ - [x] /api/3/gdpr/consent/:id/agree - [x] /api/3/marks/count-new - [ ] /api/3/komens/concept -- [ ] /api/3/timetable/permanent +- [x] /api/3/timetable/permanent - [ ] /api/3/komens/messages/noticeboard - [ ] /api/3/komens/messages/apology/:messageId - [ ] /api/3/komens/messages/received/:messageId @@ -62,7 +62,7 @@ - [ ] /api/3/lesson/:lessonId/absence - [x] /api/3/payments/regularpayments/summary - [ ] /api/3/emergency/startemergency -- [ ] /api/3/timetable/permanent/class/:classId +- [x] /api/3/timetable/permanent/class/:classId - [x] /api/3/gdpr/commissioner/send-report - [ ] /api/3/komens/message/:messageId/mark-as-unhidden - [ ] /api/3/lesson/:lessonId/studentsTimetable @@ -81,7 +81,7 @@ - [ ] /api/3/komens/concepts - [ ] /api/3/komens/messages/received/unread - [x] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId -- [ ] /api/3/timetable/actual/class/:classId +- [x] /api/3/timetable/actual/class/:classId - [ ] /api/3/gdpr/consents/person - [ ] /api/3/komens/messages/unread - [x] /api/3/absence @@ -89,8 +89,8 @@ - [ ] /api/3/komens/messages/apology - [x] /api/3/events - [ ] /api/3/komens/concepts/count -- [ ] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students -- [ ] /api/3/payments/regularpayments +- [x] /api/3/payments/regularpayments/teacher/prescriptions/:prescriptionId/students +- [x] /api/3/payments/regularpayments - [ ] /api/3/komens/messages/noticeboard/:messageId& - [ ] /api/3/komens/message-types/reply/:messageId - [x] /api/3/payments/regularpayments/teacher/prescriptions @@ -105,7 +105,7 @@ - [ ] /api/3/komens/messages/noticeboard/unread - [ ] /api/3/komens/message-types - [x] /api/3/events/my -- [ ] /api/3/gdpr/commissioners +- [x] /api/3/gdpr/commissioners - [ ] /api/3/classbook/:recordId - [ ] /api/3/marking/marks/:atomId - [x] /api/3/substitutions/cycles @@ -124,4 +124,5 @@ - [x] /api/3/payments/classfund/teacher/summary - [ ] /api/3/komens/messages/sent/:messageId - [x] /api/login -- [x] /.well-known/openid-configuration \ No newline at end of file +- [x] /.well-known/openid-configuration +- [x] /api \ No newline at end of file From 35536247dbcc9572ac555d3ab04f780f0725c35e Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:08:28 +0100 Subject: [PATCH 17/22] small refactors --- src/absence/absence.rs | 20 ++----- src/absence/endpoints.rs | 16 +++--- src/auth/endpoints.rs | 3 +- src/endpoints.rs | 1 + src/events/endpoints.rs | 3 +- src/events/event.rs | 32 ++++------- src/events/event_time.rs | 10 ++++ src/events/mod.rs | 2 + src/gdpr/endpoints.rs | 3 +- src/gdpr/gdpr.rs | 78 --------------------------- src/gdpr/gdpr_commissioner.rs | 19 +++++++ src/gdpr/gdpr_consent.rs | 28 ++++++++++ src/gdpr/gdpr_consent_rights.rs | 9 ++++ src/gdpr/gdpr_consent_state.rs | 14 +++++ src/gdpr/gdpr_validity.rs | 11 ++++ src/gdpr/mod.rs | 12 ++++- src/homework/endpoints.rs | 3 +- src/homework/homeworks.rs | 25 +++++---- src/marks/endpoints.rs | 3 +- src/marks/mark.rs | 31 +++++++++++ src/marks/mark_confirmation_status.rs | 10 ++++ src/marks/mod.rs | 4 ++ src/marks/subject_marks.rs | 45 ++-------------- src/others/endpoints.rs | 3 +- src/payments/endpoints.rs | 3 +- src/semester/endpoints.rs | 3 +- src/semester/semester.rs | 3 +- src/stdtype.rs | 18 +------ src/subjects/endpoints.rs | 3 +- src/substitutions/endpoints.rs | 3 +- src/substitutions/substitutions.rs | 3 +- src/teaching/endpoints.rs | 3 +- src/teaching/teaching.rs | 3 +- src/timetable/endpoints.rs | 5 +- src/timetable/mod.rs | 4 +- src/timetable/timetable.rs | 9 ++-- src/user/endpoints.rs | 3 +- src/user/user_info.rs | 9 ++-- 38 files changed, 213 insertions(+), 244 deletions(-) create mode 100644 src/events/event_time.rs delete mode 100644 src/gdpr/gdpr.rs create mode 100644 src/gdpr/gdpr_commissioner.rs create mode 100644 src/gdpr/gdpr_consent.rs create mode 100644 src/gdpr/gdpr_consent_rights.rs create mode 100644 src/gdpr/gdpr_consent_state.rs create mode 100644 src/gdpr/gdpr_validity.rs create mode 100644 src/marks/mark.rs create mode 100644 src/marks/mark_confirmation_status.rs diff --git a/src/absence/absence.rs b/src/absence/absence.rs index 1cafb2e..f5ce811 100644 --- a/src/absence/absence.rs +++ b/src/absence/absence.rs @@ -1,11 +1,10 @@ +use crate::{Hour, StdType, StdTypeNullable}; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -use crate::{Hour, StdType, StdTypeNullable}; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct StudentAbsenceOverviewResponse { +pub struct AbsenceOverviewResponse { pub percentage_threshold: f64, //TODO: cutom type (u8) pub absences: Vec, pub absences_per_subject: Option>, @@ -36,18 +35,10 @@ pub struct SubjectAbsence { pub distance_teaching: u16, } -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SubjectAbsenceOverviewResponse { - pub percentage_threshold: f64, - pub absences: Option>, - pub absences_per_subject: Option>, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct StudentTimetableAbsenceResponse { - pub student: Option, + pub student: Option, pub days: Vec, pub absent_type_options: Vec, } @@ -60,7 +51,7 @@ pub struct AbsenceTypeOption { pub absent_kind_required: bool, pub absent_note_enabled: bool, pub next_absent_type: AbsentType, - pub absent_kinds: Vec, + pub absent_kinds: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -76,9 +67,6 @@ pub enum AbsentType { NoAbsent, } -type StudentInfo = StdTypeNullable; -type AbsenceKind = StdType; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct AbsenceSubject { diff --git a/src/absence/endpoints.rs b/src/absence/endpoints.rs index 354fa78..e18c6ac 100644 --- a/src/absence/endpoints.rs +++ b/src/absence/endpoints.rs @@ -1,9 +1,8 @@ -use std::marker::PhantomData; - use crate::{ - ContentType, Endpoint, ExcuseAbsenceResponse, StudentAbsenceOverviewResponse, + AbsenceOverviewResponse, ContentType, Endpoint, ExcuseAbsenceResponse, StudentTimetableAbsenceResponse, }; +use std::marker::PhantomData; pub const CAN_STUDENT_EXCUSE_ABSENCE_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/absence/canexcuse/{studentId}", @@ -11,12 +10,11 @@ pub const CAN_STUDENT_EXCUSE_ABSENCE_ENDPOINT: Endpoint = Endpoint::Ge _types: PhantomData, }; -pub const GET_STUDENT_ABSENCE_ENDPOINT: Endpoint = - Endpoint::Get { - url: "/api/3/absence/student", - auth: true, - _types: PhantomData, - }; +pub const GET_STUDENT_ABSENCE_ENDPOINT: Endpoint = Endpoint::Get { + url: "/api/3/absence/student", + auth: true, + _types: PhantomData, +}; pub const GET_STUDENT_TIMETABLE_WITH_ABSENCES_ENDPOINT: Endpoint< StudentTimetableAbsenceResponse, diff --git a/src/auth/endpoints.rs b/src/auth/endpoints.rs index e7b9a5d..3a0db5f 100644 --- a/src/auth/endpoints.rs +++ b/src/auth/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{ContentType, Endpoint, LoginSuccess, OpenIdDiscovery, auth::login::LoginRequest}; +use std::marker::PhantomData; pub const LOGIN_ENDPOINT: Endpoint = Endpoint::Post { url: "/api/login", diff --git a/src/endpoints.rs b/src/endpoints.rs index 9c7a8a1..7691458 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -1,6 +1,7 @@ use std::marker::PhantomData; pub enum Endpoint { + //TODO: better url handling. (defining api version/is base url used/query/url params) Get { url: &'static str, auth: bool, diff --git a/src/events/endpoints.rs b/src/events/endpoints.rs index bdd3773..df6da5e 100644 --- a/src/events/endpoints.rs +++ b/src/events/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{Endpoint, Events}; +use std::marker::PhantomData; pub const EVENTS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/events", diff --git a/src/events/event.rs b/src/events/event.rs index 9c35ef5..4eb3dfa 100644 --- a/src/events/event.rs +++ b/src/events/event.rs @@ -1,38 +1,28 @@ -use crate::{Room, RoomSet, SchoolClass, SchoolClassSet, StdType, Student, Teacher, TeacherSet}; +use crate::{EventTime, StdType}; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Events { - pub events: Vec, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Event { pub id: String, pub title: String, pub description: String, - pub event_type: EventType, + pub event_type: StdType, pub times: Vec, - pub classes: Vec, - pub class_sets: Vec, - pub teachers: Vec, - pub teacher_sets: Vec, - pub rooms: Vec, - pub room_sets: Vec, - pub students: Vec, + pub classes: Vec, + pub class_sets: Vec, + pub teachers: Vec, + pub teacher_sets: Vec, + pub rooms: Vec, + pub room_sets: Vec, + pub students: Vec, pub note: Option, pub date_changed: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct EventTime { - pub whole_day: bool, - pub start_time: Option>, - pub end_time: Option>, +pub struct Events { + pub events: Vec, } - -pub type EventType = StdType; diff --git a/src/events/event_time.rs b/src/events/event_time.rs new file mode 100644 index 0000000..72f2b0b --- /dev/null +++ b/src/events/event_time.rs @@ -0,0 +1,10 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct EventTime { + pub whole_day: bool, + pub start_time: Option>, + pub end_time: Option>, +} diff --git a/src/events/mod.rs b/src/events/mod.rs index 2dc3044..1581bb1 100644 --- a/src/events/mod.rs +++ b/src/events/mod.rs @@ -1,5 +1,7 @@ mod endpoints; mod event; +mod event_time; pub use endpoints::*; pub use event::*; +pub use event_time::*; diff --git a/src/gdpr/endpoints.rs b/src/gdpr/endpoints.rs index af65a43..6d4bf56 100644 --- a/src/gdpr/endpoints.rs +++ b/src/gdpr/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{ContentType, Endpoint, GdprCommissioners, GdprConsents}; +use std::marker::PhantomData; pub const SEND_GDPR_OBJECTION_ENDPOINT: Endpoint<(), String> = Endpoint::Post { url: "/api/3/gdpr/commissioner/send-objection", diff --git a/src/gdpr/gdpr.rs b/src/gdpr/gdpr.rs deleted file mode 100644 index a2bedaf..0000000 --- a/src/gdpr/gdpr.rs +++ /dev/null @@ -1,78 +0,0 @@ -use chrono::{DateTime, FixedOffset}; -use serde::{Deserialize, Serialize}; - -use crate::UserType; - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct GdprCommissioners { - pub commissioners: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct GdprCommissioner { - pub id: String, - pub name: String, - pub mobile: String, - pub phone: String, - pub email: String, - pub web: Option, - pub data_box: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct GdprConsent { - pub id: i64, - pub person_type: UserType, - pub person_id: String, - pub created: DateTime, - pub validity: GdprValidity, - pub valid_from: DateTime, - pub state: GdprConsentState, - pub title: Option, - pub personal_data: Option, - pub usage_purpose: Option, - pub valid_to: Option>, - pub valid_years: Option, - pub rights: Option, - pub body: Option, -} - -#[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 { - pub can_agree: bool, - pub can_disagree: bool, - pub can_revoke_request: bool, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct GdprConsents { - pub person_consents: Vec, -} diff --git a/src/gdpr/gdpr_commissioner.rs b/src/gdpr/gdpr_commissioner.rs new file mode 100644 index 0000000..af45456 --- /dev/null +++ b/src/gdpr/gdpr_commissioner.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct GdprCommissioner { + pub id: String, + pub name: String, + pub mobile: String, + pub phone: String, + pub email: String, + pub web: Option, + pub data_box: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct GdprCommissioners { + pub commissioners: Vec, +} diff --git a/src/gdpr/gdpr_consent.rs b/src/gdpr/gdpr_consent.rs new file mode 100644 index 0000000..b9c8b71 --- /dev/null +++ b/src/gdpr/gdpr_consent.rs @@ -0,0 +1,28 @@ +use crate::{GdprConsentRights, GdprConsentState, GdprValidity, UserType}; +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct GdprConsent { + pub id: i64, + pub person_type: UserType, + pub person_id: String, + pub created: DateTime, + pub validity: GdprValidity, + pub valid_from: DateTime, + pub state: GdprConsentState, + pub title: Option, + pub personal_data: Option, + pub usage_purpose: Option, + pub valid_to: Option>, + pub valid_years: Option, + pub rights: Option, + pub body: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct GdprConsents { + pub person_consents: Vec, +} diff --git a/src/gdpr/gdpr_consent_rights.rs b/src/gdpr/gdpr_consent_rights.rs new file mode 100644 index 0000000..6a05b9b --- /dev/null +++ b/src/gdpr/gdpr_consent_rights.rs @@ -0,0 +1,9 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct GdprConsentRights { + pub can_agree: bool, + pub can_disagree: bool, + pub can_revoke_request: bool, +} diff --git a/src/gdpr/gdpr_consent_state.rs b/src/gdpr/gdpr_consent_state.rs new file mode 100644 index 0000000..ecf60d1 --- /dev/null +++ b/src/gdpr/gdpr_consent_state.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum GdprConsentState { + Agreed, + Cancelled, + Disagreed, + Expired, + NewConsent, + RevokeRequested, + Revoked, + Unknown, +} diff --git a/src/gdpr/gdpr_validity.rs b/src/gdpr/gdpr_validity.rs new file mode 100644 index 0000000..4c69ab7 --- /dev/null +++ b/src/gdpr/gdpr_validity.rs @@ -0,0 +1,11 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum GdprValidity { + EndOfStudy, + EndOfStudyPlusYears, + ToAppeal, + Unknown, + Validity, +} diff --git a/src/gdpr/mod.rs b/src/gdpr/mod.rs index 2079a5b..4495940 100644 --- a/src/gdpr/mod.rs +++ b/src/gdpr/mod.rs @@ -1,5 +1,13 @@ mod endpoints; -mod gdpr; +mod gdpr_commissioner; +mod gdpr_consent; +mod gdpr_consent_rights; +mod gdpr_consent_state; +mod gdpr_validity; pub use endpoints::*; -pub use gdpr::*; +pub use gdpr_commissioner::*; +pub use gdpr_consent::*; +pub use gdpr_consent_rights::*; +pub use gdpr_consent_state::*; +pub use gdpr_validity::*; diff --git a/src/homework/endpoints.rs b/src/homework/endpoints.rs index 586edf1..a6b3f0b 100644 --- a/src/homework/endpoints.rs +++ b/src/homework/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{Endpoint, HomeworkList}; +use std::marker::PhantomData; pub const HOMEWORKS_COUNT_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/homeworks/count-actual", diff --git a/src/homework/homeworks.rs b/src/homework/homeworks.rs index 3fea919..9962e46 100644 --- a/src/homework/homeworks.rs +++ b/src/homework/homeworks.rs @@ -1,17 +1,10 @@ +use crate::{AttachmentInfo, StdType}; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -use crate::{AttachmentInfo, StdType}; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct HomeworkList { - pub homeworks: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct HomeworkListItem { +pub struct HomeworkItem { #[serde(rename = "ID")] pub id: String, pub date_start: DateTime, @@ -22,10 +15,16 @@ pub struct HomeworkListItem { pub closed: bool, pub electronic: bool, //check existance pub hour: i64, - pub class: StdType, //HomeworkSchoolClass - pub group: StdType, //HomeworkSchoolGroup - pub subject: StdType, //HomeworkSchoolSubject - pub teacher: StdType, //HomeworkTeacher + pub class: StdType, + pub group: StdType, + pub subject: StdType, + pub teacher: StdType, pub attachments: Vec, pub finished: bool, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct HomeworkList { + pub homeworks: Vec, +} diff --git a/src/marks/endpoints.rs b/src/marks/endpoints.rs index 5c6a55c..54dcf05 100644 --- a/src/marks/endpoints.rs +++ b/src/marks/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{ContentType, Endpoint, Marks}; +use std::marker::PhantomData; pub const CONFIRM_MARKS_ENDPOINT: Endpoint<(), Vec> = Endpoint::Post { url: "/api/3/marks/SetClassificationConfirmation", diff --git a/src/marks/mark.rs b/src/marks/mark.rs new file mode 100644 index 0000000..9eadcf8 --- /dev/null +++ b/src/marks/mark.rs @@ -0,0 +1,31 @@ +use crate::MarkConfirmationStatus; +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Mark { + pub mark_date: DateTime, + pub edit_date: DateTime, + pub is_invalid_date: bool, + pub teacher_id: Option, + pub subject_id: String, + pub is_new: bool, + pub is_points: bool, + pub calculated_mark_text: String, + pub max_points: i64, + pub is_predictor_mark: bool, + pub mark_confirmation_state: MarkConfirmationStatus, + pub caption: Option, + pub theme: Option, + pub mark_text: Option, + pub r#type: Option, + pub type_note: Option, + pub weight: Option, + pub class_rank_text: Option, + pub id: Option, + pub points_text: Option, + pub confirmed_when: Option>, + pub confirmed_by: Option, + pub verbal_evaluation: Option, +} diff --git a/src/marks/mark_confirmation_status.rs b/src/marks/mark_confirmation_status.rs new file mode 100644 index 0000000..3b08491 --- /dev/null +++ b/src/marks/mark_confirmation_status.rs @@ -0,0 +1,10 @@ +pub use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum MarkConfirmationStatus { + Confirmed, + DoesNotRequireConfirmation, + Unconfirmed, + UnconfirmedAfterChange, +} diff --git a/src/marks/mod.rs b/src/marks/mod.rs index 1530cc9..aa07d14 100644 --- a/src/marks/mod.rs +++ b/src/marks/mod.rs @@ -1,5 +1,9 @@ mod endpoints; +mod mark; +mod mark_confirmation_status; mod subject_marks; pub use endpoints::*; +pub use mark::*; +pub use mark_confirmation_status::*; pub use subject_marks::*; diff --git a/src/marks/subject_marks.rs b/src/marks/subject_marks.rs index ddac43f..474d498 100644 --- a/src/marks/subject_marks.rs +++ b/src/marks/subject_marks.rs @@ -1,14 +1,6 @@ -use chrono::{DateTime, FixedOffset}; +use crate::{Mark, StdType}; use serde::{Deserialize, Serialize}; -use crate::StdType; - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct Marks { - pub subjects: Vec, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct SubjectMarks { @@ -24,37 +16,6 @@ pub struct SubjectMarks { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct Mark { - pub mark_date: DateTime, - pub edit_date: DateTime, - pub is_invalid_date: bool, - pub teacher_id: Option, - pub subject_id: String, - pub is_new: bool, - pub is_points: bool, - pub calculated_mark_text: String, - pub max_points: i64, - pub is_predictor_mark: bool, - pub mark_confirmation_state: MarkConfirmationStatus, - pub caption: Option, - pub theme: Option, - pub mark_text: Option, - pub r#type: Option, - pub type_note: Option, - pub weight: Option, - pub class_rank_text: Option, - pub id: Option, - pub points_text: Option, - pub confirmed_when: Option>, - pub confirmed_by: Option, - pub verbal_evaluation: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub enum MarkConfirmationStatus { - Confirmed, - DoesNotRequireConfirmation, - Unconfirmed, - UnconfirmedAfterChange, +pub struct Marks { + pub subjects: Vec, } diff --git a/src/others/endpoints.rs b/src/others/endpoints.rs index 7faa858..d3d361c 100644 --- a/src/others/endpoints.rs +++ b/src/others/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{ApiInfo, Endpoint}; +use std::marker::PhantomData; pub const API_V3_INFO_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3", diff --git a/src/payments/endpoints.rs b/src/payments/endpoints.rs index 9398bd0..bd1e31c 100644 --- a/src/payments/endpoints.rs +++ b/src/payments/endpoints.rs @@ -1,11 +1,10 @@ -use std::marker::PhantomData; - use crate::{ ClassFundMonthly, ClassFundPaymentInfo, ClassFundSummary, ClassFundTeacherDocumentDetail, ClassFundTeacherDocumentsMonthly, ClassFundTeacherStudentsItem, ClassFundTeacherSummary, Endpoint, RegularPayment, RegularPaymentDetail, RegularPaymentsSummary, RegularPrescription, RegularPrescriptionDetail, RegularPrescriptionStudent, RegularPrescriptionStudentDetail, }; +use std::marker::PhantomData; pub const CLASS_FUND_PAYMENT_INFO_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/classfund/paymentsinfo", diff --git a/src/semester/endpoints.rs b/src/semester/endpoints.rs index c023000..2ba7988 100644 --- a/src/semester/endpoints.rs +++ b/src/semester/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{CertificateTerms, Endpoint, PedagogicalMeasures}; +use std::marker::PhantomData; pub const GET_CERTIFICATE_TERMS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/marks/final", diff --git a/src/semester/semester.rs b/src/semester/semester.rs index cc7d2b0..d69c925 100644 --- a/src/semester/semester.rs +++ b/src/semester/semester.rs @@ -1,8 +1,7 @@ +use crate::StdTypeNullable; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -use crate::StdTypeNullable; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct CertificateTerms { diff --git a/src/stdtype.rs b/src/stdtype.rs index 3dd77f1..f633741 100644 --- a/src/stdtype.rs +++ b/src/stdtype.rs @@ -16,25 +16,9 @@ pub struct StdTypeNullable { pub name: Option, } -pub type SchoolClass = StdType; - -pub type StdClassGroup = StdType; - -pub type SchoolClassSet = StdType; - -pub type Teacher = StdType; - -pub type TeacherSet = StdType; - -pub type Room = StdType; - -pub type RoomSet = StdType; - -pub type Student = StdType; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct TimetableStudent { +pub struct StdTypeAbbrevNullable { pub id: String, pub abbrev: Option, pub name: String, diff --git a/src/subjects/endpoints.rs b/src/subjects/endpoints.rs index d899928..c20f6e8 100644 --- a/src/subjects/endpoints.rs +++ b/src/subjects/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{Endpoint, Subjects}; +use std::marker::PhantomData; pub const SUBJECTS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/subjects", diff --git a/src/substitutions/endpoints.rs b/src/substitutions/endpoints.rs index 729a6e7..5dfb790 100644 --- a/src/substitutions/endpoints.rs +++ b/src/substitutions/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{Endpoint, SubstitutionCycles, Substitutions}; +use std::marker::PhantomData; pub const SUBSTITUTIONS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/substitutions", diff --git a/src/substitutions/substitutions.rs b/src/substitutions/substitutions.rs index 4a3e453..7c15efe 100644 --- a/src/substitutions/substitutions.rs +++ b/src/substitutions/substitutions.rs @@ -1,8 +1,7 @@ +use crate::{AtomType, Subject}; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -use crate::{AtomType, Subject}; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Substitutions { diff --git a/src/teaching/endpoints.rs b/src/teaching/endpoints.rs index a0f60ee..62adb5d 100644 --- a/src/teaching/endpoints.rs +++ b/src/teaching/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{Endpoint, Teaching}; +use std::marker::PhantomData; /// Subject ID = String pub const TEACHING_ENDPOINT: Endpoint = Endpoint::Get { diff --git a/src/teaching/teaching.rs b/src/teaching/teaching.rs index e182842..c65cdb8 100644 --- a/src/teaching/teaching.rs +++ b/src/teaching/teaching.rs @@ -1,8 +1,7 @@ +use crate::Subject; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -use crate::Subject; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Teaching { diff --git a/src/timetable/endpoints.rs b/src/timetable/endpoints.rs index 6c2cb44..b30de3d 100644 --- a/src/timetable/endpoints.rs +++ b/src/timetable/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{Endpoint, Timetable}; +use std::marker::PhantomData; pub const PERNAMENT_TIMETABLE_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/timetable/permanent", @@ -14,14 +13,12 @@ pub const PERNAMENT_TIMETABLE_CLASS_ENDPOINT: Endpoint = Endpoint _types: PhantomData, }; - pub const WEEK_TIMETABLE_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/timetable/actual", auth: true, _types: PhantomData, }; - pub const WEEK_TIMETABLE_CLASS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/timetable/actual/class/{classId}", auth: true, diff --git a/src/timetable/mod.rs b/src/timetable/mod.rs index 151e3d2..bb2f873 100644 --- a/src/timetable/mod.rs +++ b/src/timetable/mod.rs @@ -1,5 +1,5 @@ -mod timetable; mod endpoints; +mod timetable; +pub use endpoints::*; pub use timetable::*; -pub use endpoints::*; \ No newline at end of file diff --git a/src/timetable/timetable.rs b/src/timetable/timetable.rs index 7216cda..2f8953a 100644 --- a/src/timetable/timetable.rs +++ b/src/timetable/timetable.rs @@ -1,8 +1,7 @@ +use crate::StdType; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -use crate::{Room, StdType, Student, Teacher}; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Timetable { @@ -11,10 +10,10 @@ pub struct Timetable { pub classes: Vec, pub groups: Vec, pub subjects: Vec, - pub rooms: Vec, - pub teachers: Vec, + pub rooms: Vec, + pub teachers: Vec, pub cycles: Vec, - pub students: Vec, + pub students: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/src/user/endpoints.rs b/src/user/endpoints.rs index 9d4f301..a5fe383 100644 --- a/src/user/endpoints.rs +++ b/src/user/endpoints.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomData; - use crate::{Endpoint, UserInfo}; +use std::marker::PhantomData; pub const USER_INFO_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/user", diff --git a/src/user/user_info.rs b/src/user/user_info.rs index f2ea5d8..f9985c3 100644 --- a/src/user/user_info.rs +++ b/src/user/user_info.rs @@ -1,15 +1,14 @@ +use crate::{Module, StdType, user::ModulesSetting}; use serde::{Deserialize, Serialize}; -use crate::{Module, SchoolClass, user::ModulesSetting}; - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct UserInfo { #[serde(rename = "UserUID")] pub user_uid: String, pub campaign_category_code: String, - pub class: Option, - pub teacher_classes: Option>, + pub class: Option, + pub teacher_classes: Option>, pub full_name: Option, pub school_organization_name: Option, pub school_type: Option, @@ -35,7 +34,7 @@ pub enum UserType { #[serde(rename_all = "PascalCase")] pub struct UserInfoStudent { pub full_name: String, - pub class: SchoolClass, + pub class: StdType, pub school_type: SchoolType, pub study_year: Option, } From 7b53c2db8866351d3b114304ff38df975dd365d6 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:31:26 +0100 Subject: [PATCH 18/22] more refactoring --- src/absence/absence.rs | 107 +----------------- src/absence/absence_day.rs | 15 +++ src/absence/absence_day_response.rs | 10 ++ src/absence/absence_overview_response.rs | 10 ++ src/absence/absence_record.rs | 18 +++ src/absence/absence_type_option.rs | 13 +++ src/absence/absent_type.rs | 14 +++ src/absence/excuse_absence_response.rs | 9 ++ src/absence/mod.rs | 18 +++ .../student_timetable_absence_response.rs | 10 ++ src/absence/subject_absence.rs | 13 +++ .../{semester.rs => certificate_term.rs} | 35 +----- src/semester/final_mark.rs | 12 ++ src/semester/mod.rs | 8 +- src/semester/pedagogical_measure.rs | 21 ++++ 15 files changed, 174 insertions(+), 139 deletions(-) create mode 100644 src/absence/absence_day.rs create mode 100644 src/absence/absence_day_response.rs create mode 100644 src/absence/absence_overview_response.rs create mode 100644 src/absence/absence_record.rs create mode 100644 src/absence/absence_type_option.rs create mode 100644 src/absence/absent_type.rs create mode 100644 src/absence/excuse_absence_response.rs create mode 100644 src/absence/student_timetable_absence_response.rs create mode 100644 src/absence/subject_absence.rs rename src/semester/{semester.rs => certificate_term.rs} (50%) create mode 100644 src/semester/final_mark.rs create mode 100644 src/semester/pedagogical_measure.rs diff --git a/src/absence/absence.rs b/src/absence/absence.rs index f5ce811..5a8b2d4 100644 --- a/src/absence/absence.rs +++ b/src/absence/absence.rs @@ -1,87 +1,6 @@ -use crate::{Hour, StdType, StdTypeNullable}; -use chrono::{DateTime, FixedOffset}; +use crate::{AbsentType, StdTypeAbbrevNullable}; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AbsenceOverviewResponse { - pub percentage_threshold: f64, //TODO: cutom type (u8) - pub absences: Vec, - pub absences_per_subject: Option>, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AbsenceDay { - pub date: chrono::DateTime, - pub unsolved: u16, - pub ok: u16, - pub missed: u16, - pub late: u16, - pub soon: u16, - pub school: u16, - pub distance_teaching: u16, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SubjectAbsence { - pub subject_name: String, - pub lessons_count: u16, - pub base: u16, - pub late: u16, - pub soon: u16, - pub school: u16, - pub distance_teaching: u16, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct StudentTimetableAbsenceResponse { - pub student: Option, - pub days: Vec, - pub absent_type_options: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AbsenceTypeOption { - pub absent_type: AbsentType, - pub absent_kind_enabled: bool, - pub absent_kind_required: bool, - pub absent_note_enabled: bool, - pub next_absent_type: AbsentType, - pub absent_kinds: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub enum AbsentType { - Absent, - AbsentLate, - AbsentMiss, - AbsentOk, - AbsentSchool, - AbsentSoon, - DistanceTeaching, - NoAbsent, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AbsenceSubject { - pub id: String, - pub abbrev: Option, - pub name: String, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AbsenceDayResponse { - pub date: DateTime, - pub absences: Vec, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Absence { @@ -94,27 +13,5 @@ pub struct Absence { pub absent_kind_id: Option, pub notice: Option, pub student_id: Option, - pub subject: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct ExcuseAbsenceResponse { - pub absences: Vec, - pub hours: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct AbsenceRecord { - pub minutes: i64, - pub absent_type: AbsentType, - pub hour_id: Option, - pub date: DateTime, - pub start: i64, - pub duration: i64, - pub absent_kind_id: Option, - pub notice: Option, - pub student_id: Option, - pub apology_id: Option, + pub subject: Option, } diff --git a/src/absence/absence_day.rs b/src/absence/absence_day.rs new file mode 100644 index 0000000..b89e2d5 --- /dev/null +++ b/src/absence/absence_day.rs @@ -0,0 +1,15 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceDay { + pub date: DateTime, + pub unsolved: u16, + pub ok: u16, + pub missed: u16, + pub late: u16, + pub soon: u16, + pub school: u16, + pub distance_teaching: u16, +} diff --git a/src/absence/absence_day_response.rs b/src/absence/absence_day_response.rs new file mode 100644 index 0000000..5072264 --- /dev/null +++ b/src/absence/absence_day_response.rs @@ -0,0 +1,10 @@ +use crate::Absence; +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceDayResponse { + pub date: DateTime, + pub absences: Vec, +} diff --git a/src/absence/absence_overview_response.rs b/src/absence/absence_overview_response.rs new file mode 100644 index 0000000..56d5975 --- /dev/null +++ b/src/absence/absence_overview_response.rs @@ -0,0 +1,10 @@ +use crate::{AbsenceDay, SubjectAbsence}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceOverviewResponse { + pub percentage_threshold: f64, //TODO: cutom type (u8) + pub absences: Vec, + pub absences_per_subject: Option>, +} diff --git a/src/absence/absence_record.rs b/src/absence/absence_record.rs new file mode 100644 index 0000000..e1fdd82 --- /dev/null +++ b/src/absence/absence_record.rs @@ -0,0 +1,18 @@ +use crate::AbsentType; +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceRecord { + pub minutes: i64, + pub absent_type: AbsentType, + pub hour_id: Option, + pub date: DateTime, + pub start: i64, + pub duration: i64, + pub absent_kind_id: Option, + pub notice: Option, + pub student_id: Option, + pub apology_id: Option, +} diff --git a/src/absence/absence_type_option.rs b/src/absence/absence_type_option.rs new file mode 100644 index 0000000..9d4495e --- /dev/null +++ b/src/absence/absence_type_option.rs @@ -0,0 +1,13 @@ +use crate::{AbsentType, StdType}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AbsenceTypeOption { + pub absent_type: AbsentType, + pub absent_kind_enabled: bool, + pub absent_kind_required: bool, + pub absent_note_enabled: bool, + pub next_absent_type: AbsentType, + pub absent_kinds: Vec, +} diff --git a/src/absence/absent_type.rs b/src/absence/absent_type.rs new file mode 100644 index 0000000..3fe4bd1 --- /dev/null +++ b/src/absence/absent_type.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub enum AbsentType { + Absent, + AbsentLate, + AbsentMiss, + AbsentOk, + AbsentSchool, + AbsentSoon, + DistanceTeaching, + NoAbsent, +} diff --git a/src/absence/excuse_absence_response.rs b/src/absence/excuse_absence_response.rs new file mode 100644 index 0000000..feccfa8 --- /dev/null +++ b/src/absence/excuse_absence_response.rs @@ -0,0 +1,9 @@ +use crate::{AbsenceRecord, Hour}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ExcuseAbsenceResponse { + pub absences: Vec, + pub hours: Vec, +} diff --git a/src/absence/mod.rs b/src/absence/mod.rs index d7fb00d..6be0793 100644 --- a/src/absence/mod.rs +++ b/src/absence/mod.rs @@ -1,5 +1,23 @@ mod absence; +mod absence_day; +mod absence_day_response; +mod absence_overview_response; +mod absence_record; +mod absence_type_option; +mod absent_type; mod endpoints; +mod excuse_absence_response; +mod student_timetable_absence_response; +mod subject_absence; pub use absence::*; +pub use absence_day::*; +pub use absence_day_response::*; +pub use absence_overview_response::*; +pub use absence_record::*; +pub use absence_type_option::*; +pub use absent_type::*; pub use endpoints::*; +pub use excuse_absence_response::*; +pub use student_timetable_absence_response::*; +pub use subject_absence::*; diff --git a/src/absence/student_timetable_absence_response.rs b/src/absence/student_timetable_absence_response.rs new file mode 100644 index 0000000..d865f18 --- /dev/null +++ b/src/absence/student_timetable_absence_response.rs @@ -0,0 +1,10 @@ +use crate::{AbsenceDayResponse, AbsenceTypeOption, StdTypeNullable}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct StudentTimetableAbsenceResponse { + pub student: Option, + pub days: Vec, + pub absent_type_options: Vec, +} diff --git a/src/absence/subject_absence.rs b/src/absence/subject_absence.rs new file mode 100644 index 0000000..4f01c3d --- /dev/null +++ b/src/absence/subject_absence.rs @@ -0,0 +1,13 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct SubjectAbsence { + pub subject_name: String, + pub lessons_count: u16, + pub base: u16, + pub late: u16, + pub soon: u16, + pub school: u16, + pub distance_teaching: u16, +} diff --git a/src/semester/semester.rs b/src/semester/certificate_term.rs similarity index 50% rename from src/semester/semester.rs rename to src/semester/certificate_term.rs index d69c925..fd97fd8 100644 --- a/src/semester/semester.rs +++ b/src/semester/certificate_term.rs @@ -1,13 +1,7 @@ -use crate::StdTypeNullable; +use crate::{FinalMark, StdTypeNullable}; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct CertificateTerms { - pub certificate_terms: Vec, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct CertificateTerm { @@ -30,29 +24,6 @@ pub struct CertificateTerm { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct FinalMark { - pub mark_date: DateTime, - pub edit_date: DateTime, - pub mark_text: String, - pub subject_id: String, - pub id: String, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct PedagogicalMeasure { - pub pedagogical_measures: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct PedagogicalMeasures { - pub school_year: String, - pub semester: String, - pub type_label: String, - pub date: DateTime, - pub type_id: String, - pub text: String, - pub actual_grade: Option, - pub actual_grade_name: Option, +pub struct CertificateTerms { + pub certificate_terms: Vec, } diff --git a/src/semester/final_mark.rs b/src/semester/final_mark.rs new file mode 100644 index 0000000..8f9271b --- /dev/null +++ b/src/semester/final_mark.rs @@ -0,0 +1,12 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct FinalMark { + pub mark_date: DateTime, + pub edit_date: DateTime, + pub mark_text: String, + pub subject_id: String, + pub id: String, +} diff --git a/src/semester/mod.rs b/src/semester/mod.rs index e2b6723..8ec482c 100644 --- a/src/semester/mod.rs +++ b/src/semester/mod.rs @@ -1,5 +1,9 @@ +mod certificate_term; mod endpoints; -mod semester; +mod final_mark; +mod pedagogical_measure; +pub use certificate_term::*; pub use endpoints::*; -pub use semester::*; +pub use final_mark::*; +pub use pedagogical_measure::*; diff --git a/src/semester/pedagogical_measure.rs b/src/semester/pedagogical_measure.rs new file mode 100644 index 0000000..07f0cf0 --- /dev/null +++ b/src/semester/pedagogical_measure.rs @@ -0,0 +1,21 @@ +use chrono::{DateTime, FixedOffset}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct PedagogicalMeasure { + pub pedagogical_measures: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct PedagogicalMeasures { + pub school_year: String, + pub semester: String, + pub type_label: String, + pub date: DateTime, + pub type_id: String, + pub text: String, + pub actual_grade: Option, + pub actual_grade_name: Option, +} From b4e4b03e67a684a775910936e4fdf5fdd691bb5f Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:36:22 +0100 Subject: [PATCH 19/22] refactors --- src/homework/endpoints.rs | 4 +- src/homework/homeworks.rs | 6 +- src/payments/class_fund.rs | 112 ++++++++++++++ src/payments/common.rs | 8 + src/payments/mod.rs | 8 +- .../{payments.rs => regular_payments.rs} | 117 +-------------- src/subjects/mod.rs | 4 +- src/subjects/{subject_types.rs => subject.rs} | 12 +- src/substitutions/change_display_type.rs | 8 + src/substitutions/change_lesson_info.rs | 11 ++ src/substitutions/day_cycle_info.rs | 17 +++ src/substitutions/mod.rs | 10 ++ src/substitutions/substitution_change.rs | 17 +++ src/substitutions/substitution_change_type.rs | 13 ++ src/substitutions/substitutions.rs | 60 +------- src/teaching/mod.rs | 2 + src/teaching/teaching.rs | 31 +--- src/teaching/teaching_theme.rs | 14 ++ src/timetable/assistance_atom.rs | 18 +++ src/timetable/assistant.rs | 9 ++ src/timetable/atom.rs | 26 ++++ src/timetable/atom_type.rs | 9 ++ src/timetable/change_type.rs | 13 ++ src/timetable/day.rs | 15 ++ src/timetable/homework_info.rs | 8 + src/timetable/hour.rs | 12 ++ src/timetable/lesson_release.rs | 8 + src/timetable/mod.rs | 24 +++ src/timetable/planned_classification.rs | 7 + src/timetable/timetable.rs | 142 +----------------- src/timetable/timetable_change.rs | 20 +++ src/timetable/timetable_group.rs | 10 ++ 32 files changed, 414 insertions(+), 361 deletions(-) create mode 100644 src/payments/class_fund.rs create mode 100644 src/payments/common.rs rename src/payments/{payments.rs => regular_payments.rs} (53%) rename src/subjects/{subject_types.rs => subject.rs} (100%) create mode 100644 src/substitutions/change_display_type.rs create mode 100644 src/substitutions/change_lesson_info.rs create mode 100644 src/substitutions/day_cycle_info.rs create mode 100644 src/substitutions/substitution_change.rs create mode 100644 src/substitutions/substitution_change_type.rs create mode 100644 src/teaching/teaching_theme.rs create mode 100644 src/timetable/assistance_atom.rs create mode 100644 src/timetable/assistant.rs create mode 100644 src/timetable/atom.rs create mode 100644 src/timetable/atom_type.rs create mode 100644 src/timetable/change_type.rs create mode 100644 src/timetable/day.rs create mode 100644 src/timetable/homework_info.rs create mode 100644 src/timetable/hour.rs create mode 100644 src/timetable/lesson_release.rs create mode 100644 src/timetable/planned_classification.rs create mode 100644 src/timetable/timetable_change.rs create mode 100644 src/timetable/timetable_group.rs 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, +} From 4ff2abd485781a3cb29ddb1abd90f99d2a417033 Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:46:59 +0100 Subject: [PATCH 20/22] Fix endpoint declaration for teacher document detail Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/payments/endpoints.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/payments/endpoints.rs b/src/payments/endpoints.rs index bd1e31c..b062185 100644 --- a/src/payments/endpoints.rs +++ b/src/payments/endpoints.rs @@ -43,8 +43,8 @@ pub const REGULAR_PAYMENT_DETAIL_ENDPOINT: Endpoint = }; pub const CLASS_FUND_TEACHER_DOCUMENT_DETAIL_ENDPOINT: Endpoint< - (), ClassFundTeacherDocumentDetail, + (), > = Endpoint::Get { url: "/api/3/payments/classfund/teacher/document/detail/{documentId}", auth: true, From 1f79570c7036d76eb87a56392e4638ce2d4c1bbf Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:47:27 +0100 Subject: [PATCH 21/22] Fix endpoint declaration for CLASS_FUND_TEACHER_DOCUMENTS Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/payments/endpoints.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/payments/endpoints.rs b/src/payments/endpoints.rs index b062185..cae1609 100644 --- a/src/payments/endpoints.rs +++ b/src/payments/endpoints.rs @@ -65,8 +65,8 @@ pub const CLASS_FUND_TEACHER_STUDENTS_ENDPOINT: Endpoint, + (), > = Endpoint::Get { url: "/api/3/payments/classfund/teacher/documents/{classId}", auth: true, From 5430902782c32c9e862002b58054ae42ff366eba Mon Sep 17 00:00:00 2001 From: vextrixes <113197359+vextrixes@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:56:42 +0100 Subject: [PATCH 22/22] fixes --- src/auth/login.rs | 10 +++++----- src/marks/mark_confirmation_status.rs | 2 +- src/payments/endpoints.rs | 2 +- src/payments/regular_payments.rs | 2 +- src/semester/pedagogical_measure.rs | 4 ++-- src/substitutions/change_lesson_info.rs | 10 +++++----- src/timetable/atom.rs | 3 ++- src/timetable/endpoints.rs | 4 ++-- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/auth/login.rs b/src/auth/login.rs index 90d9b8e..6da5c95 100644 --- a/src/auth/login.rs +++ b/src/auth/login.rs @@ -15,13 +15,13 @@ pub struct LoginSuccess { pub app_version: String, } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] // TODO: evaluate removing or changing debug here #[serde(rename_all = "snake_case")] pub struct LoginRequest { - client_id: String, - grant_type: String, - username: String, - password: String, + pub client_id: String, + pub grant_type: String, + pub username: String, + pub password: String, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/src/marks/mark_confirmation_status.rs b/src/marks/mark_confirmation_status.rs index 3b08491..2a16167 100644 --- a/src/marks/mark_confirmation_status.rs +++ b/src/marks/mark_confirmation_status.rs @@ -1,4 +1,4 @@ -pub use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] diff --git a/src/payments/endpoints.rs b/src/payments/endpoints.rs index cae1609..84fe2cc 100644 --- a/src/payments/endpoints.rs +++ b/src/payments/endpoints.rs @@ -88,8 +88,8 @@ pub const REGULAR_PRESCRIPTION_DETAIL_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/payments/regularpayments/teacher/prescriptions/{prescriptionId}/students/{studentId}", auth: true, diff --git a/src/payments/regular_payments.rs b/src/payments/regular_payments.rs index 9d59165..0ccccfe 100644 --- a/src/payments/regular_payments.rs +++ b/src/payments/regular_payments.rs @@ -54,7 +54,7 @@ pub struct RegularPrescriptionDetail { pub payment_type_id: i64, pub payment_type_name: Option, pub amount: f64, - pub state: RegularPrescription, + pub state: RegularPrescriptionState, pub due_date_max: DateTime, pub bank_account: Option, pub specific_symbol: Option, diff --git a/src/semester/pedagogical_measure.rs b/src/semester/pedagogical_measure.rs index 07f0cf0..11983ab 100644 --- a/src/semester/pedagogical_measure.rs +++ b/src/semester/pedagogical_measure.rs @@ -3,13 +3,13 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct PedagogicalMeasure { +pub struct PedagogicalMeasures { pub pedagogical_measures: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct PedagogicalMeasures { +pub struct PedagogicalMeasure { pub school_year: String, pub semester: String, pub type_label: String, diff --git a/src/substitutions/change_lesson_info.rs b/src/substitutions/change_lesson_info.rs index 0880556..526a1a8 100644 --- a/src/substitutions/change_lesson_info.rs +++ b/src/substitutions/change_lesson_info.rs @@ -3,9 +3,9 @@ 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, + pub class_abbrev: Option, + pub group_abbrev: Option, + pub is_class_group: Option, + pub subject_abbrev: Option, + pub room_abbrev: Option, } diff --git a/src/timetable/atom.rs b/src/timetable/atom.rs index a0d6aaa..65641c6 100644 --- a/src/timetable/atom.rs +++ b/src/timetable/atom.rs @@ -18,7 +18,8 @@ pub struct Atom { pub theme: Option, pub assistants: Vec, pub notice: Option, - pub planned_clasification: Option, + #[serde(rename = "PlannedClasification")] + pub planned_classification: Option, pub week_theme: Option, pub lesson_release: LessonRelease, pub start: Option, diff --git a/src/timetable/endpoints.rs b/src/timetable/endpoints.rs index b30de3d..698e612 100644 --- a/src/timetable/endpoints.rs +++ b/src/timetable/endpoints.rs @@ -1,13 +1,13 @@ use crate::{Endpoint, Timetable}; use std::marker::PhantomData; -pub const PERNAMENT_TIMETABLE_ENDPOINT: Endpoint = Endpoint::Get { +pub const PERMAMENT_TIMETABLE_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/timetable/permanent", auth: true, _types: PhantomData, }; -pub const PERNAMENT_TIMETABLE_CLASS_ENDPOINT: Endpoint = Endpoint::Get { +pub const PERMAMENT_TIMETABLE_CLASS_ENDPOINT: Endpoint = Endpoint::Get { url: "/api/3/timetable/permanent/class/{classId}", auth: true, _types: PhantomData,