feat: add stickers delete api
This commit is contained in:
@@ -141,6 +141,19 @@ func (h *SadhnaHandler) GiftableRewards(w http.ResponseWriter, r *http.Request)
|
||||
response.JSON(w, http.StatusOK, list)
|
||||
}
|
||||
|
||||
// DeleteCustomGift — DELETE /admin/reward-gifts/{key}
|
||||
func (h *SadhnaHandler) DeleteCustomGift(w http.ResponseWriter, r *http.Request) {
|
||||
if err := h.svc.DeleteCustomGift(r.Context(), chi.URLParam(r, "key")); err != nil {
|
||||
if errors.Is(err, repository.ErrRewardNotFound) {
|
||||
response.Error(w, http.StatusNotFound, "no such custom gift")
|
||||
return
|
||||
}
|
||||
response.Error(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
response.NoContent(w)
|
||||
}
|
||||
|
||||
type customGiftReq struct {
|
||||
Name string `json:"name"`
|
||||
Meaning string `json:"meaning"`
|
||||
|
||||
Reference in New Issue
Block a user