Update Tender Approval Status to Include Submitted State and Revise API Documentation
- Changed the approval status from "approved" to "submitted" in various locations, including entity definitions, forms, and service methods, to accurately reflect the tender approval process.
- Updated API documentation in Swagger JSON, YAML, and Go files to describe the new status options ("submitted" and "rejected") and their corresponding descriptions.
- Enhanced the tender approval statistics structures to include a count for submitted tenders, improving the overall data model for tender management.
- These changes ensure clarity in the tender approval workflow and enhance the usability of the API for clients interacting with tender approvals.
This commit is contained in:
@@ -694,12 +694,12 @@ func (s *tenderApprovalService) GetAggregatedCompanyStats(ctx context.Context) (
|
||||
// In a real implementation, you might want to get stats for all companies
|
||||
// and aggregate them properly
|
||||
stats := &AggregatedCompanyStatsResponse{
|
||||
TotalCompanies: 1, // This should be calculated from actual company data
|
||||
TotalApprovals: generalStats.TotalApprovals,
|
||||
TotalApprovedTenders: generalStats.ApprovedTenders,
|
||||
TotalRejectedTenders: generalStats.RejectedTenders,
|
||||
CompanyStats: []*CompanyTenderApprovalStatsResponse{}, // Empty for now
|
||||
LastUpdated: time.Now().Unix(),
|
||||
TotalCompanies: 1, // This should be calculated from actual company data
|
||||
TotalApprovals: generalStats.TotalApprovals,
|
||||
TotalSubmittedTenders: generalStats.SubmittedTenders,
|
||||
TotalRejectedTenders: generalStats.RejectedTenders,
|
||||
CompanyStats: []*CompanyTenderApprovalStatsResponse{}, // Empty for now
|
||||
LastUpdated: time.Now().Unix(),
|
||||
}
|
||||
|
||||
s.logger.Info("Aggregated company stats retrieved successfully", map[string]interface{}{
|
||||
@@ -1004,8 +1004,8 @@ func (s *tenderApprovalService) ToggleTenderApproval(ctx context.Context, req *T
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if req.Status == ApprovalStatusApproved {
|
||||
existing.Status = "unapproved"
|
||||
if req.Status == ApprovalStatusSubmitted {
|
||||
existing.Status = "unsubmitted"
|
||||
} else {
|
||||
existing.Status = "unrejected"
|
||||
}
|
||||
@@ -1024,10 +1024,10 @@ func (s *tenderApprovalService) ToggleTenderApproval(ctx context.Context, req *T
|
||||
return existing.ToResponseWithTender(nil), nil
|
||||
}
|
||||
|
||||
if existing.Status == ApprovalStatusApproved {
|
||||
if existing.Status == ApprovalStatusSubmitted {
|
||||
existing.Reject()
|
||||
} else {
|
||||
existing.Approve()
|
||||
existing.Submit()
|
||||
}
|
||||
|
||||
err = s.repository.Update(ctx, existing)
|
||||
@@ -1055,7 +1055,7 @@ func (s *tenderApprovalService) GetCompanyTenderApprovalStats(ctx context.Contex
|
||||
s.logger.Info("Company tender approval stats retrieved successfully", map[string]interface{}{
|
||||
"company_id": companyID,
|
||||
"total_approvals": stats.TotalApprovals,
|
||||
"approved_tenders": stats.ApprovedTenders,
|
||||
"submitted_tenders": stats.SubmittedTenders,
|
||||
"rejected_tenders": stats.RejectedTenders,
|
||||
"self_apply_count": stats.SelfApplyCount,
|
||||
"partnership_count": stats.PartnershipCount,
|
||||
|
||||
Reference in New Issue
Block a user