refactor: replace hardcoded NATS subjects with typed helpers
Add GameSubject/ChatSubject helpers to connect4 and snake packages, eliminating magic string concatenation from handlers and main.go.
This commit is contained in:
@@ -6,6 +6,12 @@ import (
|
||||
"github.com/ryanhamamura/games/player"
|
||||
)
|
||||
|
||||
// NATS subject helpers.
|
||||
const SubjectPrefix = "connect4"
|
||||
|
||||
func GameSubject(gameID string) string { return SubjectPrefix + "." + gameID }
|
||||
func ChatSubject(gameID string) string { return SubjectPrefix + ".chat." + gameID }
|
||||
|
||||
type Player struct {
|
||||
ID player.ID
|
||||
UserID *string // UUID for authenticated users, nil for guests
|
||||
|
||||
Reference in New Issue
Block a user