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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Contains DTO implementations for [`Users`].

use uuid::Uuid;

use crate::model::entity::Users;

use super::UsersDto;

impl From<(UsersDto, Uuid)> for Users {
    fn from((user_data, user_id): (UsersDto, Uuid)) -> Self {
        Self {
            id: user_id,
            salutation: user_data.salutation,
            title: user_data.title,
            country: user_data.country,
            phone: user_data.phone,
            website: user_data.website,
            organization: user_data.organization,
            experience: user_data.experience,
            membership: user_data.membership,
            member_years: user_data.member_years,
            member_since: user_data.member_since,
            permacoins: user_data.permacoins,
        }
    }
}

impl From<Users> for UsersDto {
    fn from(user_data: Users) -> Self {
        Self {
            salutation: user_data.salutation,
            title: user_data.title,
            country: user_data.country,
            phone: user_data.phone,
            website: user_data.website,
            organization: user_data.organization,
            experience: user_data.experience,
            membership: user_data.membership,
            member_years: user_data.member_years,
            member_since: user_data.member_since,
            permacoins: user_data.permacoins,
        }
    }
}

impl<T> From<(T, Users)> for UsersDto {
    fn from((_, user_data): (T, Users)) -> Self {
        Self::from(user_data)
    }
}