fix(api/v2): return 200 from notifications mark-all (creates nothing)
This commit is contained in:
parent
604e5850bc
commit
7158334699
|
|
@ -71,7 +71,9 @@ func RegisterNotificationRoutes(api huma.API) {
|
||||||
Description: "Marks every notification of the authenticated user as read. Link shares have no notifications and are refused.",
|
Description: "Marks every notification of the authenticated user as read. Link shares have no notifications and are refused.",
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/notifications",
|
Path: "/notifications",
|
||||||
Tags: tags,
|
// Override the wrapper's POST→201 create default: this action creates nothing.
|
||||||
|
DefaultStatus: http.StatusOK,
|
||||||
|
Tags: tags,
|
||||||
}, notificationsMarkAllRead)
|
}, notificationsMarkAllRead)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,8 @@ func TestHumaNotification_MarkAllAsRead(t *testing.T) {
|
||||||
token := humaTokenFor(t, &testuser1)
|
token := humaTokenFor(t, &testuser1)
|
||||||
|
|
||||||
rec := humaRequest(t, e, http.MethodPost, "/api/v2/notifications", "", token, "")
|
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"`)
|
assert.Contains(t, rec.Body.String(), `"message":"success"`)
|
||||||
|
|
||||||
list := humaRequest(t, e, http.MethodGet, "/api/v2/notifications", "", token, "")
|
list := humaRequest(t, e, http.MethodGet, "/api/v2/notifications", "", token, "")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue