Update to more generic db models
Some checks failed
Build Crate / build (push) Has been cancelled

Also integrated entities into codebase
This commit is contained in:
2024-08-18 03:26:12 -04:00
parent 5d28013f30
commit 528682d9b1
24 changed files with 314 additions and 419 deletions

View 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 {}