feat: add streak
This commit is contained in:
@@ -375,9 +375,11 @@ func (h *Handler) Daily(w http.ResponseWriter, r *http.Request) {
|
||||
httpx.Error(w, http.StatusUnauthorized, "unauthorized")
|
||||
return
|
||||
}
|
||||
switch amount, err := h.svc.ClaimDaily(r.Context(), id); {
|
||||
switch amount, streak, best, err := h.svc.ClaimDaily(r.Context(), id); {
|
||||
case err == nil:
|
||||
httpx.JSON(w, http.StatusOK, map[string]any{"message": "ok", "amount": amount})
|
||||
httpx.JSON(w, http.StatusOK, map[string]any{
|
||||
"message": "ok", "amount": amount, "streak": streak, "best": best,
|
||||
})
|
||||
case errors.Is(err, ErrTooSoon):
|
||||
httpx.Error(w, http.StatusTooManyRequests, "already claimed today")
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user