MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / apiDeleteZoneOfficial

Method apiDeleteZoneOfficial

modules/elections/admin.go:92–105  ·  view source on GitHub ↗

apiDeleteZoneOfficial handles DELETE /admin/api/v1/elections/zones/{zone}/official Removes the elected official for the named zone.

(r *http.Request)

Source from the content-addressed store, hash-verified

90// apiDeleteZoneOfficial handles DELETE /admin/api/v1/elections/zones/{zone}/official
91// Removes the elected official for the named zone.
92func (m *ElectionsModule) apiDeleteZoneOfficial(r *http.Request) (int, bool, any) {
93 zoneName := r.PathValue("zone")
94 if zoneName == "" {
95 return http.StatusBadRequest, false, map[string]string{"error": "zone is required"}
96 }
97 zoneKey := strings.ToLower(zoneName)
98
99 if _, ok := m.state.Winners[zoneKey]; !ok {
100 return http.StatusNotFound, false, map[string]string{"error": "no elected official for zone"}
101 }
102
103 delete(m.state.Winners, zoneKey)
104 return http.StatusOK, true, map[string]any{"zone": zoneKey, "official_removed": true}
105}

Callers

nothing calls this directly

Calls 1

deleteFunction · 0.85

Tested by

no test coverage detected