fix(api/v2): return 200 from notifications mark-all (creates nothing)

This commit is contained in:
kolaente 2026-06-06 23:52:12 +02:00 committed by kolaente
parent 604e5850bc
commit 7158334699
2 changed files with 5 additions and 2 deletions

View File

@ -71,6 +71,8 @@ func RegisterNotificationRoutes(api huma.API) {
Description: "Marks every notification of the authenticated user as read. Link shares have no notifications and are refused.",
Method: http.MethodPost,
Path: "/notifications",
// Override the wrapper's POST→201 create default: this action creates nothing.
DefaultStatus: http.StatusOK,
Tags: tags,
}, notificationsMarkAllRead)
}

View File

@ -93,7 +93,8 @@ func TestHumaNotification_MarkAllAsRead(t *testing.T) {
token := humaTokenFor(t, &testuser1)
rec := humaRequest(t, e, http.MethodPost, "/api/v2/notifications", "", token, "")
require.Equal(t, http.StatusCreated, rec.Code, "body: %s", rec.Body.String())
// 200, not the wrapper's POST default 201: mark-all creates nothing.
require.Equal(t, http.StatusOK, rec.Code, "body: %s", rec.Body.String())
assert.Contains(t, rec.Body.String(), `"message":"success"`)
list := humaRequest(t, e, http.MethodGet, "/api/v2/notifications", "", token, "")