backend/model/dto/
layers.rs1use serde::Deserialize;
2use serde::Serialize;
3use typeshare::typeshare;
4use utoipa::IntoParams;
5use utoipa::ToSchema;
6use uuid::Uuid;
7
8use crate::model::r#enum::layer_type::LayerType;
9
10#[typeshare]
12#[derive(Serialize, Deserialize, ToSchema, Debug, Clone)]
13pub struct LayerDto {
14 pub id: Uuid,
16 pub type_: LayerType,
18 pub map_id: i32,
20 pub name: String,
22 pub is_alternative: bool,
24 pub order_index: i32,
26 pub marked_deleted: bool,
28}
29
30#[typeshare]
35#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
36#[serde(tag = "type", content = "content")]
37pub enum UpdateLayerDto {
38 Rename(LayerRenameDto),
40 Reorder(Vec<Uuid>),
42 RestoreDrawingLayer(RestoreDrawingLayerDto),
44}
45
46#[typeshare]
48#[derive(Debug, Deserialize, IntoParams)]
49pub struct LayerSearchParameters {
50 pub map_id: Option<i32>,
52 pub type_: Option<LayerType>,
54 pub is_alternative: Option<bool>,
56 pub only_non_deleted: Option<()>,
58}
59
60#[typeshare]
62#[derive(Debug, Clone, Serialize, Deserialize, IntoParams)]
63pub struct LayerRenameDto {
64 pub id: Uuid,
66 pub name: String,
68}
69
70#[typeshare]
72#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
73#[serde(rename_all = "camelCase")]
74pub struct DeleteLayerDto {
75 pub id: Uuid,
77}
78
79#[typeshare]
81#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
82#[serde(rename_all = "camelCase")]
83pub struct RestoreDrawingLayerDto {
84 pub id: Uuid,
86}