markAllInboxNotificationsAsRead marks as read all unread notifications for authenticated user. @Summary Mark all unread notifications as read @ID mark-all-unread-notifications-as-read @Security CoderSessionToken @Tags Notifications @Success 204 @Router /api/v2/notifications/inbox/mark-all-as-read [p
(rw http.ResponseWriter, r *http.Request)
| 442 | // @Success 204 |
| 443 | // @Router /api/v2/notifications/inbox/mark-all-as-read [put] |
| 444 | func (api *API) markAllInboxNotificationsAsRead(rw http.ResponseWriter, r *http.Request) { |
| 445 | var ( |
| 446 | ctx = r.Context() |
| 447 | apikey = httpmw.APIKey(r) |
| 448 | ) |
| 449 | |
| 450 | err := api.Database.MarkAllInboxNotificationsAsRead(ctx, database.MarkAllInboxNotificationsAsReadParams{ |
| 451 | UserID: apikey.UserID, |
| 452 | ReadAt: sql.NullTime{Time: dbtime.Now(), Valid: true}, |
| 453 | }) |
| 454 | if err != nil { |
| 455 | api.Logger.Error(ctx, "failed to mark all unread notifications as read", slog.Error(err)) |
| 456 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 457 | Message: "Failed to mark all unread notifications as read.", |
| 458 | }) |
| 459 | return |
| 460 | } |
| 461 | |
| 462 | rw.WriteHeader(http.StatusNoContent) |
| 463 | } |
nothing calls this directly
no test coverage detected