2025-01-05 02:53:54 +01:00
|
|
|
package repo
|
|
|
|
|
|
|
|
import (
|
|
|
|
model "git.kapelle.org/niklas/beerpong-elo/internal/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Repo interface {
|
2025-01-06 01:14:32 +01:00
|
|
|
// Add a new game to the repo. ID needs to be nil on argument. PlayerID are fetched beforehand.
|
|
|
|
AddGame(model.Game) (model.GameID, error)
|
2025-01-05 02:53:54 +01:00
|
|
|
|
2025-01-06 01:14:32 +01:00
|
|
|
//Get a game by ID. Returns nil if not found.
|
|
|
|
GetGame(model.GameID) (*model.Game, error)
|
|
|
|
|
|
|
|
// Get ID of a player. Creates one if not found.
|
|
|
|
GetOrCreatePlayerID(string) (model.PlayerID, error)
|
|
|
|
|
|
|
|
// Get player by id. Returns nil if not found.
|
|
|
|
GetPlayer(model.PlayerID) (*model.Player, error)
|
|
|
|
|
|
|
|
// Adds a game result. ID needs to be nil on argument.
|
|
|
|
AddGameResult(model.GameResult) (model.GameResultID, error)
|
|
|
|
|
|
|
|
// Get a game result by ID. Returns nil if not found.
|
|
|
|
GetGameResult(model.GameResultID) (*model.GameResult, error)
|
2025-01-05 02:53:54 +01:00
|
|
|
}
|