Skip to main content

Module contractor_evaluation_use_cases

Module contractor_evaluation_use_cases 

Source
Expand description

Use cases for ContractorEvaluation (Story 3.9 — FR34 FR35 INV-21 INV-24).

One operation exposed to handlers: ContractorEvaluationUseCases::create_evaluation — a syndic (or a mandated owner) records an evaluation against a contractor. Guards enforced here:

  • the referenced TechnicalSpec MUST exist (else AppError::NotFound);
  • it MUST be in TechnicalSpecStatus::Approved — a Draft / PendingSignatures / Superseded spec does not legitimise an evaluation (else AppError::TechnicalSpecRequired → 422);
  • ContractorEvaluation::new validates every structural invariant (scores in [1, 5], comment length, no self-evaluation, no duplicate linked tickets, no nil UUIDs).

Append-only behaviour is enforced at the DB trigger level — the use case exposes no update / delete; the repo trait has no such methods either.

Structs§

ContractorEvaluationUseCases
Use cases container. Holds trait-object handles to the two repositories (parallel to TechnicalSpecUseCases) so AppState can store it as a non-generic Arc<…> without forcing every downstream consumer to carry type parameters.