feat(support): verify the manual assessment request after a C3 refusal
This commit is contained in:
1 parent
6bfd7098c3
commit
68286af8b7
20 files changed
+680
-74
No files matched your search
@@ -294,32 +294,6 @@ func createSupportCaseInTransaction(
|
||||
return storeCreatedCase(ctx, unit, repositories, request, supportCase)
|
||||
}
|
||||
|
||||
func resolveManualAssessmentRubric(
|
||||
ctx context.Context,
|
||||
repositories outbound.SupportCaseRepositories,
|
||||
fields *domain.NewSupportCaseInput,
|
||||
) error {
|
||||
if fields.Type != domain.SupportCaseTypeManualAssessment || fields.AssessmentTarget == nil {
|
||||
return nil
|
||||
}
|
||||
rubric, err := repositories.SupportCaseRubrics().ResolveCurrent(
|
||||
ctx, fields.AssessmentTarget.Specialization, fields.AssessmentTarget.Grade,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s - resolve current manual assessment rubric: %w", createLocation, err)
|
||||
}
|
||||
if rubric == nil {
|
||||
return nil
|
||||
}
|
||||
if rubric.Version < 1 || rubric.OpeningID == uuid.Nil || rubric.PolicyVersionID.IsZero() {
|
||||
return fmt.Errorf("%s - rubric resolver returned an incomplete pin: %w", createLocation, domain.ErrInvalidSupportCase)
|
||||
}
|
||||
fields.RubricVersion = &rubric.Version
|
||||
fields.RubricOpeningID = &rubric.OpeningID
|
||||
fields.RubricPolicyID = &rubric.PolicyVersionID
|
||||
return nil
|
||||
}
|
||||
|
||||
func storeReferenceFailure(
|
||||
ctx context.Context,
|
||||
unit outbound.UnitOfWork,
|
||||
@@ -505,11 +479,7 @@ func validateAttemptReference(input domain.NewSupportCaseInput, attempt domain.A
|
||||
case domain.SupportCaseTypeSupport, domain.SupportCaseTypeComplaint:
|
||||
return nil
|
||||
case domain.SupportCaseTypeManualAssessment:
|
||||
target := input.AssessmentTarget
|
||||
attemptSnapshot := attempt.Snapshot()
|
||||
if target == nil || attemptSnapshot.Specialization == nil || *attemptSnapshot.Specialization != target.Specialization {
|
||||
return ErrStateConflict
|
||||
}
|
||||
return validateManualAssessmentAttempt(input.AssessmentTarget, attempt)
|
||||
case domain.SupportCaseTypeGradeAppeal:
|
||||
if attempt.State() != domain.AssessmentAttemptStateCompleted {
|
||||
return ErrStateConflict
|
||||
|
||||
Reference in new issue
Block a user