Add Company Feedback Statistics Endpoint and Update API Documentation
- Introduced a new endpoint to retrieve comprehensive feedback statistics for the authenticated user's company, including total likes, dislikes, and percentage calculations. - Implemented the GetCompanyFeedbackStats method in the feedback handler to handle requests, ensuring proper authentication and error handling. - Updated Swagger JSON, YAML, and Go documentation to accurately reflect the new endpoint, including detailed descriptions, parameters, and response formats for the CompanyFeedbackStatsResponse. - Enhanced the feedback repository and service layers to support the new statistics functionality, improving the overall data handling capabilities of the tender management system. - These changes enhance the usability and functionality of the API, providing valuable insights into company feedback statistics.
This commit is contained in:
+133
-28
@@ -5412,6 +5412,109 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/feedback/stats/company": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Retrieve comprehensive feedback statistics for the authenticated user's company including total likes, dislikes, and percentage calculations.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Feedback"
|
||||
],
|
||||
"summary": "Get company feedback statistics",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Company feedback statistics retrieved successfully",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/feedback.CompanyFeedbackStatsResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request - Missing company association",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized - User not authenticated",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.APIResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/feedback/tender/{tender_id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -7586,6 +7689,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"feedback.CompanyFeedbackStatsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"company_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_updated": {
|
||||
"description": "Unix timestamp",
|
||||
"type": "integer"
|
||||
},
|
||||
"total_dislikes": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total_feedback": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total_likes": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"feedback.FeedbackListResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -7753,6 +7877,9 @@
|
||||
"tender.TenderResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"application_deadline": {
|
||||
"type": "integer"
|
||||
},
|
||||
"buyer_organization": {
|
||||
"$ref": "#/definitions/tender.OrganizationResponse"
|
||||
},
|
||||
@@ -7795,9 +7922,15 @@
|
||||
"submission_deadline": {
|
||||
"type": "integer"
|
||||
},
|
||||
"submission_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"tender_deadline": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tender_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -7869,20 +8002,6 @@
|
||||
"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"
|
||||
},
|
||||
@@ -7996,20 +8115,6 @@
|
||||
"tender_approval.TenderApprovalStatsResponse": {
|
||||
"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"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user