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            privacy: new_map.privacy,
18            description: new_map.description,
19            location: new_map.location.map(From::from),
20            created_by: user_id,
21            modified_by: user_id,
22            geometry: new_map.geometry,
23        }
24    }
25}