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 WebhookStatus { #[default] Active = 0, Disabled = 1, } #[sea_orm::model] #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "webhook")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub url: String, pub secret: String, pub status: WebhookStatus, pub space_id: Option, pub created_by: Uuid, pub created_at: OffsetDateTime, pub updated_at: Option, #[sea_orm(belongs_to, from = "created_by", to = "uid")] pub creator: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}