Domain Model v2

Co-authored-by: Oblivion <OblivionLimbo@users.noreply.github.com>
Co-authored-by: SgtPodding <SgtPodding@users.noreply.github.com>
This commit is contained in:
Felix Albrigtsen 2022-03-01 23:59:58 +01:00
parent a30482e496
commit 4f782ce90f
1 changed files with 61 additions and 22 deletions

View File

@ -1,37 +1,76 @@
@startuml Tournament System
class Team {
name: String
tournament: Tournament
players: [Player]
matches: [Match]
}
class Group
class Match {
tournament: Tournament
team1: Team
team2: Team
team1_score: Integer
team2_score: Integer
winner_id: Integer
void setScore(team1_score: Integer, team2_score: Integer)
void setWinner(winner_id: Integer)
}
class Player {
' class Group
' Match med bare to teams:
' class Match {
' *match_id: Integer
' tournament_id: Integer
' team1_id: Integer
' team2_id: Integer
' scores: [Integer, Integer]
' winner_id: Integer
' void setScore(team1_score: Integer, team2_score: Integer)
' void setWinner(winner_id: Integer)
' Integer getWinner()
' }
' Match med vilkårlig antall teams
class Match {
*match_id: Integer
tournament_id: Integer
team_ids: Integer[]
scores: Integer[]
winner_id: Integer
Match constructor(tournament_id: Integer, team_ids: Integer[])
void setScore(team_id: Integer, score: Integer)
void setWinner(winner_id: Integer)
Integer getWinner()
}
class Team {
*team_id: Integer
name: String
team: Team
void setTeam(team: Team)
tournament_ids: Integer[]
player_ids: Integer[]
match_ids: Integer[]
Team constructor(name: String)
void joinTournament(tournament_id: Integer)
void addPlayer(player_id: Integer)
void addMatch(match_id: Integer)
void removePlayer(player_id: Integer)
void removeMatch(match_id: Integer)
void leaveTournament(tournament_id: Integer)
}
class Player {
*player_id: Integer
name: String
team_id: Integer
Player constructor(name: String)
void joinTeam(team_id: Integer)
void leaveTeam()
}
class Tournament {
*tournament_id: Integer
name: String
start_date: Date
end_date: Date
team_ids: Integer[]
Tournament constructor(name: String, start_date: Date, end_date: Date)
void addTeam(team_id: Integer)
void removeTeam(team_id: Integer)
}
Tournament "1" *-- "2..*" Team : contains
Tournament "1" *-- "*" Match : contains
Player "1..*" *-- "1" Team : belongsTo
Match "*" *--- "2" Team : contains