Add Company Tender Approval Statistics Endpoint and Update API Documentation

- Introduced a new API endpoint to retrieve company-specific tender approval statistics, enhancing the analytics capabilities of the tender management system.
- Implemented the `GetCompanyTenderApprovalStats` method in the service layer to fetch detailed statistics, including total approvals, approved and rejected tenders, and submission counts.
- Updated Swagger documentation to accurately reflect the new endpoint, including detailed descriptions, parameters, and response formats for the `CompanyTenderApprovalStatsResponse`.
- Enhanced the router to include the new statistics route, ensuring adherence to Clean Architecture principles and maintaining a clear separation of concerns in the handler layer.
- Added necessary request and response forms to support the new functionality, improving the overall API structure and usability.
This commit is contained in:
n.nakhostin
2025-08-19 11:27:40 +03:30
parent 392b31626d
commit 81914e2eeb
8 changed files with 432 additions and 0 deletions
+92
View File
@@ -5982,6 +5982,58 @@ const docTemplate = `{
}
}
},
"/api/v1/tender-approvals/stats": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get comprehensive tender approval statistics for a specific company",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenderApprovals"
],
"summary": "Get company tender approval statistics",
"responses": {
"200": {
"description": "Company tender approval statistics retrieved successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/tender_approval.CompanyTenderApprovalStatsResponse"
}
}
}
]
}
},
"400": {
"description": "Bad request - Invalid company ID",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/api/v1/tender-approvals/tender/{tender_id}": {
"get": {
"security": [
@@ -7745,6 +7797,46 @@ const docTemplate = `{
"ApprovalStatusRejected"
]
},
"tender_approval.CompanyTenderApprovalStatsResponse": {
"type": "object",
"properties": {
"approvals_by_status": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}
},
"approvals_by_submission": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}
},
"approved_tenders": {
"type": "integer"
},
"company_id": {
"type": "string"
},
"last_updated": {
"type": "integer"
},
"partnership_count": {
"type": "integer"
},
"rejected_tenders": {
"type": "integer"
},
"self_apply_count": {
"type": "integer"
},
"total_approvals": {
"type": "integer"
}
}
},
"tender_approval.CreateTenderApprovalForm": {
"type": "object",
"properties": {
+92
View File
@@ -5976,6 +5976,58 @@
}
}
},
"/api/v1/tender-approvals/stats": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get comprehensive tender approval statistics for a specific company",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenderApprovals"
],
"summary": "Get company tender approval statistics",
"responses": {
"200": {
"description": "Company tender approval statistics retrieved successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/tender_approval.CompanyTenderApprovalStatsResponse"
}
}
}
]
}
},
"400": {
"description": "Bad request - Invalid company ID",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/api/v1/tender-approvals/tender/{tender_id}": {
"get": {
"security": [
@@ -7739,6 +7791,46 @@
"ApprovalStatusRejected"
]
},
"tender_approval.CompanyTenderApprovalStatsResponse": {
"type": "object",
"properties": {
"approvals_by_status": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}
},
"approvals_by_submission": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}
},
"approved_tenders": {
"type": "integer"
},
"company_id": {
"type": "string"
},
"last_updated": {
"type": "integer"
},
"partnership_count": {
"type": "integer"
},
"rejected_tenders": {
"type": "integer"
},
"self_apply_count": {
"type": "integer"
},
"total_approvals": {
"type": "integer"
}
}
},
"tender_approval.CreateTenderApprovalForm": {
"type": "object",
"properties": {
+57
View File
@@ -924,6 +924,33 @@ definitions:
x-enum-varnames:
- ApprovalStatusApproved
- ApprovalStatusRejected
tender_approval.CompanyTenderApprovalStatsResponse:
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
company_id:
type: string
last_updated:
type: integer
partnership_count:
type: integer
rejected_tenders:
type: integer
self_apply_count:
type: integer
total_approvals:
type: integer
type: object
tender_approval.CreateTenderApprovalForm:
properties:
status:
@@ -5058,6 +5085,36 @@ paths:
summary: Get tender approval by ID
tags:
- TenderApprovals
/api/v1/tender-approvals/stats:
get:
consumes:
- application/json
description: Get comprehensive tender approval statistics for a specific company
produces:
- application/json
responses:
"200":
description: Company tender approval statistics retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender_approval.CompanyTenderApprovalStatsResponse'
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 company tender approval statistics
tags:
- TenderApprovals
/api/v1/tender-approvals/tender/{tender_id}:
get:
consumes: