backend/model/entity/
drawings.rs

1use chrono::{NaiveDate, NaiveDateTime};
2use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
3use serde_json;
4use uuid::Uuid;
5
6use crate::model::r#enum::drawing_shape_type::DrawingShapeType;
7use crate::schema::drawings;
8
9#[derive(Debug, Clone, Identifiable, Queryable, Insertable)]
10#[diesel(table_name = drawings)]
11pub struct Drawing {
12    pub id: Uuid,
13    pub shape_type: DrawingShapeType,
14    pub add_date: Option<NaiveDate>,
15    pub remove_date: Option<NaiveDate>,
16    pub rotation: f32,
17    pub scale_x: f32,
18    pub scale_y: f32,
19    pub x: i32,
20    pub y: i32,
21    pub properties: serde_json::Value,
22    pub layer_id: Uuid,
23    pub notes: String,
24    pub created_at: NaiveDateTime,
25    pub modified_at: NaiveDateTime,
26    pub created_by: Uuid,
27    pub modified_by: Uuid,
28}
29
30#[derive(Debug, Clone, Default, AsChangeset)]
31#[diesel(table_name = drawings)]
32pub struct UpdateDrawing {
33    pub id: Uuid,
34    pub shape_type: Option<DrawingShapeType>,
35    pub add_date: Option<Option<NaiveDate>>,
36    pub remove_date: Option<Option<NaiveDate>>,
37    pub rotation: Option<f32>,
38    pub scale_x: Option<f32>,
39    pub scale_y: Option<f32>,
40    pub x: Option<i32>,
41    pub y: Option<i32>,
42    pub properties: Option<serde_json::Value>,
43    pub layer_id: Option<Uuid>,
44    pub notes: Option<String>,
45    pub modified_by: Option<Uuid>,
46}