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 order_index: i32,
24 pub marked_deleted: bool,
26}
27
28#[typeshare]
33#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
34#[serde(tag = "type", content = "content")]
35pub enum UpdateLayerDto {
36 Rename(LayerRenameDto),
38 Reorder(Vec<Uuid>),
40 RestoreDrawingLayer(RestoreDrawingLayerDto),
42}
43
44#[typeshare]
46#[derive(Debug, Deserialize, IntoParams)]
47pub struct LayerSearchParameters {
48 pub map_id: Option<i32>,
50 pub type_: Option<LayerType>,
52 pub is_alternative: Option<bool>,
54 pub only_non_deleted: Option<()>,
56}
57
58#[typeshare]
60#[derive(Debug, Clone, Serialize, Deserialize, IntoParams)]
61pub struct LayerRenameDto {
62 pub id: Uuid,
64 pub name: String,
66}
67
68#[typeshare]
70#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
71#[serde(rename_all = "camelCase")]
72pub struct DeleteLayerDto {
73 pub id: Uuid,
75}
76
77#[typeshare]
79#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
80#[serde(rename_all = "camelCase")]
81pub struct RestoreDrawingLayerDto {
82 pub id: Uuid,
84}