feat: gamemaster

This commit is contained in:
Ilia Denisov
2026-05-03 07:59:03 +02:00
committed by GitHub
parent a7cee15115
commit 3e2622757e
229 changed files with 41521 additions and 1098 deletions
+2 -8
View File
@@ -7,9 +7,9 @@ import (
"strings"
"time"
"galaxy/cronutil"
"galaxy/lobby/internal/domain/common"
cron "github.com/robfig/cron/v3"
"golang.org/x/mod/semver"
)
@@ -213,12 +213,6 @@ type NewGameInput struct {
Now time.Time
}
// standardCronParser parses the frozen five-field cron expression grammar
// used by turn_schedule.
var standardCronParser = cron.NewParser(
cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow,
)
// New validates input and returns a draft Game record. Validation errors
// are returned verbatim so callers can surface them as invalid_request.
func New(input NewGameInput) (Game, error) {
@@ -401,7 +395,7 @@ func validateCronExpression(value string) error {
if strings.TrimSpace(value) == "" {
return fmt.Errorf("turn schedule must not be empty")
}
if _, err := standardCronParser.Parse(value); err != nil {
if _, err := cronutil.Parse(value); err != nil {
return fmt.Errorf("turn schedule must be a valid five-field cron expression: %w", err)
}
return nil