Files
galaxy-game/gamemaster/internal/api/internalhttp/handlers/invalidatememberships.go
T
2026-05-03 07:59:03 +02:00

26 lines
798 B
Go

package handlers
import "net/http"
// newInvalidateMembershipsHandler returns the handler for
// `POST /api/v1/internal/games/{game_id}/memberships/invalidate`. The
// underlying cache invalidation is a fire-and-forget local operation,
// so the handler always responds with `204 No Content` once the path
// parameter validates.
func newInvalidateMembershipsHandler(deps Dependencies) http.HandlerFunc {
return func(writer http.ResponseWriter, request *http.Request) {
if deps.InvalidateMemberships == nil {
writeError(writer, http.StatusInternalServerError, errorCodeInternal, "membership cache invalidator is not wired")
return
}
gameID, ok := extractGameID(writer, request)
if !ok {
return
}
deps.InvalidateMemberships.Invalidate(gameID)
writeNoContent(writer)
}
}