feat: persist candidate questionnaires and enforce company quotas
This commit is contained in:
1 parent
73c7caa225
commit
3a61a8e8bb
51 files changed
+6280
-38
No files matched your search
@@ -333,6 +333,10 @@ type OpenCategoryInput struct {
|
||||
// is not the one in force are refused.
|
||||
GradingPolicyID domain.PolicyVersionID
|
||||
OpenedBy domain.AssessmentOperator
|
||||
// CatalogMetadata is the explicit public mapping reviewed for this exact
|
||||
// published bank opening. An opening without it is not exposed in the
|
||||
// public specialization catalog.
|
||||
CatalogMetadata *domain.AssessmentCategoryCatalogMetadata
|
||||
}
|
||||
|
||||
// OpenCategory makes a category available. It reads the referenced policy
|
||||
@@ -370,6 +374,14 @@ func (bank *Bank) OpenCategory(ctx context.Context, input OpenCategoryInput) (do
|
||||
if err != nil {
|
||||
return storageRefusal(fmt.Errorf("store opening: %w", err), domain.RefusalNotDraft)
|
||||
}
|
||||
if input.CatalogMetadata != nil {
|
||||
if input.CatalogMetadata.IsZero() {
|
||||
return fmt.Errorf("bind public catalog metadata: %w", domain.ErrInvalidAssessmentFamily)
|
||||
}
|
||||
if err := repository.BindCategoryCatalog(ctx, opening, *input.CatalogMetadata); err != nil {
|
||||
return fmt.Errorf("bind public catalog metadata: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
@@ -378,6 +390,24 @@ func (bank *Bank) OpenCategory(ctx context.Context, input OpenCategoryInput) (do
|
||||
return opening, nil
|
||||
}
|
||||
|
||||
// SpecializationAvailability returns only catalog mappings whose opening,
|
||||
// current policy, live coverage, and published-family manifest still match.
|
||||
func (bank *Bank) SpecializationAvailability(ctx context.Context) ([]domain.SpecializationAvailability, error) {
|
||||
var availability []domain.SpecializationAvailability
|
||||
err := bank.transactor.WithinTransaction(ctx, func(ctx context.Context, unit outbound.UnitOfWork) error {
|
||||
var err error
|
||||
availability, err = unit.AssessmentBank().ListCurrentSpecializationAvailability(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read current bank availability: %w", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Bank.SpecializationAvailability - read catalog: %w", err)
|
||||
}
|
||||
return availability, nil
|
||||
}
|
||||
|
||||
// readGradingPolicy reads the referenced policy version and requires it to
|
||||
// be the version of the product policy in force now.
|
||||
func readGradingPolicy(ctx context.Context, unit outbound.UnitOfWork, id domain.PolicyVersionID) (domain.PolicyVersion, error) {
|
||||
|
||||
@@ -104,6 +104,16 @@ func (bank *fakeBank) CreateCategoryOpening(context.Context, domain.AssessmentCa
|
||||
return domain.AssessmentCategoryOpening{}, bank.openErr
|
||||
}
|
||||
|
||||
func (bank *fakeBank) BindCategoryCatalog(context.Context, domain.AssessmentCategoryOpening, domain.AssessmentCategoryCatalogMetadata) error {
|
||||
bank.calls = append(bank.calls, "bind_catalog")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bank *fakeBank) ListCurrentSpecializationAvailability(context.Context) ([]domain.SpecializationAvailability, error) {
|
||||
bank.calls = append(bank.calls, "availability")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (bank *fakeBank) GetCurrentCategoryOpening(context.Context, domain.AssessmentCategory) (domain.AssessmentCategoryOpening, error) {
|
||||
if bank.opening == nil {
|
||||
return domain.AssessmentCategoryOpening{}, outbound.ErrAssessmentCategoryNotOpen
|
||||
|
||||
Reference in new issue
Block a user