Enhance Notification System with New API Endpoints and Response Structures
- Added new endpoints for marking notifications as seen and retrieving detailed notification information for both admin and user contexts, improving the flexibility of the notification system. - Implemented the MarkSeen and ViewNotification methods in the NotificationHandler, ensuring proper handling of notification visibility and details retrieval. - Updated the NotificationService interface to include methods for getting notification details and marking notifications as seen, enhancing service capabilities. - Enhanced the notification response structures to include additional fields such as Image, Seen, and ScheduledAt, providing richer data in API responses. - Updated API documentation with Swagger comments for the new endpoints and response formats, ensuring clarity for API consumers.
This commit is contained in:
+204
-7
@@ -469,9 +469,6 @@ definitions:
|
||||
full_name:
|
||||
example: User
|
||||
type: string
|
||||
password:
|
||||
example: User!1234
|
||||
type: string
|
||||
phone:
|
||||
example: "+1234567890"
|
||||
type: string
|
||||
@@ -693,15 +690,19 @@ definitions:
|
||||
internal_notification.NotificationResponse:
|
||||
properties:
|
||||
created_at:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
event_type:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
image:
|
||||
type: string
|
||||
is_scheduled:
|
||||
type: boolean
|
||||
link:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
metadata:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
@@ -713,6 +714,12 @@ definitions:
|
||||
type: string
|
||||
schedule_at:
|
||||
type: integer
|
||||
scheduled_at:
|
||||
type: integer
|
||||
seen:
|
||||
type: boolean
|
||||
seen_at:
|
||||
type: integer
|
||||
status:
|
||||
type: string
|
||||
title:
|
||||
@@ -720,7 +727,7 @@ definitions:
|
||||
type:
|
||||
type: string
|
||||
updated_at:
|
||||
type: integer
|
||||
type: string
|
||||
user_id:
|
||||
type: string
|
||||
type: object
|
||||
@@ -732,6 +739,54 @@ definitions:
|
||||
x-enum-varnames:
|
||||
- DeliveryChannelPush
|
||||
- DeliveryChannelEmail
|
||||
notification.DetailedNotificationResponse:
|
||||
properties:
|
||||
data:
|
||||
properties:
|
||||
created_at:
|
||||
type: string
|
||||
event_type:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
image:
|
||||
type: string
|
||||
is_scheduled:
|
||||
type: boolean
|
||||
link:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
metadata:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
methods:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
priority:
|
||||
description: low, medium, important
|
||||
type: string
|
||||
scheduled_at:
|
||||
type: integer
|
||||
seen:
|
||||
type: boolean
|
||||
seen_at:
|
||||
type: integer
|
||||
status:
|
||||
description: pending, sent, failed
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type:
|
||||
description: info, warning, alert, reject
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
user_id:
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
notification.NotificationPriority:
|
||||
enum:
|
||||
- low
|
||||
@@ -2874,6 +2929,37 @@ paths:
|
||||
summary: Create a new notification
|
||||
tags:
|
||||
- Admin-Notification
|
||||
/admin/v1/notifications/mark-seen/{id}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Mark a notification as seen
|
||||
parameters:
|
||||
- description: Notification ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Mark a notification as seen
|
||||
tags:
|
||||
- Admin-Notification
|
||||
/admin/v1/notifications/my:
|
||||
get:
|
||||
consumes:
|
||||
@@ -2949,6 +3035,46 @@ paths:
|
||||
summary: Get notifications for the admin
|
||||
tags:
|
||||
- Admin-Notification
|
||||
/admin/v1/notifications/view/{id}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get detailed information about a specific notification
|
||||
parameters:
|
||||
- description: Notification ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/internal_notification.NotificationResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get notification details
|
||||
tags:
|
||||
- Admin-Notification
|
||||
/admin/v1/profile:
|
||||
get:
|
||||
consumes:
|
||||
@@ -4518,7 +4644,7 @@ paths:
|
||||
summary: Create new inquiry
|
||||
tags:
|
||||
- Inquiries
|
||||
/api/v1/notifications/my:
|
||||
/api/v1/notifications:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -4593,6 +4719,77 @@ paths:
|
||||
summary: Get notifications for the user
|
||||
tags:
|
||||
- Notification
|
||||
/api/v1/notifications/mark-seen/{id}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Mark a notification as seen
|
||||
parameters:
|
||||
- description: Notification ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Mark a notification as seen
|
||||
tags:
|
||||
- Notification
|
||||
/api/v1/notifications/view/{id}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get detailed information about a specific notification
|
||||
parameters:
|
||||
- description: Notification ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/notification.DetailedNotificationResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get notification details
|
||||
tags:
|
||||
- Notification
|
||||
/api/v1/profile:
|
||||
get:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user