heldar_kernel/models/
scheduling.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4use sqlx::types::Json;
5use sqlx::FromRow;
6
7#[derive(Debug, Clone, Serialize, FromRow)]
9pub struct SnapshotSchedule {
10 pub id: String,
11 pub camera_id: String,
12 pub interval_seconds: i64,
13 pub enabled: bool,
14 pub last_fired_at: Option<DateTime<Utc>>,
15 pub created_at: DateTime<Utc>,
16 pub updated_at: DateTime<Utc>,
17}
18
19#[derive(Debug, Deserialize)]
20pub struct SnapshotScheduleCreate {
21 pub interval_seconds: Option<i64>,
22 pub enabled: Option<bool>,
23}
24
25#[derive(Debug, Deserialize, Default)]
26pub struct SnapshotScheduleUpdate {
27 pub interval_seconds: Option<i64>,
28 pub enabled: Option<bool>,
29}
30
31#[derive(Debug, Clone, Serialize, FromRow)]
33pub struct PersistedSnapshot {
34 pub id: String,
35 pub camera_id: String,
36 pub schedule_id: Option<String>,
37 pub path: String,
38 pub taken_at: DateTime<Utc>,
39 pub size_bytes: i64,
40 pub created_at: DateTime<Utc>,
41}
42
43#[derive(Debug, Clone, Serialize, FromRow)]
49pub struct RecordSchedule {
50 pub id: String,
51 pub camera_id: String,
52 pub days: Json<Value>,
53 pub time_start: String,
54 pub time_end: String,
55 pub enabled: bool,
56 pub created_at: DateTime<Utc>,
57 pub updated_at: DateTime<Utc>,
58}
59
60#[derive(Debug, Deserialize)]
61pub struct RecordScheduleCreate {
62 pub days: Value,
64 pub time_start: String,
66 pub time_end: String,
68 pub enabled: Option<bool>,
69}
70
71#[derive(Debug, Deserialize, Default)]
72pub struct RecordScheduleUpdate {
73 pub days: Option<Value>,
74 pub time_start: Option<String>,
75 pub time_end: Option<String>,
76 pub enabled: Option<bool>,
77}