Skip to content
Clone
a06673b
34 lines 976 B Rust
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use uuid::Uuid;
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize,
)]
#[sea_orm(rs_type = "i32", db_type = "SmallInteger")]
pub enum WebhookDeliveryStatus {
#[default]
Pending = 0,
Success = 1,
Failed = 2,
}
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "webhook_delivery")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub webhook_id: Uuid,
pub event_type: String,
pub payload: String,
pub status: WebhookDeliveryStatus,
pub response_status: Option<i32>,
pub response_body: Option<String>,
pub created_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "webhook_id", to = "id")]
pub webhook: BelongsTo<super::webhooks::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}