pub struct ContractorReport {Show 21 fields
pub id: Uuid,
pub organization_id: Uuid,
pub building_id: Uuid,
pub ticket_id: Option<Uuid>,
pub quote_id: Option<Uuid>,
pub contractor_user_id: Option<Uuid>,
pub contractor_name: String,
pub work_date: Option<DateTime<Utc>>,
pub compte_rendu: Option<String>,
pub photos_before: Vec<Uuid>,
pub photos_after: Vec<Uuid>,
pub parts_replaced: Vec<ReplacedPart>,
pub status: ContractorReportStatus,
pub magic_token_hash: Option<String>,
pub magic_token_expires_at: Option<DateTime<Utc>>,
pub submitted_at: Option<DateTime<Utc>>,
pub validated_at: Option<DateTime<Utc>>,
pub validated_by: Option<Uuid>,
pub review_comments: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Rapport de travaux soumis par le corps de métier via magic link PWA
Workflow :
- Ticket/Quote assigné → magic link JWT 72h envoyé au corps de métier
- Corps de métier : photos avant/après + pièces + compte-rendu → submit
- CdC : valide (→ paiement auto) ou demande corrections ou rejette
Fields§
§id: Uuid§organization_id: Uuid§building_id: Uuid§ticket_id: Option<Uuid>Ticket ou devis associé (au moins l’un des deux doit être présent)
quote_id: Option<Uuid>§contractor_user_id: Option<Uuid>Id du prestataire (service_provider futur) ou nom libre
contractor_name: String§work_date: Option<DateTime<Utc>>Date d’intervention
compte_rendu: Option<String>Compte-rendu libre du corps de métier
photos_before: Vec<Uuid>Photos avant travaux (document_ids)
photos_after: Vec<Uuid>Photos après travaux (document_ids)
parts_replaced: Vec<ReplacedPart>Pièces remplacées
status: ContractorReportStatusStatut de la machine d’état
magic_token_hash: Option<String>Magic link token (JWT hashé) pour accès sans auth classique
magic_token_expires_at: Option<DateTime<Utc>>§submitted_at: Option<DateTime<Utc>>Horodatage de soumission
validated_at: Option<DateTime<Utc>>Validation CdC
validated_by: Option<Uuid>§review_comments: Option<String>Commentaires CdC (corrections ou refus)
created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl ContractorReport
impl ContractorReport
pub fn new( organization_id: Uuid, building_id: Uuid, contractor_name: String, ticket_id: Option<Uuid>, quote_id: Option<Uuid>, contractor_user_id: Option<Uuid>, ) -> Result<Self, String>
Sourcepub fn submit(&mut self) -> Result<(), String>
pub fn submit(&mut self) -> Result<(), String>
Corps de métier soumet le rapport (Draft → Submitted)
Sourcepub fn start_review(&mut self) -> Result<(), String>
pub fn start_review(&mut self) -> Result<(), String>
CdC commence l’examen (Submitted → UnderReview)
Sourcepub fn validate(&mut self, validated_by: Uuid) -> Result<(), String>
pub fn validate(&mut self, validated_by: Uuid) -> Result<(), String>
CdC valide le rapport (→ Validated, déclenche paiement)
Sourcepub fn request_corrections(&mut self, comments: String) -> Result<(), String>
pub fn request_corrections(&mut self, comments: String) -> Result<(), String>
CdC demande des corrections (→ RequiresCorrection)
Sourcepub fn reject(
&mut self,
comments: String,
rejected_by: Uuid,
) -> Result<(), String>
pub fn reject( &mut self, comments: String, rejected_by: Uuid, ) -> Result<(), String>
CdC rejette le rapport
Sourcepub fn is_magic_token_valid(&self) -> bool
pub fn is_magic_token_valid(&self) -> bool
Vérifie si le magic token est encore valide
Trait Implementations§
Source§impl Clone for ContractorReport
impl Clone for ContractorReport
Source§fn clone(&self) -> ContractorReport
fn clone(&self) -> ContractorReport
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContractorReport
impl Debug for ContractorReport
Source§impl From<&ContractorReport> for ContractorReportResponseDto
impl From<&ContractorReport> for ContractorReportResponseDto
Source§fn from(r: &ContractorReport) -> Self
fn from(r: &ContractorReport) -> Self
Auto Trait Implementations§
impl Freeze for ContractorReport
impl RefUnwindSafe for ContractorReport
impl Send for ContractorReport
impl Sync for ContractorReport
impl Unpin for ContractorReport
impl UnwindSafe for ContractorReport
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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>
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 more