Add Notification Filters and AllMarkSeen Endpoint to API Documentation

- Introduced new query parameters for filtering notifications by 'seen' status and 'priority' in the API documentation, enhancing the flexibility of notification retrieval.
- Added a new endpoint to mark all notifications as seen for a user, including detailed Swagger documentation for the new functionality.
- Updated existing API documentation to reflect the changes, ensuring clarity for API consumers and improving overall documentation quality.
This commit is contained in:
n.nakhostin
2025-09-22 13:05:10 +03:30
parent ef9ad22841
commit fe70c7170b
4 changed files with 230 additions and 0 deletions
+85
View File
@@ -2499,6 +2499,18 @@ const docTemplate = `{
"name": "recipient",
"in": "query"
},
{
"type": "boolean",
"description": "Seen filter",
"name": "seen",
"in": "query"
},
{
"type": "string",
"description": "Priority filter",
"name": "priority",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -2717,6 +2729,18 @@ const docTemplate = `{
"name": "recipient",
"in": "query"
},
{
"type": "boolean",
"description": "Seen filter",
"name": "seen",
"in": "query"
},
{
"type": "string",
"description": "Priority filter",
"name": "priority",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -5422,6 +5446,18 @@ const docTemplate = `{
"name": "recipient",
"in": "query"
},
{
"type": "boolean",
"description": "Seen filter",
"name": "seen",
"in": "query"
},
{
"type": "string",
"description": "Priority filter",
"name": "priority",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -5493,6 +5529,55 @@ const docTemplate = `{
}
}
},
"/api/v1/notifications/all-seen/{user_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mark all notifications as seen for a user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "Mark all notifications as seen for a user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_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/mark-seen/{id}": {
"get": {
"security": [
+85
View File
@@ -2493,6 +2493,18 @@
"name": "recipient",
"in": "query"
},
{
"type": "boolean",
"description": "Seen filter",
"name": "seen",
"in": "query"
},
{
"type": "string",
"description": "Priority filter",
"name": "priority",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -2711,6 +2723,18 @@
"name": "recipient",
"in": "query"
},
{
"type": "boolean",
"description": "Seen filter",
"name": "seen",
"in": "query"
},
{
"type": "string",
"description": "Priority filter",
"name": "priority",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -5416,6 +5440,18 @@
"name": "recipient",
"in": "query"
},
{
"type": "boolean",
"description": "Seen filter",
"name": "seen",
"in": "query"
},
{
"type": "string",
"description": "Priority filter",
"name": "priority",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -5487,6 +5523,55 @@
}
}
},
"/api/v1/notifications/all-seen/{user_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mark all notifications as seen for a user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "Mark all notifications as seen for a user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_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/mark-seen/{id}": {
"get": {
"security": [
+55
View File
@@ -2849,6 +2849,14 @@ paths:
in: query
name: recipient
type: string
- description: Seen filter
in: query
name: seen
type: boolean
- description: Priority filter
in: query
name: priority
type: string
- description: Limit results
in: query
name: limit
@@ -2986,6 +2994,14 @@ paths:
in: query
name: recipient
type: string
- description: Seen filter
in: query
name: seen
type: boolean
- description: Priority filter
in: query
name: priority
type: string
- description: Limit results
in: query
name: limit
@@ -4670,6 +4686,14 @@ paths:
in: query
name: recipient
type: string
- description: Seen filter
in: query
name: seen
type: boolean
- description: Priority filter
in: query
name: priority
type: string
- description: Limit results
in: query
name: limit
@@ -4719,6 +4743,37 @@ paths:
summary: Get notifications for the user
tags:
- Notification
/api/v1/notifications/all-seen/{user_id}:
get:
consumes:
- application/json
description: Mark all notifications as seen for a user
parameters:
- description: User ID
in: path
name: user_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 all notifications as seen for a user
tags:
- Notification
/api/v1/notifications/mark-seen/{id}:
get:
consumes:
+5
View File
@@ -2,6 +2,11 @@ package customer
import "tm/pkg/response"
// DeviceTokenForm represents the form for adding a device token to a customer
type DeviceTokenForm struct {
DeviceToken string `json:"device_token" valid:"required" example:"device_token"`
}
// CreateCustomerForm represents the form for creating a new customer
type CreateCustomerForm struct {
FullName *string `json:"full_name,omitempty" valid:"optional,length(2|100)" example:"User"`