Buchung funktioniert email anfänglich

This commit is contained in:
2023-01-29 22:56:33 +01:00
parent 0cd75a9ff5
commit c708a4b79b
21 changed files with 728 additions and 38 deletions
+73
View File
@@ -0,0 +1,73 @@
use std::collections::HashMap;
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
pub type IdType = i64;
#[derive(Debug, Deserialize, Serialize)]
pub struct Teacher {
pub id: IdType,
pub ansprache: String,
pub last_name: String,
pub subject_id: IdType,
}
pub type Teachers = Vec<Teacher>;
#[derive(Debug, Deserialize, Serialize)]
pub struct Subject {
pub id: IdType,
pub name: String,
}
pub type Subjects = Vec<Subject>;
#[derive(Debug, Deserialize, Serialize)]
pub struct Appointment {
pub id: IdType,
pub teacher_id: IdType,
pub slot_id: IdType,
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct PlannedAppointment {
pub teacher_id: IdType,
pub slot_id: IdType,
}
pub type AppointmentSlots = HashMap<IdType, AppointmentSlot>;
#[derive(Debug, Deserialize, Serialize)]
pub struct AppointmentSlot {
pub id: IdType,
pub start_time: NaiveDateTime,
pub end_time: NaiveDateTime,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct OccupiedSlot {
pub id: IdType,
pub teacher_id: IdType,
pub slot_id: IdType,
}
#[derive(Debug, Deserialize, Serialize, Hash, Clone, Copy, Eq, PartialEq)]
pub struct SlotId {
pub teacher_id: IdType,
pub slot_id: IdType,
}
impl SlotId {
pub fn new(teacher: IdType, slot: IdType) -> Self {
Self {
teacher_id: teacher,
slot_id: slot,
}
}
}
#[derive(Debug, Deserialize, Serialize)]
pub enum RequestState {
Success,
Message(String),
Error,
}