Integrate Notification Management into Tender Management System
- Added a new notification domain, including entities, services, handlers, and repositories to manage notifications effectively. - Implemented CRUD operations for notifications, allowing for creation, retrieval, updating, and deletion of notifications via the API. - Enhanced API documentation with Swagger comments for new notification endpoints, ensuring clarity for API consumers. - Updated routes to include notification management, improving administrative capabilities within the web panel. - Introduced validation for notification requests and responses, ensuring data integrity and proper error handling. - Updated the go.mod file to include the latest version of the go-redis library, ensuring compatibility with the notification service.
This commit is contained in:
+379
-2
@@ -303,6 +303,21 @@ definitions:
|
||||
updated_at:
|
||||
type: integer
|
||||
type: object
|
||||
customer.AssignRoleForm:
|
||||
properties:
|
||||
role:
|
||||
example: analyst
|
||||
type: string
|
||||
type: object
|
||||
customer.AssignRoleResponse:
|
||||
properties:
|
||||
message:
|
||||
example: Role assigned successfully
|
||||
type: string
|
||||
success:
|
||||
example: true
|
||||
type: boolean
|
||||
type: object
|
||||
customer.AuthResponse:
|
||||
properties:
|
||||
access_token:
|
||||
@@ -339,6 +354,9 @@ definitions:
|
||||
phone:
|
||||
example: "+1234567890"
|
||||
type: string
|
||||
role:
|
||||
example: analyst
|
||||
type: string
|
||||
type:
|
||||
example: individual
|
||||
type: string
|
||||
@@ -373,10 +391,10 @@ definitions:
|
||||
type: string
|
||||
last_login_at:
|
||||
type: integer
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
role:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
type:
|
||||
@@ -451,6 +469,9 @@ definitions:
|
||||
phone:
|
||||
example: "+1234567890"
|
||||
type: string
|
||||
role:
|
||||
example: analyst
|
||||
type: string
|
||||
type:
|
||||
example: individual
|
||||
type: string
|
||||
@@ -627,6 +648,101 @@ definitions:
|
||||
example: reviewed
|
||||
type: string
|
||||
type: object
|
||||
internal_notification.NotificationRequest:
|
||||
properties:
|
||||
channels:
|
||||
items:
|
||||
$ref: '#/definitions/notification.DeliveryChannel'
|
||||
type: array
|
||||
description:
|
||||
type: string
|
||||
link:
|
||||
type: string
|
||||
priority:
|
||||
$ref: '#/definitions/notification.NotificationPriority'
|
||||
recipient:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
schedule:
|
||||
$ref: '#/definitions/notification.ScheduleRequest'
|
||||
tender:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type:
|
||||
$ref: '#/definitions/notification.NotificationType'
|
||||
type: object
|
||||
internal_notification.NotificationResponse:
|
||||
properties:
|
||||
channels:
|
||||
items:
|
||||
$ref: '#/definitions/notification.DeliveryChannel'
|
||||
type: array
|
||||
description:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
link:
|
||||
type: string
|
||||
priority:
|
||||
$ref: '#/definitions/notification.NotificationPriority'
|
||||
schedule:
|
||||
$ref: '#/definitions/notification.ScheduleResponse'
|
||||
tender:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type:
|
||||
$ref: '#/definitions/notification.NotificationType'
|
||||
type: object
|
||||
notification.DeliveryChannel:
|
||||
enum:
|
||||
- push
|
||||
- email
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- DeliveryChannelPush
|
||||
- DeliveryChannelEmail
|
||||
notification.NotificationPriority:
|
||||
enum:
|
||||
- low
|
||||
- medium
|
||||
- important
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- NotificationPriorityLow
|
||||
- NotificationPriorityMedium
|
||||
- NotificationPriorityImportant
|
||||
notification.NotificationType:
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- alert
|
||||
- reject
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- NotificationTypeInfo
|
||||
- NotificationTypeWarning
|
||||
- NotificationTypeAlert
|
||||
- NotificationTypeReject
|
||||
notification.NotificationsResponse:
|
||||
properties:
|
||||
notifications:
|
||||
items:
|
||||
$ref: '#/definitions/internal_notification.NotificationResponse'
|
||||
type: array
|
||||
type: object
|
||||
notification.ScheduleRequest:
|
||||
properties:
|
||||
time:
|
||||
type: integer
|
||||
type: object
|
||||
notification.ScheduleResponse:
|
||||
properties:
|
||||
time:
|
||||
type: integer
|
||||
type: object
|
||||
response.APIError:
|
||||
properties:
|
||||
code:
|
||||
@@ -2002,6 +2118,56 @@ paths:
|
||||
summary: Update customer information
|
||||
tags:
|
||||
- Admin-Customers
|
||||
/admin/v1/customers/{id}/role:
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Assign a role (admin or analyst) to a customer
|
||||
parameters:
|
||||
- description: Customer ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Role assignment information
|
||||
in: body
|
||||
name: role
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/customer.AssignRoleForm'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Role assigned successfully
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/customer.AssignRoleResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request - Invalid input data
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"404":
|
||||
description: Not found - Customer not found
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"422":
|
||||
description: Validation error - Invalid request data
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Assign role to customer
|
||||
tags:
|
||||
- Admin-Customers
|
||||
/admin/v1/customers/{id}/status:
|
||||
patch:
|
||||
consumes:
|
||||
@@ -2526,6 +2692,213 @@ paths:
|
||||
summary: Update inquiry status
|
||||
tags:
|
||||
- Admin-Inquiries
|
||||
/admin/v1/notifications:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve notifications for a specific user with filtering and pagination
|
||||
parameters:
|
||||
- description: Recipient
|
||||
in: query
|
||||
name: recipient
|
||||
required: true
|
||||
type: string
|
||||
- description: Notification type (info, warning, alert, reject)
|
||||
in: query
|
||||
name: type
|
||||
type: string
|
||||
- description: Notification priority (low, medium, important)
|
||||
in: query
|
||||
name: priority
|
||||
type: string
|
||||
- description: Delivery status (pending, sent, failed)
|
||||
in: query
|
||||
name: status
|
||||
type: string
|
||||
- description: Read status
|
||||
in: query
|
||||
name: is_read
|
||||
type: boolean
|
||||
- default: 1
|
||||
description: Page number
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- default: 20
|
||||
description: Items per page
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
- default: created_at
|
||||
description: Sort field
|
||||
in: query
|
||||
name: sort_by
|
||||
type: string
|
||||
- default: desc
|
||||
description: Sort order (asc, desc)
|
||||
in: query
|
||||
name: sort_order
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/notification.NotificationsResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
summary: Get user notifications
|
||||
tags:
|
||||
- Admin-Notification
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Create a new notification with the provided information
|
||||
parameters:
|
||||
- description: Notification information
|
||||
in: body
|
||||
name: notification
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_notification.NotificationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Notification created successfully
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
summary: Create a new notification
|
||||
tags:
|
||||
- Admin-Notification
|
||||
/admin/v1/notifications/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Delete a specific notification
|
||||
parameters:
|
||||
- description: Notification ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Notification deleted successfully
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"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'
|
||||
summary: Delete notification
|
||||
tags:
|
||||
- Admin-Notification
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve a specific notification by its ID
|
||||
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'
|
||||
summary: Get notification by ID
|
||||
tags:
|
||||
- Admin-Notification
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Update an existing notification
|
||||
parameters:
|
||||
- description: Notification ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated notification information
|
||||
in: body
|
||||
name: notification
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_notification.NotificationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Notification updated successfully
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
"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'
|
||||
summary: Update notification
|
||||
tags:
|
||||
- Admin-Notification
|
||||
/admin/v1/profile:
|
||||
get:
|
||||
consumes:
|
||||
@@ -4909,6 +5282,10 @@ tags:
|
||||
- description: Administrative flag management operations for web panel including flag
|
||||
listing and retrieval
|
||||
name: Admin-Flags
|
||||
- description: Administrative notification management operations for web panel including
|
||||
CRUD operations, bulk notifications, queue management, and comprehensive filtering
|
||||
with pagination
|
||||
name: Admin-Notification
|
||||
- description: Customer authentication and authorization operations for mobile application
|
||||
including login, logout, token refresh, and profile access
|
||||
name: Authorization
|
||||
|
||||
Reference in New Issue
Block a user