-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathwork_schedules.rs
38 lines (34 loc) · 985 Bytes
/
work_schedules.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use chrono::NaiveDateTime;
use editoast_derive::ModelV2;
use editoast_schemas::infra::TrackRange;
use strum::FromRepr;
use serde::Deserialize;
use serde::Serialize;
use utoipa::ToSchema;
#[derive(Debug, Clone, ModelV2)]
#[model(table = crate::tables::work_schedule_group)]
pub struct WorkScheduleGroup {
pub id: i64,
pub creation_date: NaiveDateTime,
pub name: String,
}
#[derive(Debug, Default, Clone, Copy, Serialize, Deserialize, FromRepr, ToSchema, PartialEq)]
#[serde(rename_all = "UPPERCASE")]
pub enum WorkScheduleType {
#[default]
Catenary,
Track,
}
#[derive(Debug, Default, Clone, ModelV2)]
#[model(table = crate::tables::work_schedule)]
pub struct WorkSchedule {
pub id: i64,
pub start_date_time: NaiveDateTime,
pub end_date_time: NaiveDateTime,
#[model(json)]
pub track_ranges: Vec<TrackRange>,
pub obj_id: String,
#[model(to_enum)]
pub work_schedule_type: WorkScheduleType,
pub work_schedule_group_id: i64,
}