feat(routes): expand account parity coverage
This commit is contained in:
@@ -57,7 +57,7 @@ func (h *NotificationHandler) Get(c *gin.Context) {
|
||||
response.AbortWithStatusError(c, http.StatusServiceUnavailable, response.ErrInternal, "Notification service not available")
|
||||
return
|
||||
}
|
||||
notificationID, err := parseUintParam(c, "notification_id")
|
||||
notificationID, err := parseUintAnyParam(c, "notification_id", "id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid notification id")
|
||||
return
|
||||
@@ -76,7 +76,7 @@ func (h *NotificationHandler) Get(c *gin.Context) {
|
||||
// PUT /api/v1/accounts/:account_id/notifications/:id
|
||||
// Reference: Chatwoot update — @notification.update(read_at: DateTime.now.utc); render json: @notification
|
||||
func (h *NotificationHandler) Update(c *gin.Context) {
|
||||
notificationID, err := parseUintParam(c, "notification_id")
|
||||
notificationID, err := parseUintAnyParam(c, "notification_id", "id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid notification id")
|
||||
return
|
||||
@@ -134,7 +134,7 @@ func (h *NotificationHandler) UnreadCount(c *gin.Context) {
|
||||
// POST /api/v1/accounts/:account_id/notifications/:id/snooze
|
||||
// Reference: Chatwoot snooze — update(snoozed_until: ..., meta: ...)
|
||||
func (h *NotificationHandler) Snooze(c *gin.Context) {
|
||||
notificationID, err := parseUintParam(c, "notification_id")
|
||||
notificationID, err := parseUintAnyParam(c, "notification_id", "id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid notification id")
|
||||
return
|
||||
@@ -170,7 +170,7 @@ func (h *NotificationHandler) Snooze(c *gin.Context) {
|
||||
// POST /api/v1/accounts/:account_id/notifications/:id/unread
|
||||
// Reference: Chatwoot unread — @notification.update(read_at: nil); render json: @notification
|
||||
func (h *NotificationHandler) Unread(c *gin.Context) {
|
||||
notificationID, err := parseUintParam(c, "notification_id")
|
||||
notificationID, err := parseUintAnyParam(c, "notification_id", "id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid notification id")
|
||||
return
|
||||
@@ -192,7 +192,7 @@ func (h *NotificationHandler) Unread(c *gin.Context) {
|
||||
// DELETE /api/v1/accounts/:account_id/notifications/:id
|
||||
// Reference: Chatwoot destroy — @notification.destroy; head :ok
|
||||
func (h *NotificationHandler) Destroy(c *gin.Context) {
|
||||
notificationID, err := parseUintParam(c, "notification_id")
|
||||
notificationID, err := parseUintAnyParam(c, "notification_id", "id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid notification id")
|
||||
return
|
||||
@@ -225,4 +225,4 @@ func (h *NotificationHandler) DestroyAll(c *gin.Context) {
|
||||
}
|
||||
|
||||
c.Status(http.StatusOK)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user