This commit is contained in:
pavel 2026-02-13 17:45:29 +01:00
commit c7a592933e
32 changed files with 7871 additions and 0 deletions

32
src/entity/channels.rs Normal file
View file

@ -0,0 +1,32 @@
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "channels")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: Uuid,
pub guild_id: Uuid,
pub name: String,
pub kind: String,
pub created_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::guilds::Entity",
from = "Column::GuildId",
to = "super::guilds::Column::Id"
)]
Guilds,
#[sea_orm(has_many = "super::messages::Entity")]
Messages,
}
impl Related<super::guilds::Entity> for Entity {
fn to() -> RelationDef {
Relation::Guilds.def()
}
}
impl ActiveModelBehavior for ActiveModel {}