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:
@@ -69,9 +69,42 @@ type TenderApprovalStatsResponse struct {
|
||||
LastUpdated int64 `json:"last_updated"`
|
||||
}
|
||||
|
||||
// CompanyTenderApprovalStatsResponse represents company-specific tender approval statistics
|
||||
type CompanyTenderApprovalStatsResponse struct {
|
||||
CompanyID string `json:"company_id"`
|
||||
TotalApprovals int64 `json:"total_approvals"`
|
||||
ApprovedTenders int64 `json:"approved_tenders"`
|
||||
RejectedTenders int64 `json:"rejected_tenders"`
|
||||
SelfApplyCount int64 `json:"self_apply_count"`
|
||||
PartnershipCount int64 `json:"partnership_count"`
|
||||
ApprovalsByStatus map[string]int64 `json:"approvals_by_status"`
|
||||
ApprovalsBySubmission map[string]int64 `json:"approvals_by_submission"`
|
||||
LastUpdated int64 `json:"last_updated"`
|
||||
}
|
||||
|
||||
// ToggleTenderApprovalForm represents the form for toggling a tender approval
|
||||
type ToggleTenderApprovalForm struct {
|
||||
TenderID string `json:"tender_id" valid:"required"`
|
||||
Status ApprovalStatus `json:"status" valid:"required,in(approved|rejected)"`
|
||||
SubmissionMode SubmissionMode `json:"submission_mode" valid:"required,in(self-apply|partnership)"`
|
||||
}
|
||||
|
||||
// CompanyTenderApprovalStatsRequest represents a request for company tender approval statistics
|
||||
type CompanyTenderApprovalStatsRequest struct {
|
||||
CompanyIDs []string `query:"company_ids" valid:"optional"`
|
||||
CompanyID *string `query:"company_id" valid:"optional"`
|
||||
}
|
||||
|
||||
// AggregatedCompanyStatsResponse represents aggregated statistics across all companies
|
||||
type AggregatedCompanyStatsResponse struct {
|
||||
TotalCompanies int64 `json:"total_companies"`
|
||||
TotalApprovals int64 `json:"total_approvals"`
|
||||
TotalApprovedTenders int64 `json:"total_approved_tenders"`
|
||||
TotalRejectedTenders int64 `json:"total_rejected_tenders"`
|
||||
TotalSelfApplyCount int64 `json:"total_self_apply_count"`
|
||||
TotalPartnershipCount int64 `json:"total_partnership_count"`
|
||||
ApprovalsByStatus map[string]int64 `json:"approvals_by_status"`
|
||||
ApprovalsBySubmission map[string]int64 `json:"approvals_by_submission"`
|
||||
CompanyStats []*CompanyTenderApprovalStatsResponse `json:"company_stats"`
|
||||
LastUpdated int64 `json:"last_updated"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user