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

use uuid::Uuid;

use crate::model::entity::GainedBlossoms;

use super::GainedBlossomsDto;

impl From<(GainedBlossomsDto, Uuid)> for GainedBlossoms {
    fn from((gained_blossom, user_id): (GainedBlossomsDto, Uuid)) -> Self {
        Self {
            user_id,
            blossom: gained_blossom.blossom,
            times_gained: gained_blossom.times_gained,
            gained_date: gained_blossom.gained_date,
        }
    }
}

impl From<GainedBlossoms> for GainedBlossomsDto {
    fn from(gained_blossom: GainedBlossoms) -> Self {
        Self {
            blossom: gained_blossom.blossom,
            times_gained: gained_blossom.times_gained,
            gained_date: gained_blossom.gained_date,
        }
    }
}