1use chrono::NaiveDateTime;
2use serde::{Deserialize, Serialize};
3use uuid::Uuid;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Webhook {
7 pub id: Uuid,
8 pub url: String,
9 pub secret: String,
10 pub events: serde_json::Value,
11 pub active: bool,
12 pub created_at: NaiveDateTime,
13 pub updated_at: NaiveDateTime,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct NewWebhook {
18 pub id: Uuid,
19 pub url: String,
20 pub secret: String,
21 pub events: serde_json::Value,
22 pub active: bool,
23 pub created_at: NaiveDateTime,
24 pub updated_at: NaiveDateTime,
25}
26
27#[derive(Debug, Clone, Default, Serialize, Deserialize)]
28pub struct UpdateWebhook {
29 pub url: Option<String>,
30 pub secret: Option<String>,
31 pub events: Option<serde_json::Value>,
32 pub active: Option<bool>,
33 pub updated_at: Option<NaiveDateTime>,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct WebhookDelivery {
38 pub id: Uuid,
39 pub webhook_id: Uuid,
40 pub event_type: String,
41 pub payload: serde_json::Value,
42 pub status_code: Option<i16>,
43 pub response_body: Option<String>,
44 pub success: bool,
45 pub attempt: i32,
46 pub created_at: NaiveDateTime,
47}
48
49#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct NewWebhookDelivery {
51 pub id: Uuid,
52 pub webhook_id: Uuid,
53 pub event_type: String,
54 pub payload: serde_json::Value,
55 pub status_code: Option<i16>,
56 pub response_body: Option<String>,
57 pub success: bool,
58 pub attempt: i32,
59 pub created_at: NaiveDateTime,
60}