fix: filter daily reports by date

This commit is contained in:
richjohnrambo
2026-09-28 14:34:08 +08:00
parent 8773991015
commit 75f811bb9f
2 changed files with 15 additions and 2 deletions
+10 -1
View File
@@ -674,7 +674,16 @@ func (a *API) meetingNoteFileResource(w http.ResponseWriter, r *http.Request, p
func (a *API) dailyReports(w http.ResponseWriter, r *http.Request, p *auth.Principal, st *store.Store) {
switch r.Method {
case http.MethodGet:
items, next, err := st.DailyReports(r.Context(), p.UserID, r.URL.Query().Get("cursor"), limit(r, 50, 100))
reportDate := ""
if rawDate := strings.TrimSpace(r.URL.Query().Get("date")); rawDate != "" {
date, parseErr := parseDate(rawDate)
if parseErr != nil {
writeError(w, r, http.StatusBadRequest, 30000, reasonMalformedRequest, "malformed request", map[string]any{"field": "date"})
return
}
reportDate = date.Format("2006-01-02")
}
items, next, err := st.DailyReports(r.Context(), p.UserID, reportDate, r.URL.Query().Get("cursor"), limit(r, 50, 100))
if err != nil {
writeStoreError(w, r, err)
return