3024998e7e
- 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.
107 lines
5.3 KiB
Go
107 lines
5.3 KiB
Go
package tender_approval
|
|
|
|
// CreateTenderApprovalForm represents the form for creating a new tender approval
|
|
type CreateTenderApprovalForm struct {
|
|
TenderID string `json:"tender_id" valid:"required"`
|
|
SubmissionMode SubmissionMode `json:"submission_mode" valid:"required,in(self-apply|partnership)"`
|
|
Status ApprovalStatus `json:"status,omitempty" valid:"optional,in(submitted|rejected)"`
|
|
}
|
|
|
|
// UpdateTenderApprovalForm represents the form for updating a tender approval
|
|
type UpdateTenderApprovalForm struct {
|
|
SubmissionMode *string `json:"submission_mode,omitempty" valid:"optional,in(self-apply|partnership)"`
|
|
Status *string `json:"status,omitempty" valid:"optional,in(submitted|rejected)"`
|
|
}
|
|
|
|
// ListTenderApprovalsForm represents the form for listing tender approvals with filters
|
|
type ListTenderApprovalsForm struct {
|
|
TenderID *string `query:"tender_id" valid:"optional"`
|
|
CompanyID *string `query:"company_id" valid:"optional"`
|
|
Status []string `query:"status" valid:"optional"`
|
|
SubmissionMode []string `query:"submission_mode" valid:"optional"`
|
|
CreatedAtFrom *int64 `query:"created_at_from" valid:"optional"`
|
|
CreatedAtTo *int64 `query:"created_at_to" valid:"optional"`
|
|
Limit *int `query:"limit" valid:"optional,range(1|100)"`
|
|
Offset *int `query:"offset" valid:"optional,min(0)"`
|
|
SortBy *string `query:"sort_by" valid:"optional,in(created_at|updated_at|status|submission_mode)"`
|
|
SortOrder *string `query:"sort_order" valid:"optional,in(asc|desc)"`
|
|
}
|
|
|
|
// ApproveTenderForm represents the form for approving a tender
|
|
type ApproveTenderForm struct {
|
|
Notes *string `json:"notes,omitempty" valid:"optional,length(0|1000)"`
|
|
}
|
|
|
|
// RejectTenderForm represents the form for rejecting a tender
|
|
type RejectTenderForm struct {
|
|
Reason string `json:"reason" valid:"required,length(10|500)"`
|
|
}
|
|
|
|
// TenderApprovalListResponse represents the response for listing tender approvals
|
|
type TenderApprovalListResponse struct {
|
|
TenderApprovals []*TenderApprovalResponse `json:"tender_approvals"`
|
|
Total int64 `json:"total"`
|
|
Limit int `json:"limit"`
|
|
Offset int `json:"offset"`
|
|
TotalPages int `json:"total_pages"`
|
|
}
|
|
|
|
// TenderApproval search and matching DTOs
|
|
type TenderApprovalSearchForm struct {
|
|
Query *string `query:"q" valid:"optional"`
|
|
TenderID *string `query:"tender_id" valid:"optional"`
|
|
CompanyID *string `query:"company_id" valid:"optional"`
|
|
Status []string `query:"status" valid:"optional"`
|
|
SubmissionMode []string `query:"submission_mode" valid:"optional"`
|
|
CreatedAtFrom *int64 `query:"created_at_from" valid:"optional"`
|
|
CreatedAtTo *int64 `query:"created_at_to" valid:"optional"`
|
|
Limit *int `query:"limit" valid:"optional,range(1|100)"`
|
|
Offset *int `query:"offset" valid:"optional,min(0)"`
|
|
}
|
|
|
|
// TenderApproval statistics DTOs
|
|
type TenderApprovalStatsResponse struct {
|
|
TotalApprovals int64 `json:"total_approvals"`
|
|
SubmittedTenders int64 `json:"submitted_tenders"`
|
|
RejectedTenders int64 `json:"rejected_tenders"`
|
|
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"`
|
|
SubmittedTenders int64 `json:"submitted_tenders"`
|
|
RejectedTenders int64 `json:"rejected_tenders"`
|
|
SelfApplyCount int64 `json:"self_apply_count"`
|
|
PartnershipCount int64 `json:"partnership_count"`
|
|
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(submitted|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"`
|
|
TotalSubmittedTenders int64 `json:"total_submitted_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"`
|
|
}
|