Some checks failed
Build Crate / build (push) Has been cancelled
Also integrated entities into codebase
48 lines
1.2 KiB
Rust
48 lines
1.2 KiB
Rust
//! `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 {}
|