koprogo_api/application/dto/
account_dto.rs1use serde::{Deserialize, Serialize};
7use validator::Validate;
8
9#[derive(Debug, Serialize, Deserialize, Validate, Clone)]
16#[serde(deny_unknown_fields)]
17pub struct CreateAccountDto {
18 #[validate(length(min = 1, max = 40, message = "Account code must be 1-40 characters"))]
19 pub code: String,
20
21 #[validate(length(min = 1, max = 255, message = "Account label must be 1-255 characters"))]
22 pub label: String,
23
24 pub parent_code: Option<String>,
25
26 pub account_type: String, pub direct_use: bool,
29
30 pub organization_id: String,
31}
32
33#[derive(Debug, Serialize, Deserialize, Validate, Clone)]
35pub struct UpdateAccountDto {
36 #[validate(length(min = 1, max = 255))]
37 pub label: Option<String>,
38
39 pub parent_code: Option<Option<String>>,
40
41 pub account_type: Option<String>, pub direct_use: Option<bool>,
44}
45
46#[derive(Debug, Serialize, Deserialize, Clone)]
48pub struct AccountResponseDto {
49 pub id: String,
50 pub code: String,
51 pub label: String,
52 pub parent_code: Option<String>,
53 pub account_type: String, pub direct_use: bool,
55 pub organization_id: String,
56 pub created_at: String,
57 pub updated_at: String,
58}
59
60#[derive(Debug, Serialize, Deserialize, Validate, Clone)]
62pub struct SeedBelgianPcmnDto {
63 pub organization_id: String,
64}
65
66#[derive(Debug, Serialize, Deserialize, Clone)]
68pub struct SeedPcmnResponseDto {
69 pub accounts_created: i64,
70 pub message: String,
71}
72
73#[derive(Debug, Deserialize, Clone)]
75pub struct AccountSearchQuery {
76 pub code_pattern: Option<String>,
77 pub account_type: Option<String>,
78 pub direct_use_only: Option<bool>,
79 pub parent_code: Option<String>,
80}