feat(purchase

This commit is contained in:
Efril
2026-08-11 22:41:10 +07:00
parent dbc143954c
commit e6078e3c0b
19 changed files with 532 additions and 17 deletions
@@ -120,6 +120,20 @@ func (s *PurchaseOrderServiceImpl) ListPurchaseOrders(ctx context.Context, apctx
if modelReq.TeamCategoryID != nil {
filters["team_category_id"] = *modelReq.TeamCategoryID
}
// team spells out the same two filters in one value; the validator has already
// ruled out sending it together with them.
switch modelReq.Team {
case "":
case constants.PurchaseTeamNone:
filters["team_unassigned"] = true
case constants.PurchaseTeamScopeCentral:
filters["team_scope"] = constants.PurchaseTeamScopeCentral
default:
if teamCategoryID, err := uuid.Parse(modelReq.Team); err == nil {
filters["team_scope"] = constants.PurchaseTeamScopeCategory
filters["team_category_id"] = teamCategoryID
}
}
if modelReq.StartDate != nil {
filters["start_date"] = *modelReq.StartDate
}