added homework and atachments

This commit is contained in:
vextrixes committed 2026-10-24 19:57:28 +02:00
1 parent f8db5881a6
commit bf57b813b1
6 files changed
+73 -29

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Attachment {
id: String,
name: String,
r#type: String,
size: u64,
}
+9 -10
View File
@@ -3,23 +3,22 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Error {
message: String,
model_state: ModelState,
pub message: String,
pub model_state: ModelState,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct ModelState {
pub struct ModelState {
#[serde(rename = "$type")]
type_name: String,
pub type_name: String,
#[serde(rename = "from")]
from: StringArray,
pub from: StringArray,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct StringArray {
pub struct StringArray {
#[serde(rename = "$type")]
type_name: String,
pub type_name: String,
#[serde(rename = "$values")]
values: Vec<String>,
}
pub values: Vec<String>,
}
+16 -16
View File
@@ -1,36 +1,36 @@
use crate::StdType;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::StdType;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Events {
events: Vec<Event>,
pub events: Vec<Event>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Event {
id: String,
title: String,
description: String,
times: Vec<Time>,
event_type: StdType,
classes: Vec<StdType>,
pub id: String,
pub title: String,
pub description: String,
pub times: Vec<Time>,
pub event_type: StdType,
pub classes: Vec<StdType>,
//class_sets: unknown
teachers: Vec<StdType>,
pub teachers: Vec<StdType>,
//teacher_sets: unknown
rooms: Vec<StdType>,
pub rooms: Vec<StdType>,
//room_sets: unknown
students: Vec<StdType>,
note: Option<String>,
date_changed: DateTime<Utc>
pub students: Vec<StdType>,
pub note: Option<String>,
pub date_changed: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Time {
whole_day: bool,
start_time: DateTime<Utc>,
end_time: DateTime<Utc>,
pub whole_day: bool,
pub start_time: DateTime<Utc>,
pub end_time: DateTime<Utc>,
}
+31
View File
@@ -0,0 +1,31 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::{Attachment, StdType};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Homework {
pub homeworks: Vec<HomeworkListItem>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct HomeworkListItem {
#[serde(rename = "ID")]
pub id: String,
pub date_start: DateTime<Utc>,
pub date_end: DateTime<Utc>,
pub content: String,
pub notice: String,
pub done: bool,
pub closed: bool,
pub electronic: bool,
pub hour: u8,
pub class: StdType,
pub group: StdType,
pub subject: StdType,
pub teacher: StdType,
pub attachments: Vec<Attachment>,
pub finished: bool,
}
+4
View File
@@ -1,11 +1,15 @@
mod absence;
mod api_info;
mod attachment;
mod error;
mod events;
mod homework;
mod stdtype;
pub use absence::{Absence, AbsenceListItem, SubjectAbsence};
pub use api_info::ApiInfo;
pub use attachment::Attachment;
pub use error::Error;
pub use events::Events;
pub use homework::{Homework, HomeworkListItem};
pub use stdtype::StdType;
+3 -3
View File
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct StdType {
id: String,
abbrev: String,
name: String,
pub id: String,
pub abbrev: String,
pub name: String,
}