workspace reshape
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "stream_session")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub stream_key_id: i32,
|
||||
pub started_at: DateTimeUtc,
|
||||
pub ended_at: Option<DateTimeUtc>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::stream_key::Entity",
|
||||
from = "Column::StreamKeyId",
|
||||
to = "super::stream_key::Column::Id"
|
||||
)]
|
||||
StreamKey,
|
||||
}
|
||||
|
||||
impl Related<super::stream_key::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::StreamKey.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Reference in New Issue
Block a user