backend/model/entity/
drawings.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
39
40
41
use chrono::NaiveDate;
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use serde_json;
use uuid::Uuid;

use crate::model::r#enum::drawing_shape_type::DrawingShapeType;
use crate::schema::drawings;

#[derive(Debug, Clone, Identifiable, Queryable, Insertable)]
#[diesel(table_name = drawings)]
pub struct Drawing {
    pub id: Uuid,
    pub shape_type: DrawingShapeType,
    pub add_date: Option<NaiveDate>,
    pub remove_date: Option<NaiveDate>,
    pub rotation: f32,
    pub scale_x: f32,
    pub scale_y: f32,
    pub x: i32,
    pub y: i32,
    pub properties: serde_json::Value,
    pub layer_id: Uuid,
    pub notes: String,
}

#[derive(Debug, Clone, Default, AsChangeset)]
#[diesel(table_name = drawings)]
pub struct UpdateDrawing {
    pub id: Uuid,
    pub shape_type: Option<DrawingShapeType>,
    pub add_date: Option<Option<NaiveDate>>,
    pub remove_date: Option<Option<NaiveDate>>,
    pub rotation: Option<f32>,
    pub scale_x: Option<f32>,
    pub scale_y: Option<f32>,
    pub x: Option<i32>,
    pub y: Option<i32>,
    pub properties: Option<serde_json::Value>,
    pub layer_id: Option<Uuid>,
    pub notes: Option<String>,
}