feat: gamemaster
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user