Initial release: Disc Agenda frisbee tournament platform
Some checks failed
Build and Push / build (push) Failing after 8s
Some checks failed
Build and Push / build (push) Failing after 8s
Full-stack tournament management app with real-time scoring: - Go 1.26 backend with REST API and WebSocket live scoring - React 19 + Vite 8 frontend with mobile-first design - File-based JSON storage with JSONL audit logs - Multi-stage Docker build with Gitea CI/CD pipeline - Post-tournament questionnaire with spirit voting - Technical documentation and project description Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
118
backend/internal/models/models.go
Normal file
118
backend/internal/models/models.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type TournamentStatus string
|
||||
|
||||
const (
|
||||
StatusUpcoming TournamentStatus = "upcoming"
|
||||
StatusInProgress TournamentStatus = "in_progress"
|
||||
StatusCompleted TournamentStatus = "completed"
|
||||
)
|
||||
|
||||
type Tournament struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Status TournamentStatus `json:"status"`
|
||||
Location string `json:"location"`
|
||||
Venue string `json:"venue"`
|
||||
StartDate string `json:"start_date"`
|
||||
EndDate string `json:"end_date"`
|
||||
Description string `json:"description"`
|
||||
Teams []Team `json:"teams"`
|
||||
ImageURL string `json:"image_url,omitempty"`
|
||||
Rules string `json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
type Team struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Logo string `json:"logo,omitempty"`
|
||||
}
|
||||
|
||||
type Game struct {
|
||||
ID string `json:"id"`
|
||||
TourneyID string `json:"tourney_id"`
|
||||
HomeTeam string `json:"home_team"`
|
||||
AwayTeam string `json:"away_team"`
|
||||
HomeScore int `json:"home_score"`
|
||||
AwayScore int `json:"away_score"`
|
||||
StartTime string `json:"start_time"`
|
||||
Field string `json:"field"`
|
||||
Round string `json:"round"`
|
||||
Status string `json:"status"` // scheduled, live, final
|
||||
}
|
||||
|
||||
type Schedule struct {
|
||||
TourneyID string `json:"tourney_id"`
|
||||
Games []Game `json:"games"`
|
||||
}
|
||||
|
||||
type ScoreUpdate struct {
|
||||
Action string `json:"action"` // increment, decrement, set
|
||||
Team string `json:"team"` // home, away
|
||||
Value int `json:"value"` // used for "set"
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
UserID string `json:"user_id,omitempty"`
|
||||
}
|
||||
|
||||
type ScoreState struct {
|
||||
GameID string `json:"game_id"`
|
||||
HomeScore int `json:"home_score"`
|
||||
AwayScore int `json:"away_score"`
|
||||
HomeTeam string `json:"home_team"`
|
||||
AwayTeam string `json:"away_team"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type AuditEntry struct {
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Action string `json:"action"`
|
||||
Team string `json:"team"`
|
||||
Value int `json:"value"`
|
||||
OldHome int `json:"old_home"`
|
||||
OldAway int `json:"old_away"`
|
||||
NewHome int `json:"new_home"`
|
||||
NewAway int `json:"new_away"`
|
||||
UserID string `json:"user_id,omitempty"`
|
||||
}
|
||||
|
||||
type QuestionnaireConfig struct {
|
||||
TourneyID string `json:"tourney_id"`
|
||||
CustomQuestions []Question `json:"custom_questions"`
|
||||
}
|
||||
|
||||
type Question struct {
|
||||
ID string `json:"id"`
|
||||
Text string `json:"text"`
|
||||
Type string `json:"type"` // text, select, radio
|
||||
Options []string `json:"options,omitempty"`
|
||||
Required bool `json:"required"`
|
||||
}
|
||||
|
||||
type QuestionnaireResponse struct {
|
||||
ID string `json:"id"`
|
||||
TourneyID string `json:"tourney_id"`
|
||||
MyTeam string `json:"my_team"`
|
||||
SpiritWinner string `json:"spirit_winner"`
|
||||
AttendNext bool `json:"attend_next"`
|
||||
CustomAnswers map[string]string `json:"custom_answers"`
|
||||
SubmittedAt time.Time `json:"submitted_at"`
|
||||
}
|
||||
|
||||
type FinalResults struct {
|
||||
TourneyID string `json:"tourney_id"`
|
||||
Standings []Standing `json:"standings"`
|
||||
}
|
||||
|
||||
type Standing struct {
|
||||
Position int `json:"position"`
|
||||
TeamID string `json:"team_id"`
|
||||
TeamName string `json:"team_name"`
|
||||
Wins int `json:"wins"`
|
||||
Losses int `json:"losses"`
|
||||
Draws int `json:"draws"`
|
||||
PointsFor int `json:"points_for"`
|
||||
PointsAgainst int `json:"points_against"`
|
||||
SpiritScore float64 `json:"spirit_score,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user