29 lines
719 B
Rust
29 lines
719 B
Rust
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "stream_key")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
#[sea_orm(unique)]
|
|
pub key_value: String,
|
|
pub label: String,
|
|
pub is_active: bool,
|
|
pub created_at: DateTimeUtc,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::stream_session::Entity")]
|
|
StreamSession,
|
|
}
|
|
|
|
impl Related<super::stream_session::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::StreamSession.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|