Add multilingual support, competition close/reopen, and backup directory
This commit is contained in:
@@ -52,6 +52,10 @@ func handleApplyPenalties(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusForbidden, "forbidden")
|
||||
return
|
||||
}
|
||||
if closed, _ := isCompetitionClosed(id); closed {
|
||||
writeError(w, http.StatusConflict, "competition_closed")
|
||||
return
|
||||
}
|
||||
var req struct {
|
||||
Task string `json:"task"`
|
||||
IDs []int64 `json:"ids"`
|
||||
@@ -166,6 +170,10 @@ func handleCreatePenalty(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusForbidden, "forbidden")
|
||||
return
|
||||
}
|
||||
if closed, _ := isCompetitionClosed(id); closed {
|
||||
writeError(w, http.StatusConflict, "competition_closed")
|
||||
return
|
||||
}
|
||||
var pen Penalty
|
||||
if err := json.NewDecoder(r.Body).Decode(&pen); err != nil {
|
||||
writeError(w, http.StatusBadRequest, "invalid_body")
|
||||
@@ -239,6 +247,10 @@ func handleUpdatePenalty(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusForbidden, "forbidden")
|
||||
return
|
||||
}
|
||||
if closed, _ := isCompetitionClosed(id); closed {
|
||||
writeError(w, http.StatusConflict, "competition_closed")
|
||||
return
|
||||
}
|
||||
var req struct {
|
||||
Flight *string `json:"flight"`
|
||||
Date *string `json:"date"`
|
||||
@@ -330,6 +342,10 @@ func handleDeletePenalty(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusForbidden, "forbidden")
|
||||
return
|
||||
}
|
||||
if closed, _ := isCompetitionClosed(id); closed {
|
||||
writeError(w, http.StatusConflict, "competition_closed")
|
||||
return
|
||||
}
|
||||
db.Exec("DELETE FROM penalties WHERE id=?", pid)
|
||||
hub.broadcast(id, "penalty_deleted", map[string]int64{"id": pid})
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
|
||||
Reference in New Issue
Block a user