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:
+576
-2
@@ -1454,6 +1454,88 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/v1/customers/{id}/role": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Assign a role (admin or analyst) to a customer",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin-Customers"
|
||||
],
|
||||
"summary": "Assign role to customer",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Customer ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Role assignment information",
|
||||
"name": "role",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/customer.AssignRoleForm"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Role assigned successfully",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/customer.AssignRoleResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/v1/customers/{id}/status": {
|
||||
"patch": {
|
||||
"security": [
|
||||
@@ -2298,6 +2380,325 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/v1/notifications": {
|
||||
"get": {
|
||||
"description": "Retrieve notifications for a specific user with filtering and pagination",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin-Notification"
|
||||
],
|
||||
"summary": "Get user notifications",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient",
|
||||
"name": "recipient",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Notification type (info, warning, alert, reject)",
|
||||
"name": "type",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Notification priority (low, medium, important)",
|
||||
"name": "priority",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Delivery status (pending, sent, failed)",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "Read status",
|
||||
"name": "is_read",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"description": "Page number",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 20,
|
||||
"description": "Items per page",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "created_at",
|
||||
"description": "Sort field",
|
||||
"name": "sort_by",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "desc",
|
||||
"description": "Sort order (asc, desc)",
|
||||
"name": "sort_order",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/notification.NotificationsResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "Create a new notification with the provided information",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin-Notification"
|
||||
],
|
||||
"summary": "Create a new notification",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Notification information",
|
||||
"name": "notification",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_notification.NotificationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/v1/notifications/{id}": {
|
||||
"get": {
|
||||
"description": "Retrieve a specific notification by its ID",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin-Notification"
|
||||
],
|
||||
"summary": "Get notification by ID",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Notification ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/internal_notification.NotificationResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "Update an existing notification",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin-Notification"
|
||||
],
|
||||
"summary": "Update notification",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Notification ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Updated notification information",
|
||||
"name": "notification",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_notification.NotificationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "Delete a specific notification",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin-Notification"
|
||||
],
|
||||
"summary": "Delete notification",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Notification ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/v1/profile": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -6491,6 +6892,28 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"customer.AssignRoleForm": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"role": {
|
||||
"type": "string",
|
||||
"example": "analyst"
|
||||
}
|
||||
}
|
||||
},
|
||||
"customer.AssignRoleResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "Role assigned successfully"
|
||||
},
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"customer.AuthResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -6544,6 +6967,10 @@
|
||||
"type": "string",
|
||||
"example": "+1234567890"
|
||||
},
|
||||
"role": {
|
||||
"type": "string",
|
||||
"example": "analyst"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"example": "individual"
|
||||
@@ -6595,10 +7022,10 @@
|
||||
"last_login_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"password": {
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"role": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
@@ -6709,6 +7136,10 @@
|
||||
"type": "string",
|
||||
"example": "+1234567890"
|
||||
},
|
||||
"role": {
|
||||
"type": "string",
|
||||
"example": "analyst"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"example": "individual"
|
||||
@@ -6968,6 +7399,145 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_notification.NotificationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channels": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/notification.DeliveryChannel"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"link": {
|
||||
"type": "string"
|
||||
},
|
||||
"priority": {
|
||||
"$ref": "#/definitions/notification.NotificationPriority"
|
||||
},
|
||||
"recipient": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"schedule": {
|
||||
"$ref": "#/definitions/notification.ScheduleRequest"
|
||||
},
|
||||
"tender": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/notification.NotificationType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_notification.NotificationResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channels": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/notification.DeliveryChannel"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification.DeliveryChannel": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"push",
|
||||
"email"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"DeliveryChannelPush",
|
||||
"DeliveryChannelEmail"
|
||||
]
|
||||
},
|
||||
"notification.NotificationPriority": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"low",
|
||||
"medium",
|
||||
"important"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"NotificationPriorityLow",
|
||||
"NotificationPriorityMedium",
|
||||
"NotificationPriorityImportant"
|
||||
]
|
||||
},
|
||||
"notification.NotificationType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"info",
|
||||
"warning",
|
||||
"alert",
|
||||
"reject"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"NotificationTypeInfo",
|
||||
"NotificationTypeWarning",
|
||||
"NotificationTypeAlert",
|
||||
"NotificationTypeReject"
|
||||
]
|
||||
},
|
||||
"notification.NotificationsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"notifications": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/internal_notification.NotificationResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification.ScheduleRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"time": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification.ScheduleResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"time": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response.APIError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -7669,6 +8239,10 @@
|
||||
"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