Add Inquiry Management Functionality and Update API Documentation

- Introduced a new inquiry management feature, including CRUD operations for inquiries in both admin and public API endpoints.
- Implemented inquiry entity, service, repository, and handler layers following the clean architecture principles.
- Added new API routes for searching, retrieving, updating, and deleting inquiries, enhancing the overall functionality of the system.
- Updated Swagger documentation to include detailed descriptions and examples for the new inquiry endpoints, ensuring clarity for API consumers.
- Enhanced error handling for duplicate inquiries and validation, improving the robustness of the inquiry management process.
- Updated existing routes to integrate inquiry handling, ensuring a seamless user experience across the application.
This commit is contained in:
n.nakhostin
2025-09-07 14:36:16 +03:30
parent 34064e8b36
commit 857e911d40
11 changed files with 2255 additions and 5 deletions
+316
View File
@@ -630,6 +630,83 @@ definitions:
- feedback_type
- tender_id
type: object
inquiry.CreateInquiryForm:
properties:
company_name:
description: Company name
example: Opplens
type: string
full_name:
description: Full name of the inquirer
example: John Doe
type: string
phone_number:
description: Phone number
example: "+1234567890"
type: string
work_email:
description: Work email address
example: info@opplens.com
type: string
type: object
inquiry.InquiryListResponse:
properties:
inquiries:
items:
$ref: '#/definitions/inquiry.InquiryResponse'
type: array
meta:
$ref: '#/definitions/response.Meta'
type: object
inquiry.InquiryResponse:
properties:
company_name:
type: string
created_at:
type: integer
full_name:
type: string
id:
type: string
phone_number:
type: string
status:
type: string
status_history:
items:
$ref: '#/definitions/inquiry.StatusHistoryResponse'
type: array
updated_at:
type: integer
work_email:
type: string
type: object
inquiry.StatusHistoryResponse:
properties:
changed_at:
type: integer
description:
type: string
reason:
type: string
status:
type: string
type: object
inquiry.UpdateInquiryStatusForm:
properties:
description:
description: Optional description
example: Additional notes about the review
type: string
reason:
description: Reason for status change
example: Initial review completed
type: string
status:
description: New status
example: reviewed
type: string
type: object
response.APIError:
properties:
code:
@@ -2825,6 +2902,191 @@ paths:
summary: Health check endpoint
tags:
- Admin-Health
/admin/v1/inquiries:
get:
consumes:
- application/json
description: Search and filter inquiries with pagination support. This endpoint
allows administrators to find inquiries based on various criteria including
name, company, email, status, and other filters.
parameters:
- description: Search term for full name, company name, or email
in: query
name: q
type: string
- description: Filter by status (pending, reviewed, approved, rejected)
in: query
name: status
type: string
- description: Limit results (1-100)
in: query
name: limit
type: integer
- description: Offset results
in: query
name: offset
type: integer
- description: Sort field (full_name, company_name, work_email, status, created_at)
in: query
name: sort_by
type: string
- description: Sort order (asc, desc)
in: query
name: sort_order
type: string
produces:
- application/json
responses:
"200":
description: Inquiries retrieved successfully with pagination metadata
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/inquiry.InquiryListResponse'
type: object
"400":
description: Bad request - Invalid query parameters
schema:
$ref: '#/definitions/response.APIResponse'
"422":
description: Validation error - Invalid parameter values
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Search inquiries
tags:
- Admin-Inquiries
/admin/v1/inquiries/{id}:
delete:
consumes:
- application/json
description: Delete an inquiry permanently from the system. This action cannot
be undone and will remove all inquiry data including contact information,
status history, and timestamps.
parameters:
- description: Inquiry ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Inquiry deleted successfully
schema:
$ref: '#/definitions/response.APIResponse'
"400":
description: Bad request - Invalid inquiry ID format
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Inquiry with specified ID not found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Delete inquiry
tags:
- Admin-Inquiries
get:
consumes:
- application/json
description: Retrieve detailed information about a specific inquiry by its unique
identifier. This endpoint provides complete inquiry details including contact
information, status, and status history.
parameters:
- description: Inquiry ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Inquiry retrieved successfully with complete details
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/inquiry.InquiryResponse'
type: object
"400":
description: Bad request - Invalid inquiry ID format
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Inquiry with specified ID not found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Get inquiry by ID
tags:
- Admin-Inquiries
/admin/v1/inquiries/{id}/status:
put:
consumes:
- application/json
description: 'Update the status of an inquiry with reason and optional description.
This endpoint allows administrators to change inquiry status following the
defined workflow: pending -> reviewed -> approved/rejected.'
parameters:
- description: Inquiry ID
in: path
name: id
required: true
type: string
- description: Status update information including new status, reason, and optional
description
in: body
name: status
required: true
schema:
$ref: '#/definitions/inquiry.UpdateInquiryStatusForm'
produces:
- application/json
responses:
"200":
description: Inquiry status updated successfully with updated details
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/inquiry.InquiryResponse'
type: object
"400":
description: Bad request - Invalid inquiry ID format or invalid status transition
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Inquiry with specified ID not found
schema:
$ref: '#/definitions/response.APIResponse'
"422":
description: Validation error - Invalid data format or validation rules
not met
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Update inquiry status
tags:
- Admin-Inquiries
/admin/v1/profile:
get:
consumes:
@@ -4096,6 +4358,54 @@ paths:
summary: Get feedback by tender ID
tags:
- Feedback
/api/v1/inquiries:
post:
consumes:
- application/json
description: Create a new inquiry with contact information for potential business
opportunities. This endpoint allows external users to submit inquiries about
services or partnerships. Duplicate submissions are prevented based on email
and phone number.
parameters:
- description: Inquiry information including contact details and company information
in: body
name: inquiry
required: true
schema:
$ref: '#/definitions/inquiry.CreateInquiryForm'
produces:
- application/json
responses:
"201":
description: Inquiry created successfully with assigned ID and timestamps
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/inquiry.InquiryResponse'
type: object
"400":
description: Bad request - Invalid input data or missing required fields
schema:
$ref: '#/definitions/response.APIResponse'
"409":
description: Conflict - Duplicate inquiry already exists with same email
or phone number
schema:
$ref: '#/definitions/response.APIResponse'
"422":
description: Validation error - Invalid data format or validation rules
not met
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Create new inquiry
tags:
- Inquiries
/api/v1/profile:
get:
consumes:
@@ -4657,6 +4967,9 @@ tags:
including CRUD operations, search, statistics, and comprehensive filtering with
pagination
name: Admin-TenderApprovals
- description: Administrative inquiry management operations for web panel including
CRUD operations, search, statistics, and comprehensive filtering with pagination
name: Admin-Inquiries
- description: Customer authentication and authorization operations for mobile application
including login, logout, token refresh, and profile access
name: Authorization
@@ -4672,3 +4985,6 @@ tags:
- description: Public tender approval management operations for mobile application
including tender approval listing and detailed tender approval information
name: TenderApprovals
- description: Public inquiry management operations for mobile application including
inquiry submission and inquiry listing
name: Inquiries