koprogo_api/application/dto/
owner_dto.rs

1use serde::{Deserialize, Serialize};
2use validator::Validate;
3
4#[derive(Debug, Deserialize, Validate, Clone)]
5pub struct CreateOwnerDto {
6    #[serde(default)]
7    pub organization_id: String,
8
9    #[validate(length(min = 1))]
10    pub first_name: String,
11
12    #[validate(length(min = 1))]
13    pub last_name: String,
14
15    #[validate(email)]
16    pub email: String,
17
18    pub phone: Option<String>,
19
20    #[validate(length(min = 1))]
21    pub address: String,
22
23    #[validate(length(min = 1))]
24    pub city: String,
25
26    #[validate(length(min = 1))]
27    pub postal_code: String,
28
29    #[validate(length(min = 1))]
30    pub country: String,
31
32    pub user_id: Option<String>, // Optional link to user account (for portal access)
33}
34
35#[derive(Debug, Serialize)]
36pub struct OwnerResponseDto {
37    pub id: String,
38    pub organization_id: String,
39    pub user_id: Option<String>, // Link to User account
40    pub first_name: String,
41    pub last_name: String,
42    pub email: String,
43    pub phone: Option<String>,
44    pub address: String,
45    pub city: String,
46    pub postal_code: String,
47    pub country: String,
48}