-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7f389c
commit f6667c4
Showing
51 changed files
with
1,890 additions
and
1,347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use async_trait::async_trait; | ||
use sea_orm::entity::prelude::*; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{game, team}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)] | ||
#[sea_orm(table_name = "game_teams")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub game_id: i64, | ||
#[sea_orm(primary_key)] | ||
pub team_id: i64, | ||
#[sea_orm(default_value = false)] | ||
pub is_allowed: bool, | ||
|
||
#[sea_orm(default_value = 0)] | ||
pub pts: i64, | ||
#[sea_orm(default_value = 0)] | ||
pub rank: i64, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter)] | ||
pub enum Relation { | ||
Game, | ||
Team, | ||
} | ||
|
||
impl RelationTrait for Relation { | ||
fn def(&self) -> RelationDef { | ||
match self { | ||
Self::Game => Entity::belongs_to(game::Entity) | ||
.from(Column::GameId) | ||
.to(game::Column::Id) | ||
.on_delete(ForeignKeyAction::Cascade) | ||
.into(), | ||
Self::Team => Entity::belongs_to(team::Entity) | ||
.from(Column::TeamId) | ||
.to(team::Column::Id) | ||
.on_delete(ForeignKeyAction::Cascade) | ||
.into(), | ||
} | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl ActiveModelBehavior for ActiveModel {} |
File renamed without changes.
Oops, something went wrong.