Enhance Notification Management with New Endpoints and Response Structures

- Added new endpoints for retrieving notifications for both admins and users, improving the flexibility of the notification system.
- Implemented query parameters for filtering notifications by status, method, event type, type, and recipient, enhancing usability.
- Introduced new response structures for notifications, including pagination information, to provide better data handling in API responses.
- Updated API documentation with Swagger comments for the new endpoints and response formats, ensuring clarity for API consumers.
- Refactored notification handling logic to support the new features, promoting a more robust notification management system.
This commit is contained in:
n.nakhostin
2025-09-20 17:41:21 +03:30
parent ab6eb3b3ed
commit 19cd346b1c
13 changed files with 1637 additions and 16 deletions
+269
View File
@@ -654,6 +654,15 @@ definitions:
example: reviewed
type: string
type: object
internal_notification.NotificationListResponse:
properties:
meta:
$ref: '#/definitions/response.Meta'
notifications:
items:
$ref: '#/definitions/internal_notification.NotificationResponse'
type: array
type: object
internal_notification.NotificationRequest:
properties:
channels:
@@ -681,6 +690,40 @@ definitions:
type:
$ref: '#/definitions/notification.NotificationType'
type: object
internal_notification.NotificationResponse:
properties:
created_at:
type: integer
description:
type: string
event_type:
type: string
id:
type: string
link:
type: string
metadata:
additionalProperties: {}
type: object
methods:
additionalProperties:
type: string
type: object
priority:
type: string
schedule_at:
type: integer
status:
type: string
title:
type: string
type:
type: string
updated_at:
type: integer
user_id:
type: string
type: object
notification.DeliveryChannel:
enum:
- push
@@ -2726,6 +2769,80 @@ paths:
tags:
- Admin-Inquiries
/admin/v1/notifications:
get:
consumes:
- application/json
description: Get notifications
parameters:
- description: Status filter
in: query
name: status
type: string
- description: Method filter
in: query
name: method
type: string
- description: Event type filter
in: query
name: event_type
type: string
- description: Type filter
in: query
name: type
type: string
- description: Recipient filter
in: query
name: recipient
type: string
- description: Limit results
in: query
name: limit
type: integer
- description: Offset results
in: query
name: offset
type: integer
- description: Sort field
in: query
name: sort_by
type: string
- description: Sort order
in: query
name: sort_order
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/internal_notification.NotificationListResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.APIResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get notifications
tags:
- Admin-Notification
post:
consumes:
- application/json
@@ -2752,9 +2869,86 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Create a new notification
tags:
- Admin-Notification
/admin/v1/notifications/my:
get:
consumes:
- application/json
description: Get notifications for the admin
parameters:
- description: Status filter
in: query
name: status
type: string
- description: Method filter
in: query
name: method
type: string
- description: Event type filter
in: query
name: event_type
type: string
- description: Type filter
in: query
name: type
type: string
- description: Recipient filter
in: query
name: recipient
type: string
- description: Limit results
in: query
name: limit
type: integer
- description: Offset results
in: query
name: offset
type: integer
- description: Sort field
in: query
name: sort_by
type: string
- description: Sort order
in: query
name: sort_order
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/internal_notification.NotificationListResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.APIResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get notifications for the admin
tags:
- Admin-Notification
/admin/v1/profile:
get:
consumes:
@@ -4324,6 +4518,81 @@ paths:
summary: Create new inquiry
tags:
- Inquiries
/api/v1/notifications/my:
get:
consumes:
- application/json
description: Get notifications for the user
parameters:
- description: Status filter
in: query
name: status
type: string
- description: Method filter
in: query
name: method
type: string
- description: Event type filter
in: query
name: event_type
type: string
- description: Type filter
in: query
name: type
type: string
- description: Recipient filter
in: query
name: recipient
type: string
- description: Limit results
in: query
name: limit
type: integer
- description: Offset results
in: query
name: offset
type: integer
- description: Sort field
in: query
name: sort_by
type: string
- description: Sort order
in: query
name: sort_order
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/internal_notification.NotificationListResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.APIResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get notifications for the user
tags:
- Notification
/api/v1/profile:
get:
consumes: