backend/model/dto/
map_impl.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
//! Contains the implementation of [`MapDto`].

use crate::model::entity::Map;

use super::MapDto;

impl From<Map> for MapDto {
    fn from(map: Map) -> Self {
        Self {
            id: map.id,
            name: map.name,
            created_at: map.created_at,
            modified_at: map.modified_at,
            created_by: map.created_by,
            modified_by: map.modified_by,
            deletion_date: map.deletion_date,
            last_visit: map.last_visit,
            is_inactive: map.is_inactive,
            zoom_factor: map.zoom_factor,
            honors: map.honors,
            visits: map.visits,
            harvested: map.harvested,
            privacy: map.privacy,
            description: map.description,
            location: map.location.map(From::from),
            geometry: map.geometry,
        }
    }
}

impl<T> From<(T, Map)> for MapDto {
    fn from((_, map): (T, Map)) -> Self {
        Self::from(map)
    }
}