This commit is contained in:
2026-08-04 01:36:52 +07:00
parent ff26c2e6bb
commit e424174e29
9 changed files with 478 additions and 149 deletions
+19
View File
@@ -221,6 +221,25 @@ func (r *GamesRepo) PauseGame(ctx context.Context, id int) error {
return nil
}
func (r *GamesRepo) PlayGame(ctx context.Context, id int) error {
tag, err := r.pool.Exec(
ctx,
`UPDATE games
SET
status = 'run',
updated_at = NOW()
WHERE id = $1`,
id,
)
if err != nil {
return err
}
if tag.RowsAffected() == 0 {
return ErrGameNotFound
}
return nil
}
func (r *GamesRepo) FinishGame(ctx context.Context, id int) error {
tag, err := r.pool.Exec(
ctx,