use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "webhook_queue")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub webhook_fk: Uuid,
pub payload: Json,
pub last_attempt: Option<DateTimeWithTimeZone>,
pub next_attempt: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::webhook::Entity",
from = "Column::WebhookFk",
to = "super::webhook::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Webhook,
}
impl Related<super::webhook::Entity> for Entity {
fn to() -> RelationDef {
Relation::Webhook.def()
}
}
impl ActiveModelBehavior for ActiveModel {}