|
| 1 | +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19 |
| 2 | +
|
| 3 | +use sea_orm::entity::prelude::*; |
| 4 | +use serde::{Deserialize, Serialize}; |
| 5 | + |
| 6 | +use super::sea_orm_active_enums::{BotStatusEnum, PermissionScopeEnum}; |
| 7 | + |
| 8 | +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] |
| 9 | +#[sea_orm(table_name = "bots")] |
| 10 | +pub struct Model { |
| 11 | + #[sea_orm(primary_key, auto_increment = false)] |
| 12 | + pub id: i64, |
| 13 | + pub name: String, |
| 14 | + pub organization_id: Option<i64>, |
| 15 | + pub creator_user_id: i64, |
| 16 | + pub permission_scope: PermissionScopeEnum, |
| 17 | + pub status: BotStatusEnum, |
| 18 | + pub created_at: DateTimeWithTimeZone, |
| 19 | + pub updated_at: DateTimeWithTimeZone, |
| 20 | +} |
| 21 | + |
| 22 | +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] |
| 23 | +pub enum Relation { |
| 24 | + #[sea_orm(has_many = "super::bot_installations::Entity")] |
| 25 | + BotInstallations, |
| 26 | + #[sea_orm(has_many = "super::bot_keys::Entity")] |
| 27 | + BotKeys, |
| 28 | + #[sea_orm(has_many = "super::bot_tokens::Entity")] |
| 29 | + BotTokens, |
| 30 | +} |
| 31 | + |
| 32 | +impl Related<super::bot_installations::Entity> for Entity { |
| 33 | + fn to() -> RelationDef { |
| 34 | + Relation::BotInstallations.def() |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +impl Related<super::bot_keys::Entity> for Entity { |
| 39 | + fn to() -> RelationDef { |
| 40 | + Relation::BotKeys.def() |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +impl Related<super::bot_tokens::Entity> for Entity { |
| 45 | + fn to() -> RelationDef { |
| 46 | + Relation::BotTokens.def() |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +impl ActiveModelBehavior for ActiveModel {} |
0 commit comments