koprogo_api/application/dto/
account_dto.rs1use serde::{Deserialize, Serialize};
7use validator::Validate;
8
9#[derive(Debug, Serialize, Deserialize, Validate, Clone)]
11pub struct CreateAccountDto {
12 #[validate(length(min = 1, max = 40, message = "Account code must be 1-40 characters"))]
13 pub code: String,
14
15 #[validate(length(min = 1, max = 255, message = "Account label must be 1-255 characters"))]
16 pub label: String,
17
18 pub parent_code: Option<String>,
19
20 pub account_type: String, pub direct_use: bool,
23
24 pub organization_id: String,
25}
26
27#[derive(Debug, Serialize, Deserialize, Validate, Clone)]
29pub struct UpdateAccountDto {
30 #[validate(length(min = 1, max = 255))]
31 pub label: Option<String>,
32
33 pub parent_code: Option<Option<String>>,
34
35 pub account_type: Option<String>, pub direct_use: Option<bool>,
38}
39
40#[derive(Debug, Serialize, Deserialize, Clone)]
42pub struct AccountResponseDto {
43 pub id: String,
44 pub code: String,
45 pub label: String,
46 pub parent_code: Option<String>,
47 pub account_type: String, pub direct_use: bool,
49 pub organization_id: String,
50 pub created_at: String,
51 pub updated_at: String,
52}
53
54#[derive(Debug, Serialize, Deserialize, Validate, Clone)]
56pub struct SeedBelgianPcmnDto {
57 pub organization_id: String,
58}
59
60#[derive(Debug, Serialize, Deserialize, Clone)]
62pub struct SeedPcmnResponseDto {
63 pub accounts_created: i64,
64 pub message: String,
65}
66
67#[derive(Debug, Deserialize, Clone)]
69pub struct AccountSearchQuery {
70 pub code_pattern: Option<String>,
71 pub account_type: Option<String>,
72 pub direct_use_only: Option<bool>,
73 pub parent_code: Option<String>,
74}