Files
tm_back/internal/tender_approval/form.go
T
n.nakhostin 94d0fbef38 Add Tender Approval Management Functionality and API Enhancements
- Introduced a new tender approval management system, including the creation of tender approval entities, services, and repositories.
- Implemented CRUD operations for tender approvals, allowing companies to approve or reject tenders.
- Developed administrative and public API endpoints for listing, retrieving, and updating tender approvals with comprehensive filtering options.
- Enhanced Swagger documentation to accurately reflect the new endpoints, including detailed descriptions, parameters, and response formats.
- Updated existing routes to include tender approval management, ensuring adherence to Clean Architecture principles and maintaining a clear separation of concerns in the handler layer.
2025-08-18 19:00:41 +03:30

71 lines
3.4 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(approved|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(approved|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"`
ApprovedTenders int64 `json:"approved_tenders"`
RejectedTenders int64 `json:"rejected_tenders"`
ApprovalsByStatus map[string]int64 `json:"approvals_by_status"`
ApprovalsBySubmission map[string]int64 `json:"approvals_by_submission"`
LastUpdated int64 `json:"last_updated"`
}