Also integrated entities into codebase
This commit is contained in:
47
src/entity/game_to_team_result.rs
Normal file
47
src/entity/game_to_team_result.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "game_to_team_result")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub game_id: i32,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub team_result_id: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::game::Entity",
|
||||
from = "Column::GameId",
|
||||
to = "super::game::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Game,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::team_result::Entity",
|
||||
from = "Column::TeamResultId",
|
||||
to = "super::team_result::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
TeamResult,
|
||||
}
|
||||
|
||||
impl Related<super::game::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Game.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::team_result::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::TeamResult.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Reference in New Issue
Block a user