backend/model/dto/
new_map_impl.rs

1//! Contains the implementation of [`NewMapDto`].
2
3use uuid::Uuid;
4
5use crate::model::entity::NewMap;
6
7use super::NewMapDto;
8
9impl From<(NewMapDto, Uuid)> for NewMap {
10    fn from((new_map, user_id): (NewMapDto, Uuid)) -> Self {
11        Self {
12            name: new_map.name,
13            deletion_date: new_map.deletion_date,
14            last_visit: new_map.last_visit,
15            is_inactive: new_map.is_inactive,
16            zoom_factor: new_map.zoom_factor,
17            honors: new_map.honors,
18            visits: new_map.visits,
19            harvested: new_map.harvested,
20            privacy: new_map.privacy,
21            description: new_map.description,
22            location: new_map.location.map(From::from),
23            created_by: user_id,
24            modified_by: user_id,
25            geometry: new_map.geometry,
26        }
27    }
28}