Skip to content

Commit

Permalink
Merge branch 'jak103:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerwheeler authored Jun 20, 2024
2 parents df84fe8 + e5e953f commit 3b6039b
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 68 deletions.
5 changes: 3 additions & 2 deletions app/src/models/AuditLog.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { DbModel } from './DbModel'
import { AuditLogId } from './ids'
import type { User } from './index'

/**
* @unused We could use this if we need an admin frontend.
*/
export interface AuditLog extends DbModel {
export interface AuditLog {
user: User
action: string
table: string
id: AuditLogId
}

export type { AuditLogId } from './ids'
32 changes: 16 additions & 16 deletions app/src/models/Game.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RosterId, SeasonId, TeamRecordId, UserId, VenueId } from './ids'
import type { DbModel, Roster, TeamRecord, User, Venue } from './index'
import { RosterId, SeasonId, TeamId, UserId, VenueId } from './ids'
import type { DbModel, Roster, Team, User, Venue } from './index'
import { TimeString } from './types/timeString'


Expand All @@ -17,28 +17,28 @@ export interface Game extends DbModel {
status: GameStatus

// TODO: This might change to home: { ... } and away: { ... }
home_team_record: TeamRecord
home_team_record_id: TeamRecordId
home_team_roster: Roster
home_team_roster_id: RosterId
home_team: Team
home_team_id: TeamId
home_team_roster?: Roster
home_team_roster_id?: RosterId
home_team_locker_room: string
home_team_shots_on_goal: number
home_team_score: number

away_team_record: TeamRecord
away_team_record_id: TeamRecordId
away_team_roster: Roster
away_team_roster_id: RosterId
away_team: Team
away_team_id: TeamId
away_team_roster?: Roster
away_team_roster_id?: RosterId
away_team_locker_room: string
away_team_shots_on_goal: number
away_team_score: number

score_keeper: User
score_keeper_id: UserId
primary_referee: User
primary_referee_id: UserId
secondary_referee: User
secondary_referee_id: UserId
score_keeper?: User
score_keeper_id?: UserId
primary_referee?: User
primary_referee_id?: UserId
secondary_referee?: User
secondary_referee_id?: UserId
}

export type { GameId } from './ids'
12 changes: 6 additions & 6 deletions app/src/models/Goals.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { DbModel, Game, TeamRecord } from './index'
import type { UserId, GameId, TeamRecordId } from './ids'
import type { DbModel, Game, Team } from './index'
import type { UserId, GameId, TeamId } from './ids'

export interface Goals extends DbModel {
user_id: UserId
game_id: GameId
game: Game
team_record_id: TeamRecordId
team_record: TeamRecord
team_id: TeamId
team: Team
duration: number
period: number
assist1_id: UserId
assist2_id: UserId
player_differential: number
is_penalty_shot: boolean
playerdifferential: number
ispenaltyshot: boolean
}
11 changes: 11 additions & 0 deletions app/src/models/League.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { DbModel, Team } from './index'
import type { LeagueGuid, SeasonId } from './ids'

export interface League extends DbModel {
correlation_id: LeagueGuid
season_id: SeasonId
name: string
teams: Array<Team>
}

export type { LeagueId, LeagueGuid } from './ids'
11 changes: 0 additions & 11 deletions app/src/models/LeagueRecord.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/src/models/Logo.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export type Logo = HTMLImageElement
export type { LogoId } from './ids'
7 changes: 4 additions & 3 deletions app/src/models/Penalty.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GameId, PenaltyTypeId, TeamRecordId, UserId } from './ids'
import type { GameId, PenaltyTypeId, TeamId, UserId } from './ids'
import type { DbModel, User } from './index'

