refactor: replace hardcoded NATS subjects with typed helpers
Some checks failed
CI / Deploy / test (pull_request) Successful in 14s
CI / Deploy / lint (pull_request) Failing after 21s
CI / Deploy / deploy (pull_request) Has been skipped

Add GameSubject/ChatSubject helpers to connect4 and snake packages,
eliminating magic string concatenation from handlers and main.go.
This commit is contained in:
Ryan Hamamura
2026-03-02 21:30:47 -10:00
parent 2cfd42b606
commit fb6c0e3d90
5 changed files with 20 additions and 8 deletions

View File

@@ -73,12 +73,12 @@ func run(ctx context.Context) error {
// Game stores
store := connect4.NewStore(queries)
store.SetNotifyFunc(func(gameID string) {
nc.Publish("connect4."+gameID, nil) //nolint:errcheck // best-effort notification
nc.Publish(connect4.GameSubject(gameID), nil) //nolint:errcheck // best-effort notification
})
snakeStore := snake.NewSnakeStore(queries)
snakeStore.SetNotifyFunc(func(gameID string) {
nc.Publish("snake."+gameID, nil) //nolint:errcheck // best-effort notification
nc.Publish(snake.GameSubject(gameID), nil) //nolint:errcheck // best-effort notification
})
// Router