generated from VLADIMIR/template
fix
This commit is contained in:
@@ -15,10 +15,13 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrTeamNotFound indicates that a team was not found.
|
||||
ErrTeamNotFound = errors.New("Команда не найдена")
|
||||
// ErrGameNotFound indicates that a game was not found.
|
||||
ErrGameNotFound = errors.New("Игра не найдена")
|
||||
)
|
||||
|
||||
// GameplayService handles team gameplay operations.
|
||||
type GameplayService struct {
|
||||
gamesRepo *games_repo.GamesRepo
|
||||
teamsRepo *teams_repo.TeamsRepo
|
||||
@@ -30,6 +33,7 @@ type GameplayService struct {
|
||||
domain string
|
||||
}
|
||||
|
||||
// NewGameplayService creates a gameplay service.
|
||||
func NewGameplayService(
|
||||
gamesRepo *games_repo.GamesRepo,
|
||||
teamsRepo *teams_repo.TeamsRepo,
|
||||
@@ -52,10 +56,12 @@ func NewGameplayService(
|
||||
}
|
||||
}
|
||||
|
||||
// GiveTeamApplications grants an application to a team.
|
||||
func (s *GameplayService) GiveTeamApplications(ctx context.Context, teamID int, name string) error {
|
||||
return mapGameplayError(s.applicationsRepo.UpdateApplicationStatus(ctx, teamID, name, "done"))
|
||||
}
|
||||
|
||||
// GetTeamActions returns the current story, game, and available team actions.
|
||||
func (s *GameplayService) GetTeamActions(ctx context.Context, teamID int, password string) (*storytelling.Story, *game_model.Game, []actions_repo.Action, error) {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamID)
|
||||
if err != nil {
|
||||
@@ -93,6 +99,7 @@ func (s *GameplayService) GetTeamActions(ctx context.Context, teamID int, passwo
|
||||
return story, game_model.MapGame(game, s.domain), actions, nil
|
||||
}
|
||||
|
||||
// AddTeamAction records an action performed by a team.
|
||||
func (s *GameplayService) AddTeamAction(ctx context.Context, teamID int, password string, actionCode string, viaMCP bool) error {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamID)
|
||||
if err != nil {
|
||||
@@ -147,6 +154,7 @@ func (s *GameplayService) AddTeamAction(ctx context.Context, teamID int, passwor
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteLastTeamAction removes the latest action for a team.
|
||||
func (s *GameplayService) DeleteLastTeamAction(ctx context.Context, teamID int) error {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user