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
42
43
44
//! Contains the implementations related to [`BaseLayerImageDto`].

use uuid::Uuid;

use crate::model::entity::BaseLayerImages;

use super::{BaseLayerImageDto, UpdateBaseLayerImageDto};

impl From<BaseLayerImages> for BaseLayerImageDto {
    fn from(entity: BaseLayerImages) -> Self {
        Self {
            id: entity.id,
            layer_id: entity.layer_id,
            path: entity.path,
            rotation: entity.rotation,
            scale: entity.scale,
            action_id: Uuid::nil(),
        }
    }
}

impl From<(Uuid, UpdateBaseLayerImageDto)> for BaseLayerImages {
    fn from((id, dto): (Uuid, UpdateBaseLayerImageDto)) -> Self {
        Self {
            id,
            layer_id: dto.layer_id,
            path: dto.path,
            rotation: dto.rotation,
            scale: dto.scale,
        }
    }
}

impl From<BaseLayerImageDto> for BaseLayerImages {
    fn from(dto: BaseLayerImageDto) -> Self {
        Self {
            id: dto.id,
            layer_id: dto.layer_id,
            path: dto.path,
            rotation: dto.rotation,
            scale: dto.scale,
        }
    }
}