Update Swagger Documentation for CMS Endpoints

- Refactored API paths to replace "companies" with "cms" for better alignment with CMS management functionality.
- Updated descriptions, parameters, and responses for CMS-related endpoints to reflect new functionality, including search, create, retrieve, update, and delete operations.
- Enhanced the Swagger documentation to include detailed definitions for CMS entities, forms, and responses, ensuring comprehensive API specifications.
- Improved consistency in naming conventions and descriptions across the CMS API endpoints.
This commit is contained in:
n.nakhostin
2025-11-04 11:15:48 +03:30
parent 9a444a1e7d
commit cdd636485d
3 changed files with 2102 additions and 18 deletions
+520 -6
View File
@@ -22,6 +22,260 @@ definitions:
example: 2.0.0
type: string
type: object
cms.CMSForm:
properties:
advantages:
$ref: '#/definitions/cms.cardSectionForm'
challenges:
$ref: '#/definitions/cms.cardSectionForm'
chart:
$ref: '#/definitions/cms.chartSectionForm'
contact:
$ref: '#/definitions/cms.contactSectionForm'
features:
$ref: '#/definitions/cms.cardSectionForm'
footer:
$ref: '#/definitions/cms.footerSectionForm'
hero:
$ref: '#/definitions/cms.heroSectionForm'
key:
example: SW-001
type: string
type: object
cms.CMSListResponse:
properties:
cms:
items:
$ref: '#/definitions/cms.CMSResponse'
type: array
type: object
cms.CMSResponse:
properties:
advantages:
$ref: '#/definitions/cms.cardSection'
challenges:
$ref: '#/definitions/cms.cardSection'
chart:
$ref: '#/definitions/cms.chartSection'
contact:
$ref: '#/definitions/cms.contactSection'
created_at:
type: integer
features:
$ref: '#/definitions/cms.cardSection'
footer:
$ref: '#/definitions/cms.footerSection'
hero:
$ref: '#/definitions/cms.heroSection'
id:
type: string
key:
type: string
updated_at:
type: integer
type: object
cms.card:
properties:
description:
type: string
icon:
type: string
title:
type: string
type: object
cms.cardForm:
properties:
description:
example: Card Description
type: string
icon:
example: https://example.com/icon.png
type: string
title:
example: Card Title
type: string
type: object
cms.cardSection:
properties:
cards:
items:
$ref: '#/definitions/cms.card'
type: array
description:
type: string
title:
type: string
type: object
cms.cardSectionForm:
properties:
cards:
items:
$ref: '#/definitions/cms.cardForm'
type: array
description:
example: Card Description
type: string
title:
example: Card Title
type: string
type: object
cms.chartPoint:
properties:
key:
type: string
value:
type: integer
type: object
cms.chartPointForm:
properties:
key:
example: Key
type: string
value:
example: 1000000
type: integer
type: object
cms.chartSection:
properties:
data:
items:
$ref: '#/definitions/cms.chartPoint'
type: array
missedAmount:
type: string
title:
type: string
type: object
cms.chartSectionForm:
properties:
data:
items:
$ref: '#/definitions/cms.chartPointForm'
type: array
missed_amount:
example: Missed Amount
type: string
title:
example: Chart Title
type: string
type: object
cms.contactSection:
properties:
description:
type: string
fields:
items:
$ref: '#/definitions/cms.formField'
type: array
submitButtonText:
type: string
title:
type: string
type: object
cms.contactSectionForm:
properties:
description:
example: Contact Description
type: string
fields:
items:
$ref: '#/definitions/cms.formFieldForm'
type: array
submit_button_text:
example: Submit Button Text
type: string
title:
example: Contact Title
type: string
type: object
cms.footerSection:
properties:
copyright:
type: string
email:
type: string
location:
type: string
phone:
type: string
tagline:
type: string
type: object
cms.footerSectionForm:
properties:
copyright:
example: Copyright
type: string
email:
example: info@example.com
type: string
location:
example: Location
type: string
phone:
example: "+1234567890"
type: string
tagline:
example: Tagline
type: string
type: object
cms.formField:
properties:
label:
type: string
name:
type: string
placeholder:
type: string
required:
type: boolean
type: object
cms.formFieldForm:
properties:
label:
example: Label
type: string
name:
example: Name
type: string
placeholder:
example: Placeholder
type: string
required:
example: true
type: boolean
type: object
cms.heroSection:
properties:
buttonLink:
type: string
buttonText:
type: string
description:
type: string
gifFile:
type: string
title:
type: string
type: object
cms.heroSectionForm:
properties:
button_link:
example: https://example.com
type: string
button_text:
example: Button Text
type: string
description:
example: Hero Description
type: string
gif_file:
example: https://example.com/gif.gif
type: string
title:
example: Hero Title
type: string
type: object
company.Address:
properties:
city:
@@ -1424,6 +1678,220 @@ info:
title: Opplens API
version: 1.0.0
paths:
/admin/v1/cms:
get:
consumes:
- application/json
description: Search CMS entries with filters and pagination (admin only)
parameters:
- description: Search query
in: query
name: q
type: string
- description: CMS key filter
in: query
name: key
type: string
- default: 20
description: Number of CMS entries per page (1-100)
in: query
maximum: 100
minimum: 1
name: limit
type: integer
- default: 0
description: Number of CMS entries to skip for pagination
in: query
minimum: 0
name: offset
type: integer
- default: created_at
description: Field to sort by
enum:
- key
- created_at
- updated_at
in: query
name: sort_by
type: string
- default: desc
description: Sort order
enum:
- 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/cms.CMSListResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Search CMS entries
tags:
- Admin-CMS
post:
consumes:
- application/json
description: Create a new CMS entry for content management (admin only)
parameters:
- description: CMS information
in: body
name: cms
required: true
schema:
$ref: '#/definitions/cms.CMSForm'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/cms.CMSResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"409":
description: Conflict
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Create a new CMS entry
tags:
- Admin-CMS
/admin/v1/cms/{id}:
delete:
consumes:
- application/json
description: Delete a CMS entry by its ID (admin only)
parameters:
- description: CMS ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
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 CMS entry
tags:
- Admin-CMS
get:
consumes:
- application/json
description: Retrieve a CMS entry by its ID for editing (admin only)
parameters:
- description: CMS 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/cms.CMSResponse'
type: object
"404":
description: Not Found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Get CMS by ID
tags:
- Admin-CMS
put:
consumes:
- application/json
description: Update an existing CMS entry by its ID (admin only)
parameters:
- description: CMS ID
in: path
name: id
required: true
type: string
- description: Updated CMS information
in: body
name: cms
required: true
schema:
$ref: '#/definitions/cms.CMSForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/cms.CMSResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.APIResponse'
"409":
description: Conflict
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Update CMS entry
tags:
- Admin-CMS
/admin/v1/companies:
get:
consumes:
@@ -2149,7 +2617,7 @@ paths:
$ref: '#/definitions/response.APIResponse'
summary: Search contacts
tags:
- contacts
- Admin-Contacts
/admin/v1/contacts/{id}:
delete:
consumes:
@@ -2182,7 +2650,7 @@ paths:
$ref: '#/definitions/response.APIResponse'
summary: Delete contact
tags:
- contacts
- Admin-Contacts
get:
consumes:
- application/json
@@ -2219,7 +2687,7 @@ paths:
$ref: '#/definitions/response.APIResponse'
summary: Get contact by ID
tags:
- contacts
- Admin-Contacts
/admin/v1/contacts/{id}/status:
put:
consumes:
@@ -2258,7 +2726,7 @@ paths:
$ref: '#/definitions/response.APIResponse'
summary: Update contact status
tags:
- contacts
- Admin-Contacts
/admin/v1/contacts/stats:
get:
consumes:
@@ -2282,7 +2750,7 @@ paths:
$ref: '#/definitions/response.APIResponse'
summary: Get contact statistics
tags:
- contacts
- Admin-Contacts
/admin/v1/customers:
get:
consumes:
@@ -4567,6 +5035,40 @@ paths:
summary: Get flag SVG
tags:
- Flags
/api/v1/cms/{key}:
get:
consumes:
- application/json
description: Retrieve CMS content for public display by its key
parameters:
- description: CMS key
in: path
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/cms.CMSResponse'
type: object
"404":
description: Not Found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Get CMS content by key
tags:
- CMS
/api/v1/companies:
get:
consumes:
@@ -4632,7 +5134,7 @@ paths:
$ref: '#/definitions/response.APIResponse'
summary: Create a new contact message
tags:
- contacts
- Contacts
/api/v1/feedback:
get:
consumes:
@@ -6043,6 +6545,12 @@ tags:
CRUD operations, bulk notifications, queue management, and comprehensive filtering
with pagination
name: Admin-Notification
- description: Administrative contact management operations for web panel including
CRUD operations, search, statistics, and comprehensive filtering with pagination
name: Admin-Contacts
- description: Administrative CMS management operations for web panel including CRUD
operations, search, statistics, and comprehensive filtering with pagination
name: Admin-CMS
- description: Customer authentication and authorization operations for mobile application
including login, logout, token refresh, and profile access
name: Authorization
@@ -6067,3 +6575,9 @@ tags:
- description: Public notification management operations for mobile application including
notification listing and detailed notification information
name: Notification
- description: Public contact management operations for mobile application including
contact submission and contact listing
name: Contacts
- description: Public CMS management operations for mobile application including CMS
listing and detailed CMS information
name: CMS