b453d5d
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,
utoipa::ToSchema,
)]
#[serde(rename_all = "snake_case")]
#[sea_orm(rs_type = "String", db_type = "String(StringLen::N(32))")]
pub enum SpaceJoinTrigger {
#[default]
#[sea_orm(string_value = "issue_reaction")]
IssueReaction,
#[sea_orm(string_value = "issue_comment_reaction")]
IssueCommentReaction,
}
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "space_join_rule")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(unique_key = "space_group_trigger_matcher")]
pub space_id: Uuid,
#[sea_orm(unique_key = "space_group_trigger_matcher")]
pub group_id: Uuid,
#[sea_orm(unique_key = "space_group_trigger_matcher")]
pub trigger: SpaceJoinTrigger,
#[sea_orm(unique_key = "space_group_trigger_matcher")]
pub matcher: String,
#[sea_orm(default_value = "true")]
pub enabled: bool,
pub created_at: OffsetDateTime,
pub updated_at: Option<OffsetDateTime>,
#[sea_orm(belongs_to, from = "space_id", to = "id")]
pub space: BelongsTo<super::spaces::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}