This commit is contained in:
parent
be1451ce45
commit
33da605c03
13 changed files with 534 additions and 9 deletions
|
|
@ -4,4 +4,5 @@ pub mod guild_members;
|
|||
pub mod guilds;
|
||||
pub mod invites;
|
||||
pub mod messages;
|
||||
pub mod soundboard_sounds;
|
||||
pub mod users;
|
||||
|
|
|
|||
49
src/entity/soundboard_sounds.rs
Normal file
49
src/entity/soundboard_sounds.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "soundboard_sounds")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub guild_id: Uuid,
|
||||
pub name: String,
|
||||
pub icon: String,
|
||||
pub file_path: String,
|
||||
pub created_by_user_id: Uuid,
|
||||
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",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Guilds,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::users::Entity",
|
||||
from = "Column::CreatedByUserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
||||
impl Related<super::guilds::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Guilds.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::users::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Users.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue