feat: add streak

This commit is contained in:
2026-07-07 21:10:01 +03:30
parent e8396db45c
commit e7b2e05428
4 changed files with 117 additions and 25 deletions
+4 -2
View File
@@ -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: