Skip to main content

kellnr_entity/
webhook.rs

1//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.17
2
3use sea_orm::Set;
4use sea_orm::entity::prelude::*;
5use uuid::Uuid;
6
7#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
8#[sea_orm(table_name = "webhook")]
9pub struct Model {
10    #[sea_orm(primary_key, auto_increment = false)]
11    pub id: Uuid,
12    pub event: String,
13    pub callback_url: String,
14    pub name: Option<String>,
15}
16
17#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
18pub enum Relation {
19    #[sea_orm(has_many = "super::webhook_queue::Entity")]
20    WebhookQueue,
21}
22
23impl Related<super::webhook_queue::Entity> for Entity {
24    fn to() -> RelationDef {
25        Relation::WebhookQueue.def()
26    }
27}
28
29impl ActiveModelBehavior for ActiveModel {
30    fn new() -> Self {
31        Self {
32            id: Set(Uuid::new_v4()),
33            ..ActiveModelTrait::default()
34        }
35    }
36}