Add Tender Approval Management Functionality and API Enhancements

- Introduced a new tender approval management system, including the creation of tender approval entities, services, and repositories.
- Implemented CRUD operations for tender approvals, allowing companies to approve or reject tenders.
- Developed administrative and public API endpoints for listing, retrieving, and updating tender approvals with comprehensive filtering options.
- Enhanced Swagger documentation to accurately reflect the new endpoints, including detailed descriptions, parameters, and response formats.
- Updated existing routes to include tender approval management, ensuring adherence to Clean Architecture principles and maintaining a clear separation of concerns in the handler layer.
This commit is contained in:
n.nakhostin
2025-08-18 19:00:41 +03:30
parent a8ef631e43
commit 94d0fbef38
14 changed files with 4615 additions and 16 deletions
+998 -2
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+702 -1
View File
@@ -638,8 +638,10 @@ definitions:
customer.LoginForm:
properties:
password:
example: Nima.1998
type: string
username:
example: nakhostin
type: string
type: object
customer.RefreshTokenForm:
@@ -761,10 +763,14 @@ definitions:
enum:
- like
- dislike
- unlike
- undislike
type: string
x-enum-varnames:
- FeedbackTypeLike
- FeedbackTypeDislike
- FeedbackTypeUnLike
- FeedbackTypeUnDislike
feedback.ToggleFeedbackForm:
properties:
feedback_type:
@@ -869,6 +875,8 @@ definitions:
type: integer
status:
$ref: '#/definitions/tender.TenderStatus'
submission_deadline:
type: integer
tender_deadline:
type: integer
title:
@@ -906,6 +914,101 @@ definitions:
title:
type: string
type: object
tender_approval.ApprovalStatus:
enum:
- approved
- rejected
type: string
x-enum-comments:
ApprovalStatusApproved: Company approved the tender
ApprovalStatusRejected: Company rejected the tender
x-enum-descriptions:
- Company approved the tender
- Company rejected the tender
x-enum-varnames:
- ApprovalStatusApproved
- ApprovalStatusRejected
tender_approval.CreateTenderApprovalForm:
properties:
status:
$ref: '#/definitions/tender_approval.ApprovalStatus'
submission_mode:
$ref: '#/definitions/tender_approval.SubmissionMode'
tender_id:
type: string
type: object
tender_approval.SubmissionMode:
enum:
- self-apply
- partnership
type: string
x-enum-comments:
SubmissionModePartnership: Company applies for the tender with a partner
SubmissionModeSelfApply: Company applies for the tender on their own
x-enum-descriptions:
- Company applies for the tender on their own
- Company applies for the tender with a partner
x-enum-varnames:
- SubmissionModeSelfApply
- SubmissionModePartnership
tender_approval.TenderApprovalListResponse:
properties:
limit:
type: integer
offset:
type: integer
tender_approvals:
items:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: array
total:
type: integer
total_pages:
type: integer
type: object
tender_approval.TenderApprovalResponse:
properties:
company_id:
type: string
created_at:
type: integer
id:
type: string
status:
type: string
submission_mode:
type: string
tender_id:
type: string
type: object
tender_approval.TenderApprovalStatsResponse:
properties:
approvals_by_status:
additionalProperties:
format: int64
type: integer
type: object
approvals_by_submission:
additionalProperties:
format: int64
type: integer
type: object
approved_tenders:
type: integer
last_updated:
type: integer
rejected_tenders:
type: integer
total_approvals:
type: integer
type: object
tender_approval.UpdateTenderApprovalForm:
properties:
status:
type: string
submission_mode:
type: string
type: object
user.AuthResponse:
properties:
access_token:
@@ -3582,6 +3685,275 @@ paths:
summary: Initiate password reset process
tags:
- Admin-Authorization
/admin/v1/tender-approvals:
get:
consumes:
- application/json
description: Retrieve a paginated list of tender approvals with filtering options
parameters:
- description: Filter by tender ID
in: query
name: tender_id
type: string
- description: Filter by company ID
in: query
name: company_id
type: string
- description: Filter by status
in: query
name: status
type: array
- description: Filter by submission mode
in: query
name: submission_mode
type: array
- description: Filter by creation date from (Unix timestamp)
in: query
name: created_at_from
type: integer
- description: Filter by creation date to (Unix timestamp)
in: query
name: created_at_to
type: integer
- default: 20
description: Number of approvals per page (1-100)
in: query
maximum: 100
minimum: 1
name: limit
type: integer
- default: 0
description: Number of approvals to skip for pagination
in: query
minimum: 0
name: offset
type: integer
- default: created_at
description: Field to sort by
enum:
- created_at
- updated_at
- status
- submission_mode
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: Tender approvals retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.TenderApprovalListResponse'
type: object
"400":
description: Bad request - Invalid query parameters
schema:
$ref: '#/definitions/response.APIResponse'
"422":
description: Validation error - Invalid query parameters
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: List tender approvals with filters and pagination
tags:
- Admin-TenderApprovals
/admin/v1/tender-approvals/{id}:
get:
consumes:
- application/json
description: Retrieve detailed tender approval information by ID
parameters:
- description: Tender Approval ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Tender approval retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: object
"400":
description: Bad request - Invalid tender approval ID
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Tender approval not found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender approval by ID
tags:
- TenderApprovals
/admin/v1/tender-approvals/stats:
get:
consumes:
- application/json
description: Get comprehensive tender approval statistics for dashboard
produces:
- application/json
responses:
"200":
description: Tender approval statistics retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.TenderApprovalStatsResponse'
type: object
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender approval statistics
tags:
- Admin-TenderApprovals
/admin/v1/tender-approvals/status/{status}:
get:
consumes:
- application/json
description: Retrieve tender approvals filtered by their status (approved, rejected)
parameters:
- description: Tender approval status
enum:
- approved
- rejected
in: path
name: status
required: true
type: string
- default: 20
description: Number of approvals per page (1-100)
in: query
maximum: 100
minimum: 1
name: limit
type: integer
- default: 0
description: Number of approvals to skip for pagination
in: query
minimum: 0
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: Tender approvals retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
items:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: array
meta:
$ref: '#/definitions/response.Meta'
type: object
"400":
description: Bad request - Invalid tender approval status
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender approvals by status
tags:
- Admin-TenderApprovals
/admin/v1/tender-approvals/submission-mode/{submission_mode}:
get:
consumes:
- application/json
description: Retrieve tender approvals filtered by their submission mode (self-apply,
partnership)
parameters:
- description: Tender approval submission mode
enum:
- self-apply
- partnership
in: path
name: submission_mode
required: true
type: string
- default: 20
description: Number of approvals per page (1-100)
in: query
maximum: 100
minimum: 1
name: limit
type: integer
- default: 0
description: Number of approvals to skip for pagination
in: query
minimum: 0
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: Tender approvals retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
items:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: array
meta:
$ref: '#/definitions/response.Meta'
type: object
"400":
description: Bad request - Invalid tender approval submission mode
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender approvals by submission mode
tags:
- Admin-TenderApprovals
/admin/v1/users:
get:
consumes:
@@ -4295,6 +4667,70 @@ paths:
summary: Get feedback by ID
tags:
- Feedback
/api/v1/feedback/tender/{tender_id}:
get:
consumes:
- application/json
description: Retrieve feedback details by tender ID. This endpoint provides
basic feedback information for public users.
parameters:
- description: Tender ID (MongoDB ObjectID format)
in: path
maxLength: 24
minLength: 24
name: tender_id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Feedback retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/feedback.FeedbackResponse'
type: object
"400":
description: Bad request - Invalid tender ID format
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
error:
type: string
message:
type: string
type: object
"404":
description: Feedback not found
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
error:
type: string
message:
type: string
type: object
"500":
description: Internal server error
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
error:
type: string
message:
type: string
type: object
security:
- BearerAuth: []
summary: Get feedback by tender ID
tags:
- Feedback
/api/v1/profile:
get:
consumes:
@@ -4442,6 +4878,264 @@ paths:
summary: Refresh customer access token
tags:
- Authorization
/api/v1/tender-approvals:
get:
consumes:
- application/json
description: Retrieve all tender approvals for a specific company with optional
filtering
parameters:
- description: Filter by submission mode Enums(self-apply, partnership)
enum:
- self-apply
- partnership
in: query
name: submission_mode
type: string
- description: Filter by status Enums(approved, rejected)
enum:
- approved
- rejected
in: query
name: status
type: string
produces:
- application/json
responses:
"200":
description: Tender approvals retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
items:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: array
type: object
"400":
description: Bad request - Invalid company ID
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender approvals by company ID
tags:
- TenderApprovals
post:
consumes:
- application/json
description: Create a new tender approval for a company to approve or reject
a tender
parameters:
- description: Tender approval information
in: body
name: tender_approval
required: true
schema:
$ref: '#/definitions/tender_approval.CreateTenderApprovalForm'
produces:
- application/json
responses:
"201":
description: Tender approval created successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: object
"400":
description: Bad request - Invalid input data
schema:
$ref: '#/definitions/response.APIResponse'
"409":
description: Conflict - Tender approval already exists for this tender and
company
schema:
$ref: '#/definitions/response.APIResponse'
"422":
description: Validation error - Invalid request data
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Create a new tender approval
tags:
- TenderApprovals
/api/v1/tender-approvals/{id}:
delete:
consumes:
- application/json
description: Delete a tender approval
parameters:
- description: Tender Approval ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Tender approval deleted successfully
schema:
$ref: '#/definitions/response.APIResponse'
"400":
description: Bad request - Invalid tender approval ID
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Tender approval not found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Delete tender approval
tags:
- TenderApprovals
get:
consumes:
- application/json
description: Retrieve detailed tender approval information by ID
parameters:
- description: Tender Approval ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Tender approval retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: object
"400":
description: Bad request - Invalid tender approval ID
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Tender approval not found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender approval by ID
tags:
- TenderApprovals
put:
consumes:
- application/json
description: Update tender approval information
parameters:
- description: Tender Approval ID
in: path
name: id
required: true
type: string
- description: Tender approval update information
in: body
name: tender_approval
required: true
schema:
$ref: '#/definitions/tender_approval.UpdateTenderApprovalForm'
produces:
- application/json
responses:
"200":
description: Tender approval updated successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: object
"400":
description: Bad request - Invalid input data
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Tender approval not found
schema:
$ref: '#/definitions/response.APIResponse'
"422":
description: Validation error - Invalid request data
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Update tender approval
tags:
- TenderApprovals
/api/v1/tender-approvals/tender/{tender_id}:
get:
consumes:
- application/json
description: Retrieve tender approval information for a specific tender and
company combination
parameters:
- description: Tender ID
in: query
name: tender_id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Tender approval retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.TenderApprovalResponse'
type: object
"400":
description: Bad request - Invalid tender ID or company ID
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Tender approval not found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender approval by tender and company
tags:
- TenderApprovals
/api/v1/tenders:
get:
description: Retrieve active tenders for mobile application users with automatic
@@ -4493,7 +5187,7 @@ paths:
summary: Get public tenders
tags:
- Tenders
/api/v1/tenders/read/{id}:
/api/v1/tenders/details/{id}:
get:
description: Retrieve detailed information about a specific tender for mobile
application users
@@ -4612,6 +5306,10 @@ tags:
- description: Administrative feedback management operations for web panel including
CRUD operations, search, statistics, and comprehensive filtering with pagination
name: Admin-Feedback
- description: Administrative tender approval management operations for web panel
including CRUD operations, search, statistics, and comprehensive filtering with
pagination
name: Admin-TenderApprovals
- description: Customer authentication and authorization operations for mobile application
including login, logout, token refresh, and profile access
name: Authorization
@@ -4621,3 +5319,6 @@ tags:
- description: Public feedback management operations for mobile application including
like, dislike, and comment on tenders
name: Feedback
- description: Public tender approval management operations for mobile application
including tender approval listing and detailed tender approval information
name: TenderApprovals