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:
n.nakhostin
2025-09-21 11:26:54 +03:30
parent 0f981880b5
commit 5906904caf
12 changed files with 1200 additions and 45 deletions
+323 -9
View File
@@ -2613,6 +2613,55 @@
}
}
},
"/admin/v1/notifications/mark-seen/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mark a notification as seen",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Notification"
],
"summary": "Mark a notification as seen",
"parameters": [
{
"type": "string",
"description": "Notification ID",
"name": "id",
"in": "path",
"required": true
}
],
"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"
}
}
}
}
},
"/admin/v1/notifications/my": {
"get": {
"security": [
@@ -2733,6 +2782,73 @@
}
}
},
"/admin/v1/notifications/view/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get detailed information about a specific notification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Notification"
],
"summary": "Get notification details",
"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"
}
}
}
}
},
"/admin/v1/profile": {
"get": {
"security": [
@@ -5251,7 +5367,7 @@
}
}
},
"/api/v1/notifications/my": {
"/api/v1/notifications": {
"get": {
"security": [
{
@@ -5371,6 +5487,122 @@
}
}
},
"/api/v1/notifications/mark-seen/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mark a notification as seen",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "Mark a notification as seen",
"parameters": [
{
"type": "string",
"description": "Notification ID",
"name": "id",
"in": "path",
"required": true
}
],
"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"
}
}
}
}
},
"/api/v1/notifications/view/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get detailed information about a specific notification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "Get notification details",
"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/notification.DetailedNotificationResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/api/v1/profile": {
"get": {
"security": [
@@ -7291,10 +7523,6 @@
"type": "string",
"example": "User"
},
"password": {
"type": "string",
"example": "User!1234"
},
"phone": {
"type": "string",
"example": "+1234567890"
@@ -7621,9 +7849,6 @@
"type": "object",
"properties": {
"created_at": {
"type": "integer"
},
"description": {
"type": "string"
},
"event_type": {
@@ -7632,9 +7857,18 @@
"id": {
"type": "string"
},
"image": {
"type": "string"
},
"is_scheduled": {
"type": "boolean"
},
"link": {
"type": "string"
},
"message": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {}
@@ -7651,6 +7885,15 @@
"schedule_at": {
"type": "integer"
},
"scheduled_at": {
"type": "integer"
},
"seen": {
"type": "boolean"
},
"seen_at": {
"type": "integer"
},
"status": {
"type": "string"
},
@@ -7661,7 +7904,7 @@
"type": "string"
},
"updated_at": {
"type": "integer"
"type": "string"
},
"user_id": {
"type": "string"
@@ -7679,6 +7922,77 @@
"DeliveryChannelEmail"
]
},
"notification.DetailedNotificationResponse": {
"type": "object",
"properties": {
"data": {
"type": "object",
"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": {
"type": "object",
"additionalProperties": {}
},
"methods": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"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"
}
}
}
}
},
"notification.NotificationPriority": {
"type": "string",
"enum": [