pub struct MaintenanceRequestWriteService { /* private fields */ }Implementations§
Source§impl MaintenanceRequestWriteService
impl MaintenanceRequestWriteService
pub fn new(pool: PgPool) -> Self
Sourcepub async fn create_request(
&self,
r: NewMaintenanceRequest,
) -> Result<Uuid, RequestWriteError>
pub async fn create_request( &self, r: NewMaintenanceRequest, ) -> Result<Uuid, RequestWriteError>
File a request. The stage defaults to the first visible stage (the shared seed’s
“New Request”); entering a done stage stamps close_date via the trigger.
Sourcepub async fn update_request(
&self,
request_id: Uuid,
u: MaintenanceRequestUpdate,
) -> Result<(), RequestWriteError>
pub async fn update_request( &self, request_id: Uuid, u: MaintenanceRequestUpdate, ) -> Result<(), RequestWriteError>
Change a request’s descriptive/recurrence fields. The guards run on the MERGED view (old row
overlaid with the update), so — the widened G-MT2 fire-rule — moving schedule_date past an
existing schedule_end is caught here and by the table CHECK.
Sourcepub async fn transition_request(
&self,
request_id: Uuid,
target_stage_id: Uuid,
kanban_state_override: Option<RequestKanbanState>,
events: &dyn MaintenanceEventSink,
) -> Result<TransitionOutcome, RequestWriteError>
pub async fn transition_request( &self, request_id: Uuid, target_stage_id: Uuid, kanban_state_override: Option<RequestKanbanState>, events: &dyn MaintenanceEventSink, ) -> Result<TransitionOutcome, RequestWriteError>
Move a request to another stage — the only sanctioned way a request’s stage changes.
Inside one transaction: set the managed-transition marker, CAS the stage move (the G-MT5 trigger applies the kanban reset + close_date on the same statement), and — when a non-done request CLOSES onto a done stage and is preventive+recurring — spawn the successor (claim the slot first; at most one successor per source). Stages the outbox events and commits; the successor exists iff the close committed.
Auto Trait Implementations§
impl !RefUnwindSafe for MaintenanceRequestWriteService
impl !UnwindSafe for MaintenanceRequestWriteService
impl Freeze for MaintenanceRequestWriteService
impl Send for MaintenanceRequestWriteService
impl Sync for MaintenanceRequestWriteService
impl Unpin for MaintenanceRequestWriteService
impl UnsafeUnpin for MaintenanceRequestWriteService
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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