export interface PenaltyType extends DbModel {
Expand All @@ -11,10 +11,11 @@ export interface PenaltyType extends DbModel {

export interface Penalty extends DbModel {
player_id: UserId
team_id: TeamRecordId
team_id: TeamId
game_id: GameId
period: number
game_time: number
/** Penalty.duration === game time */
duration: number
created_by: UserId
penalty_type: PenaltyType
penalty_type_id: PenaltyTypeId
Expand Down
2 changes: 1 addition & 1 deletion app/src/models/Roster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { DbModel, User } from './index'
import type { UserId } from './ids'

export interface Roster extends DbModel {
players: Array<User>
players?: Array<User>
captain: User
captain_id: UserId
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/models/Season.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { TimeString } from './types/timeString'
import type { DbModel, Registration, Game, LeagueRecord } from './index'
import type { DbModel, Registration, Game, League } from './index'

export interface Season extends DbModel {
name: string
start: TimeString
end: TimeString
registrations: Array<Registration>
schedule: Array<Game>
leagues: Array<LeagueRecord>
leagues: Array<League>
}

export type { SeasonId } from './ids'
4 changes: 2 additions & 2 deletions app/src/models/ShotOnGoal.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DbModel } from './index'
import type { GameId, TeamRecordId, UserId } from './ids'
import type { GameId, TeamId, UserId } from './ids'

export interface ShotOnGoal extends DbModel {
game_id: GameId
team_id: TeamRecordId
team_id: TeamId
shot_time: number
scorekeeper: UserId
}
17 changes: 17 additions & 0 deletions app/src/models/Team.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { DbModel, League, Roster } from './index'
import type { LeagueId, LogoId, RosterId, TeamGuid } from './ids'

export interface Team extends DbModel {
correlation_id: TeamGuid
name: string
logo_id: LogoId
color: string
league_id: LeagueId
league: League
roster?: Roster
roster_id?: RosterId
wins: number
losses: number
}

export type { TeamId, TeamGuid } from './ids'
17 changes: 0 additions & 17 deletions app/src/models/TeamRecord.ts

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/models/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DbModel, TeamRecord } from './index'
import type { DbModel, Team } from './index'
import type { Role } from './KeyRecord'
import type { TimeString } from './types/timeString'

Expand All @@ -9,7 +9,7 @@ export interface User extends DbModel {
phone: string
roles: Array<Role>
skill_level: number
current_teams: Array<TeamRecord>
current_teams: Array<Team>
/** dob === Date of Birth */
dob: TimeString
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/models/ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type PenaltyTypeId = Branded<unknown, 'penalty_type_id'>
export type RegistrationId = Branded<unknown, 'registration_id'>
export type LogoId = Branded<unknown, 'logo_id'>
export type AuditLogId = Branded<unknown, 'audit_log_id'>
export type LeagueRecordId = Branded<unknown, 'league_record_id'>
export type TeamRecordId = Branded<unknown, 'team_record_id'>
export type LeagueId = Branded<unknown, 'league_id'>
export type TeamId = Branded<unknown, 'team_id'>
export type LeagueGuid = Branded<unknown, 'league_guid'>
export type TeamGuid = Branded<unknown, 'team_guid'>
4 changes: 2 additions & 2 deletions app/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ export type { DbModel } from './DbModel'
export type { Game, GameStatus } from './Game'
export type { Goals } from './Goals'
export type { KeyRecord, Role } from './KeyRecord'
export type { LeagueRecord } from './LeagueRecord'
export type { League } from './League'
export type { Logo } from './Logo'
export type { NotificationSubscription, NotifTopic } from './NotificationSubscription'
export type { Penalty, PenaltyType } from './Penalty'
export type { Registration } from './Registration'
export type { Roster } from './Roster'
export type { Season } from './Season'
export type { ShotOnGoal } from './ShotOnGoal'
export type { TeamRecord } from './TeamRecord'
export type { Team } from './Team'
export type { User } from './User'
export type { Venue } from './Venue'

Expand Down
2 changes: 1 addition & 1 deletion backend/internal/models/shotongoal.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type ShotOnGoal struct {
GameId uint `json:"game_id" gorm:"not_null"`
TeamId uint `json:"team_id" gorm:"not_null"`
ShotTime uint `json:"shot_time" gorm:"not_null"`
Scorekeeper uint `json:"scorekeeper gorm:"not_null"`
Scorekeeper uint `json:"scorekeeper" gorm:"not_null"`
}

// Should overide GOs incorrect pluralization
Expand Down

0 comments on commit 3b6039b

Please sign in to comment.