pub struct ContractorEvaluationUseCases { /* private fields */ }Expand description
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.
Implementations§
Source§impl ContractorEvaluationUseCases
impl ContractorEvaluationUseCases
pub fn new( repo: Arc<dyn ContractorEvaluationRepository>, tech_spec_repo: Arc<dyn TechnicalSpecRepository>, ) -> Self
Sourcepub async fn create_evaluation(
&self,
contractor_user_id: Uuid,
technical_spec_id: Uuid,
linked_ticket_ids: Vec<Uuid>,
evaluator_user_id: Uuid,
scores: EvaluationScores,
comment: String,
) -> Result<ContractorEvaluation, AppError>
pub async fn create_evaluation( &self, contractor_user_id: Uuid, technical_spec_id: Uuid, linked_ticket_ids: Vec<Uuid>, evaluator_user_id: Uuid, scores: EvaluationScores, comment: String, ) -> Result<ContractorEvaluation, AppError>
Record a new evaluation. Guards in this order:
- The TechnicalSpec MUST exist — else
NotFound. - It MUST be in
Approvedstatus — elseTechnicalSpecRequired422. A Draft / PendingSignatures spec means the prestation has not been formally signed off; a Superseded spec means a later version governs the current works and that newer spec is what should legitimise the evaluation. - The entity constructor enforces every structural invariant
(including
evaluator_user_id != contractor_user_id, INV-21).
pub async fn get_evaluation( &self, id: Uuid, ) -> Result<ContractorEvaluation, AppError>
pub async fn list_for_contractor( &self, contractor_user_id: Uuid, ) -> Result<Vec<ContractorEvaluation>, AppError>
Auto Trait Implementations§
impl !RefUnwindSafe for ContractorEvaluationUseCases
impl !UnwindSafe for ContractorEvaluationUseCases
impl Freeze for ContractorEvaluationUseCases
impl Send for ContractorEvaluationUseCases
impl Sync for ContractorEvaluationUseCases
impl Unpin for ContractorEvaluationUseCases
impl UnsafeUnpin for ContractorEvaluationUseCases
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.