backbone_payroll/exports/
events.rs1use serde::{Deserialize, Serialize};
9use chrono::{DateTime, Utc};
10
11use super::types::*;
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct CompensationChangeCreatedEvent {
20 pub id: CompensationChangeId,
21 pub data: CompensationChangeDto,
22 pub occurred_at: DateTime<Utc>,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct CompensationChangeUpdatedEvent {
28 pub id: CompensationChangeId,
29 pub data: CompensationChangeDto,
30 pub occurred_at: DateTime<Utc>,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct CompensationChangeDeletedEvent {
36 pub id: CompensationChangeId,
37 pub occurred_at: DateTime<Utc>,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct PayrollEntryCreatedEvent {
47 pub id: PayrollEntryId,
48 pub data: PayrollEntryDto,
49 pub occurred_at: DateTime<Utc>,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54pub struct PayrollEntryUpdatedEvent {
55 pub id: PayrollEntryId,
56 pub data: PayrollEntryDto,
57 pub occurred_at: DateTime<Utc>,
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62pub struct PayrollEntryDeletedEvent {
63 pub id: PayrollEntryId,
64 pub occurred_at: DateTime<Utc>,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
73pub struct SalarySlipCreatedEvent {
74 pub id: SalarySlipId,
75 pub data: SalarySlipDto,
76 pub occurred_at: DateTime<Utc>,
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81pub struct SalarySlipUpdatedEvent {
82 pub id: SalarySlipId,
83 pub data: SalarySlipDto,
84 pub occurred_at: DateTime<Utc>,
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89pub struct SalarySlipDeletedEvent {
90 pub id: SalarySlipId,
91 pub occurred_at: DateTime<Utc>,
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
100pub struct SalarySlipLineCreatedEvent {
101 pub id: SalarySlipLineId,
102 pub data: SalarySlipLineDto,
103 pub occurred_at: DateTime<Utc>,
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108pub struct SalarySlipLineUpdatedEvent {
109 pub id: SalarySlipLineId,
110 pub data: SalarySlipLineDto,
111 pub occurred_at: DateTime<Utc>,
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116pub struct SalarySlipLineDeletedEvent {
117 pub id: SalarySlipLineId,
118 pub occurred_at: DateTime<Utc>,
119}
120
121#[derive(Debug, Clone, Serialize, Deserialize)]
127pub struct SalaryStructureCreatedEvent {
128 pub id: SalaryStructureId,
129 pub data: SalaryStructureDto,
130 pub occurred_at: DateTime<Utc>,
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135pub struct SalaryStructureUpdatedEvent {
136 pub id: SalaryStructureId,
137 pub data: SalaryStructureDto,
138 pub occurred_at: DateTime<Utc>,
139}
140
141#[derive(Debug, Clone, Serialize, Deserialize)]
143pub struct SalaryStructureDeletedEvent {
144 pub id: SalaryStructureId,
145 pub occurred_at: DateTime<Utc>,
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize)]
154pub struct SalaryComponentCreatedEvent {
155 pub id: SalaryComponentId,
156 pub data: SalaryComponentDto,
157 pub occurred_at: DateTime<Utc>,
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize)]
162pub struct SalaryComponentUpdatedEvent {
163 pub id: SalaryComponentId,
164 pub data: SalaryComponentDto,
165 pub occurred_at: DateTime<Utc>,
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize)]
170pub struct SalaryComponentDeletedEvent {
171 pub id: SalaryComponentId,
172 pub occurred_at: DateTime<Utc>,
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(tag = "type")]
182pub enum PayrollEvent {
183 CompensationChangeCreated(CompensationChangeCreatedEvent),
184 CompensationChangeUpdated(CompensationChangeUpdatedEvent),
185 CompensationChangeDeleted(CompensationChangeDeletedEvent),
186 PayrollEntryCreated(PayrollEntryCreatedEvent),
187 PayrollEntryUpdated(PayrollEntryUpdatedEvent),
188 PayrollEntryDeleted(PayrollEntryDeletedEvent),
189 SalarySlipCreated(SalarySlipCreatedEvent),
190 SalarySlipUpdated(SalarySlipUpdatedEvent),
191 SalarySlipDeleted(SalarySlipDeletedEvent),
192 SalarySlipLineCreated(SalarySlipLineCreatedEvent),
193 SalarySlipLineUpdated(SalarySlipLineUpdatedEvent),
194 SalarySlipLineDeleted(SalarySlipLineDeletedEvent),
195 SalaryStructureCreated(SalaryStructureCreatedEvent),
196 SalaryStructureUpdated(SalaryStructureUpdatedEvent),
197 SalaryStructureDeleted(SalaryStructureDeletedEvent),
198 SalaryComponentCreated(SalaryComponentCreatedEvent),
199 SalaryComponentUpdated(SalaryComponentUpdatedEvent),
200 SalaryComponentDeleted(SalaryComponentDeletedEvent),
201}
202
203#[derive(Debug, Clone, Serialize, Deserialize)]
205pub struct PayrollEventMetadata {
206 pub module: &'static str,
207 pub version: &'static str,
208}
209
210impl Default for PayrollEventMetadata {
211 fn default() -> Self {
212 Self {
213 module: "payroll",
214 version: "1.0",
215 }
216 }
217}
218
219