Skip to content

Commit

Permalink
usecaseにconverterを追加 mapstats/playerstat を単数形に
Browse files Browse the repository at this point in the history
  • Loading branch information
Shugo Kawamura committed Aug 12, 2023
1 parent 03a6fab commit 5b5b50b
Show file tree
Hide file tree
Showing 14 changed files with 352 additions and 545 deletions.
8 changes: 4 additions & 4 deletions backend/entity/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ type Match struct {
Team2Score uint32
Forfeit *bool
Status MATCH_STATUS
Mapstats []*MapStats
Mapstats []*MapStat
}

type MapStats struct {
type MapStat struct {
ID MapStatsID
MatchID MatchID
MapNumber uint32
Expand All @@ -67,10 +67,10 @@ type MapStats struct {
Winner *TeamID
Team1Score uint32
Team2Score uint32
PlayerStats []*PlayerStats
PlayerStats []*PlayerStat
}

type PlayerStats struct {
type PlayerStat struct {
ID PlayerStatsID
MatchID MatchID
MapID MapStatsID
Expand Down
36 changes: 18 additions & 18 deletions backend/gateway/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ type RepositoryConnector interface {
GetGameServersRepository() GameServersRepository
// GetMatchesRepository returns a match repository. You must open a repository connection before calling this method.
GetMatchesRepository() MatchesRepository
// GetMapStatsRepository returns a map stats repository. You must open a repository connection before calling this method.
GetMapStatsRepository() MapStatsRepository
// GetPlayerStatsRepository returns a player stats repository. You must open a repository connection before calling this method.
GetPlayerStatsRepository() PlayerStatsRepository
// GetMapStatRepository returns a map stats repository. You must open a repository connection before calling this method.
GetMapStatRepository() MapStatRepository
// GetPlayerStatRepository returns a player stats repository. You must open a repository connection before calling this method.
GetPlayerStatRepository() PlayerStatRepository
// GetTeamsRepository returns a team repository. You must open a repository connection before calling this method.
GetTeamsRepository() TeamsRepository
// GetPlayersRepository returns a player repository. You must open a repository connection before calling this method.
Expand All @@ -76,10 +76,10 @@ type RepositoryConnectorWithTx interface {
GetGameServersRepository() GameServersRepository
// GetMatchesRepository returns a match repository. You must open a repository connection before calling this method.
GetMatchesRepository() MatchesRepository
// GetMapStatsRepository returns a map stats repository. You must open a repository connection before calling this method.
GetMapStatsRepository() MapStatsRepository
// GetPlayerStatsRepository returns a player stats repository. You must open a repository connection before calling this method.
GetPlayerStatsRepository() PlayerStatsRepository
// GetMapStatRepository returns a map stats repository. You must open a repository connection before calling this method.
GetMapStatRepository() MapStatRepository
// GetPlayerStatRepository returns a player stats repository. You must open a repository connection before calling this method.
GetPlayerStatRepository() PlayerStatRepository
// GetTeamsRepository returns a team repository. You must open a repository connection before calling this method.
GetTeamsRepository() TeamsRepository
// GetPlayersRepository returns a player repository. You must open a repository connection before calling this method.
Expand Down Expand Up @@ -138,28 +138,28 @@ type MatchesRepository interface {
StartMatch(ctx context.Context, matchID entity.MatchID) error
}

// MapStatsRepository is an interface for map stats repository.
type MapStatsRepository interface {
// MapStatRepository is an interface for map stats repository.
type MapStatRepository interface {
// TODO.
// AddMapStats(ctx context.Context, matchID int64, mapNumber uint32, mapName string, winnerID int64, team1Score uint32, team2Score uint32) (*entity.MapStats, error)
// GetMapStats returns map stats.
GetMapStats(ctx context.Context, id entity.MapStatsID) (*MapStats, error)
GetMapStats(ctx context.Context, id entity.MapStatsID) (*MapStat, error)
// GetMapStatsByMatch returns map stats owned by a match.
GetMapStatsByMatch(ctx context.Context, matchID entity.MatchID) ([]*MapStats, error)
GetMapStatsByMatch(ctx context.Context, matchID entity.MatchID) ([]*MapStat, error)
// GetMapStatsByMatchAndMap returns map stats owned by a match and map number.
GetMapStatsByMatchAndMap(ctx context.Context, matchID entity.MatchID, mapNumber uint32) (*MapStats, error)
GetMapStatsByMatchAndMap(ctx context.Context, matchID entity.MatchID, mapNumber uint32) (*MapStat, error)
}

// PlayerStatsRepository is an interface for player stats repository.
type PlayerStatsRepository interface {
// PlayerStatRepository is an interface for player stats repository.
type PlayerStatRepository interface {
// TODO.
// AddPlayerStats(ctx context.Context, mapStatsID int64, steamID string, name string, teamID int64, kills uint32, assists uint32, deaths uint32, hs uint32, flashAssists uint32, kast float32, rating float32) (*entity.PlayerStats, error)
// GetPlayerStatsBySteamID returns player stats owned by a steam ID.
GetPlayerStatsBySteamID(ctx context.Context, steamID entity.SteamID) ([]*PlayerStats, error)
GetPlayerStatsBySteamID(ctx context.Context, steamID entity.SteamID) ([]*PlayerStat, error)
// GetPlayerStatsByMatch returns player stats owned by a match.
GetPlayerStatsByMatch(ctx context.Context, matchID entity.MatchID) ([]*PlayerStats, error)
GetPlayerStatsByMatch(ctx context.Context, matchID entity.MatchID) ([]*PlayerStat, error)
// GetPlayerStatsByMapstats returns player stats owned by a map stats.
GetPlayerStatsByMapstats(ctx context.Context, mapStatsID entity.MapStatsID) ([]*PlayerStats, error)
GetPlayerStatsByMapstats(ctx context.Context, mapStatsID entity.MapStatsID) ([]*PlayerStat, error)
}

// TeamsRepository is an interface for team repository.
Expand Down
Loading

0 comments on commit 5b5b50b

Please sign in to comment.