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:
4
main.go
4
main.go
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user