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
+467
View File
@@ -2765,6 +2765,284 @@ const docTemplate = `{
}
}
},
"/admin/v1/inquiries": {
"get": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Search inquiries",
"parameters": [
{
"type": "string",
"description": "Search term for full name, company name, or email",
"name": "q",
"in": "query"
},
{
"type": "string",
"description": "Filter by status (pending, reviewed, approved, rejected)",
"name": "status",
"in": "query"
},
{
"type": "integer",
"description": "Limit results (1-100)",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset results",
"name": "offset",
"in": "query"
},
{
"type": "string",
"description": "Sort field (full_name, company_name, work_email, status, created_at)",
"name": "sort_by",
"in": "query"
},
{
"type": "string",
"description": "Sort order (asc, desc)",
"name": "sort_order",
"in": "query"
}
],
"responses": {
"200": {
"description": "Inquiries retrieved successfully with pagination metadata",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryListResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/admin/v1/inquiries/{id}": {
"get": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Get inquiry by ID",
"parameters": [
{
"type": "string",
"description": "Inquiry ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Inquiry retrieved successfully with complete details",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
}
}
]
}
},
"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"
}
}
}
},
"delete": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Delete inquiry",
"parameters": [
{
"type": "string",
"description": "Inquiry ID",
"name": "id",
"in": "path",
"required": true
}
],
"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"
}
}
}
}
},
"/admin/v1/inquiries/{id}/status": {
"put": {
"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 -\u003e reviewed -\u003e approved/rejected.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Update inquiry status",
"parameters": [
{
"type": "string",
"description": "Inquiry ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Status update information including new status, reason, and optional description",
"name": "status",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/inquiry.UpdateInquiryStatusForm"
}
}
],
"responses": {
"200": {
"description": "Inquiry status updated successfully with updated details",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/admin/v1/profile": {
"get": {
"security": [
@@ -4820,6 +5098,76 @@ const docTemplate = `{
}
}
},
"/api/v1/inquiries": {
"post": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Inquiries"
],
"summary": "Create new inquiry",
"parameters": [
{
"description": "Inquiry information including contact details and company information",
"name": "inquiry",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/inquiry.CreateInquiryForm"
}
}
],
"responses": {
"201": {
"description": "Inquiry created successfully with assigned ID and timestamps",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/api/v1/profile": {
"get": {
"security": [
@@ -6624,6 +6972,117 @@ const docTemplate = `{
}
}
},
"inquiry.CreateInquiryForm": {
"type": "object",
"properties": {
"company_name": {
"description": "Company name",
"type": "string",
"example": "Opplens"
},
"full_name": {
"description": "Full name of the inquirer",
"type": "string",
"example": "John Doe"
},
"phone_number": {
"description": "Phone number",
"type": "string",
"example": "+1234567890"
},
"work_email": {
"description": "Work email address",
"type": "string",
"example": "info@opplens.com"
}
}
},
"inquiry.InquiryListResponse": {
"type": "object",
"properties": {
"inquiries": {
"type": "array",
"items": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
},
"meta": {
"$ref": "#/definitions/response.Meta"
}
}
},
"inquiry.InquiryResponse": {
"type": "object",
"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": {
"type": "array",
"items": {
"$ref": "#/definitions/inquiry.StatusHistoryResponse"
}
},
"updated_at": {
"type": "integer"
},
"work_email": {
"type": "string"
}
}
},
"inquiry.StatusHistoryResponse": {
"type": "object",
"properties": {
"changed_at": {
"type": "integer"
},
"description": {
"type": "string"
},
"reason": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"inquiry.UpdateInquiryStatusForm": {
"type": "object",
"properties": {
"description": {
"description": "Optional description",
"type": "string",
"example": "Additional notes about the review"
},
"reason": {
"description": "Reason for status change",
"type": "string",
"example": "Initial review completed"
},
"status": {
"description": "New status",
"type": "string",
"example": "reviewed"
}
}
},
"response.APIError": {
"type": "object",
"properties": {
@@ -7305,6 +7764,10 @@ const docTemplate = `{
"description": "Administrative tender approval management operations for web panel 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"
@@ -7324,6 +7787,10 @@ const docTemplate = `{
{
"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"
}
]
}`
+467
View File
@@ -2759,6 +2759,284 @@
}
}
},
"/admin/v1/inquiries": {
"get": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Search inquiries",
"parameters": [
{
"type": "string",
"description": "Search term for full name, company name, or email",
"name": "q",
"in": "query"
},
{
"type": "string",
"description": "Filter by status (pending, reviewed, approved, rejected)",
"name": "status",
"in": "query"
},
{
"type": "integer",
"description": "Limit results (1-100)",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset results",
"name": "offset",
"in": "query"
},
{
"type": "string",
"description": "Sort field (full_name, company_name, work_email, status, created_at)",
"name": "sort_by",
"in": "query"
},
{
"type": "string",
"description": "Sort order (asc, desc)",
"name": "sort_order",
"in": "query"
}
],
"responses": {
"200": {
"description": "Inquiries retrieved successfully with pagination metadata",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryListResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/admin/v1/inquiries/{id}": {
"get": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Get inquiry by ID",
"parameters": [
{
"type": "string",
"description": "Inquiry ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Inquiry retrieved successfully with complete details",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
}
}
]
}
},
"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"
}
}
}
},
"delete": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Delete inquiry",
"parameters": [
{
"type": "string",
"description": "Inquiry ID",
"name": "id",
"in": "path",
"required": true
}
],
"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"
}
}
}
}
},
"/admin/v1/inquiries/{id}/status": {
"put": {
"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 -\u003e reviewed -\u003e approved/rejected.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Inquiries"
],
"summary": "Update inquiry status",
"parameters": [
{
"type": "string",
"description": "Inquiry ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Status update information including new status, reason, and optional description",
"name": "status",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/inquiry.UpdateInquiryStatusForm"
}
}
],
"responses": {
"200": {
"description": "Inquiry status updated successfully with updated details",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/admin/v1/profile": {
"get": {
"security": [
@@ -4814,6 +5092,76 @@
}
}
},
"/api/v1/inquiries": {
"post": {
"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.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Inquiries"
],
"summary": "Create new inquiry",
"parameters": [
{
"description": "Inquiry information including contact details and company information",
"name": "inquiry",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/inquiry.CreateInquiryForm"
}
}
],
"responses": {
"201": {
"description": "Inquiry created successfully with assigned ID and timestamps",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/api/v1/profile": {
"get": {
"security": [
@@ -6618,6 +6966,117 @@
}
}
},
"inquiry.CreateInquiryForm": {
"type": "object",
"properties": {
"company_name": {
"description": "Company name",
"type": "string",
"example": "Opplens"
},
"full_name": {
"description": "Full name of the inquirer",
"type": "string",
"example": "John Doe"
},
"phone_number": {
"description": "Phone number",
"type": "string",
"example": "+1234567890"
},
"work_email": {
"description": "Work email address",
"type": "string",
"example": "info@opplens.com"
}
}
},
"inquiry.InquiryListResponse": {
"type": "object",
"properties": {
"inquiries": {
"type": "array",
"items": {
"$ref": "#/definitions/inquiry.InquiryResponse"
}
},
"meta": {
"$ref": "#/definitions/response.Meta"
}
}
},
"inquiry.InquiryResponse": {
"type": "object",
"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": {
"type": "array",
"items": {
"$ref": "#/definitions/inquiry.StatusHistoryResponse"
}
},
"updated_at": {
"type": "integer"
},
"work_email": {
"type": "string"
}
}
},
"inquiry.StatusHistoryResponse": {
"type": "object",
"properties": {
"changed_at": {
"type": "integer"
},
"description": {
"type": "string"
},
"reason": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"inquiry.UpdateInquiryStatusForm": {
"type": "object",
"properties": {
"description": {
"description": "Optional description",
"type": "string",
"example": "Additional notes about the review"
},
"reason": {
"description": "Reason for status change",
"type": "string",
"example": "Initial review completed"
},
"status": {
"description": "New status",
"type": "string",
"example": "reviewed"
}
}
},
"response.APIError": {
"type": "object",
"properties": {
@@ -7299,6 +7758,10 @@
"description": "Administrative tender approval management operations for web panel 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"
@@ -7318,6 +7781,10 @@
{
"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"
}
]
}
+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
+12 -3
View File
@@ -44,6 +44,9 @@ package main
// @tag.name Admin-TenderApprovals
// @tag.description Administrative tender approval management operations for web panel including CRUD operations, search, statistics, and comprehensive filtering with pagination
// @tag.name Admin-Inquiries
// @tag.description Administrative inquiry management operations for web panel including CRUD operations, search, statistics, and comprehensive filtering with pagination
// @tag.name Authorization
// @tag.description Customer authentication and authorization operations for mobile application including login, logout, token refresh, and profile access
@@ -59,6 +62,9 @@ package main
// @tag.name TenderApprovals
// @tag.description Public tender approval management operations for mobile application including tender approval listing and detailed tender approval information
// @tag.name Inquiries
// @tag.description Public inquiry management operations for mobile application including inquiry submission and inquiry listing
import (
"context"
"fmt"
@@ -67,6 +73,7 @@ import (
"tm/internal/company"
"tm/internal/customer"
"tm/internal/feedback"
"tm/internal/inquiry"
"tm/internal/tender"
"tm/internal/tender_approval"
"tm/internal/user"
@@ -115,6 +122,7 @@ func main() {
tenderRepository := tender.NewTenderRepository(mongoManager, logger)
feedbackRepo := feedback.NewFeedbackRepository(mongoManager, logger)
tenderApprovalRepository := tender_approval.NewTenderApprovalRepository(mongoManager, logger)
inquiryRepository := inquiry.NewInquiryRepository(mongoManager, logger)
logger.Info("Repositories initialized successfully", map[string]interface{}{
"repositories": []string{"customer", "user", "company", "tender", "feedback", "tender_approval"},
})
@@ -129,6 +137,7 @@ func main() {
tenderService := tender.NewTenderService(tenderRepository, companyService, logger)
feedbackService := feedback.NewFeedbackService(feedbackRepo, tenderService, logger)
tenderApprovalService := tender_approval.NewTenderApprovalService(tenderApprovalRepository, tenderService, logger)
inquiryService := inquiry.NewInquiryService(inquiryRepository, logger)
logger.Info("Services initialized successfully", map[string]interface{}{
"services": []string{"customer", "user", "company", "tender", "feedback", "tender_approval"},
})
@@ -140,7 +149,7 @@ func main() {
tenderHandler := tender.NewTenderHandler(tenderService, logger)
feedbackHandler := feedback.NewFeedbackHandler(feedbackService, userHandler, customerHandler, logger)
tenderApprovalHandler := tender_approval.NewHandler(tenderApprovalService, logger)
inquiryHandler := inquiry.NewHandler(inquiryService, logger)
logger.Info("Handlers initialized successfully", map[string]interface{}{
"handlers": []string{"customer", "user", "company", "tender", "feedback", "tender_approval"},
})
@@ -149,8 +158,8 @@ func main() {
e := bootstrap.InitHTTPServer(conf, logger)
// Register routes
router.RegisterAdminRoutes(e, userHandler, companyHandler, customerHandler, tenderHandler, feedbackHandler, tenderApprovalHandler)
router.RegisterPublicRoutes(e, customerHandler, tenderHandler, feedbackHandler, tenderApprovalHandler, companyHandler)
router.RegisterAdminRoutes(e, userHandler, companyHandler, customerHandler, tenderHandler, feedbackHandler, tenderApprovalHandler, inquiryHandler)
router.RegisterPublicRoutes(e, customerHandler, tenderHandler, feedbackHandler, tenderApprovalHandler, companyHandler, inquiryHandler)
// Start server
serverAddr := fmt.Sprintf("%s:%d", conf.Server.Host, conf.Server.Port)
+19 -2
View File
@@ -4,6 +4,7 @@ import (
"tm/internal/company"
"tm/internal/customer"
"tm/internal/feedback"
"tm/internal/inquiry"
"tm/internal/tender"
"tm/internal/tender_approval"
"tm/internal/user"
@@ -11,7 +12,7 @@ import (
"github.com/labstack/echo/v4"
)
func RegisterAdminRoutes(e *echo.Echo, userHandler *user.Handler, companyHandler *company.Handler, customerHandler *customer.Handler, tenderHandler *tender.TenderHandler, feedbackHandler *feedback.Handler, tenderApprovalHandler *tender_approval.Handler) {
func RegisterAdminRoutes(e *echo.Echo, userHandler *user.Handler, companyHandler *company.Handler, customerHandler *customer.Handler, tenderHandler *tender.TenderHandler, feedbackHandler *feedback.Handler, tenderApprovalHandler *tender_approval.Handler, inquiryHandler *inquiry.Handler) {
adminV1 := e.Group("/admin/v1")
// Admin Users Routes
@@ -107,9 +108,19 @@ func RegisterAdminRoutes(e *echo.Echo, userHandler *user.Handler, companyHandler
tenderApprovalGP.GET("/submission-mode/:submission_mode", tenderApprovalHandler.GetTenderApprovalsBySubmissionMode)
tenderApprovalGP.GET("/status/:status", tenderApprovalHandler.GetTenderApprovalsByStatus)
}
// Admin Inquiry Routes
inquiryGP := adminV1.Group("/inquiries")
{
inquiryGP.Use(userHandler.AuthMiddleware())
inquiryGP.GET("", inquiryHandler.SearchInquiries)
inquiryGP.GET("/:id", inquiryHandler.GetInquiryByID)
inquiryGP.PUT("/:id/status", inquiryHandler.UpdateInquiryStatus)
inquiryGP.DELETE("/:id", inquiryHandler.DeleteInquiry)
}
}
func RegisterPublicRoutes(e *echo.Echo, customerHandler *customer.Handler, tenderHandler *tender.TenderHandler, feedbackHandler *feedback.Handler, tenderApprovalHandler *tender_approval.Handler, companyHandler *company.Handler) {
func RegisterPublicRoutes(e *echo.Echo, customerHandler *customer.Handler, tenderHandler *tender.TenderHandler, feedbackHandler *feedback.Handler, tenderApprovalHandler *tender_approval.Handler, companyHandler *company.Handler, inquiryHandler *inquiry.Handler) {
v1 := e.Group("/api/v1")
customerGP := v1.Group("/profile")
@@ -160,4 +171,10 @@ func RegisterPublicRoutes(e *echo.Echo, customerHandler *customer.Handler, tende
companiesGP.Use(customerHandler.AuthMiddleware())
companiesGP.GET("", companyHandler.MyCompany)
}
// Public Inquiry Routes
inquiryGP := v1.Group("/inquiries")
{
inquiryGP.POST("", inquiryHandler.CreateInquiry)
}
}