This commit is contained in:
2026-10-03 12:48:31 +07:00
parent 7a972ea960
commit dd55079e06
8 changed files with 16 additions and 0 deletions
+1
View File
@@ -1,5 +1,6 @@
package repos
// Application describes evidence attached to a team.
type Application struct {
Name string
Image string
+1
View File
@@ -4,6 +4,7 @@ import (
"time"
)
// Game describes a game and its scenario and teams.
type Game struct {
Format string
ID int
+1
View File
@@ -26,6 +26,7 @@ type Repo struct {
pool *pgxpool.Pool
}
// NewGameMapRepo creates a game map repository.
func NewGameMapRepo(pool *pgxpool.Pool) *Repo {
return &Repo{pool: pool}
}
+3
View File
@@ -7,14 +7,17 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
)
// Repo checks database health.
type Repo struct {
pool *pgxpool.Pool
}
// New creates a database health repository.
func New(pool *pgxpool.Pool) *Repo {
return &Repo{pool: pool}
}
// Check verifies that the database is reachable.
func (r *Repo) Check(ctx context.Context) error {
return r.pool.Ping(ctx)
}
@@ -8,16 +8,19 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
)
// RefreshTokensRepo persists refresh tokens.
type RefreshTokensRepo struct {
pool *pgxpool.Pool
}
// NewRefreshTokensRepo creates a refresh token repository.
func NewRefreshTokensRepo(pool *pgxpool.Pool) *RefreshTokensRepo {
return &RefreshTokensRepo{
pool: pool,
}
}
// AddRefreshToken stores a refresh token.
func (s *RefreshTokensRepo) AddRefreshToken(
ctx context.Context,
userID int,
@@ -35,6 +38,7 @@ func (s *RefreshTokensRepo) AddRefreshToken(
return err
}
// ExistsRefreshToken reports whether an unexpired refresh token exists.
func (s *RefreshTokensRepo) ExistsRefreshToken(
ctx context.Context,
userID int,
@@ -63,6 +67,7 @@ func (s *RefreshTokensRepo) ExistsRefreshToken(
return exists, nil
}
// DeleteRefreshTokenByJti removes a refresh token by its JTI.
func (s *RefreshTokensRepo) DeleteRefreshTokenByJti(
ctx context.Context,
jti string,
+1
View File
@@ -1,5 +1,6 @@
package repos
// Team describes a game team and its participation state.
type Team struct {
ParticipationStatus string
ParticipationSource string
+3
View File
@@ -8,10 +8,12 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
)
// TeamAnswersRepo persists team answers.
type TeamAnswersRepo struct {
pool *pgxpool.Pool
}
// NewTeamAnswersRepo creates a team answers repository.
func NewTeamAnswersRepo(pool *pgxpool.Pool) *TeamAnswersRepo {
return &TeamAnswersRepo{
pool: pool,
@@ -45,6 +47,7 @@ func (r *TeamAnswersRepo) UpsertAnswers(
return nil
}
// GetAnswersByTeamID returns answers submitted by a team.
func (r *TeamAnswersRepo) GetAnswersByTeamID(
ctx context.Context,
teamID int,
+1
View File
@@ -2,6 +2,7 @@ package repos
import "time"
// User describes an application user.
type User struct {
ID int
Username string