backend/model/dto/
map_impl.rs

1//! Contains the implementation of [`MapDto`].
2
3use crate::model::entity::Map;
4
5use super::MapDto;
6
7impl From<Map> for MapDto {
8    fn from(map: Map) -> Self {
9        Self {
10            id: map.id,
11            name: map.name,
12            created_at: map.created_at,
13            modified_at: map.modified_at,
14            created_by: map.created_by,
15            modified_by: map.modified_by,
16            deletion_date: map.deletion_date,
17            last_visit: map.last_visit,
18            is_inactive: map.is_inactive,
19            zoom_factor: map.zoom_factor,
20            honors: map.honors,
21            visits: map.visits,
22            harvested: map.harvested,
23            privacy: map.privacy,
24            description: map.description,
25            location: map.location.map(From::from),
26            geometry: map.geometry,
27        }
28    }
29}
30
31impl<T> From<(T, Map)> for MapDto {
32    fn from((_, map): (T, Map)) -> Self {
33        Self::from(map)
34    }
35}