pub struct SyndicResponseUseCases<R, T>where
R: SyndicResponseRepository,
T: TicketRepository,{ /* private fields */ }Implementations§
Source§impl<R, T> SyndicResponseUseCases<R, T>where
R: SyndicResponseRepository,
T: TicketRepository,
impl<R, T> SyndicResponseUseCases<R, T>where
R: SyndicResponseRepository,
T: TicketRepository,
pub fn new(repo: Arc<R>, ticket_repo: Arc<T>) -> Self
Sourcepub async fn respond(
&self,
ticket_id: Uuid,
syndic_user_id: Uuid,
body: String,
action_proposed: Option<String>,
) -> Result<SyndicResponse, AppError>
pub async fn respond( &self, ticket_id: Uuid, syndic_user_id: Uuid, body: String, action_proposed: Option<String>, ) -> Result<SyndicResponse, AppError>
Syndic responds to a ticket.
Invariants:
- Ticket MUST exist →
AppError::NotFound. SyndicResponse::newvalidates body + action_proposed.
Side effect — SLA pre-emption: if the response is posted strictly
before the ticket’s sla_due_at, we set sla_escalated_at = now()
idempotently so the SLA cron job will not double-escalate later.
The sla_escalated_at column is here a “SLA consumed” marker, not
strictly an “escalation happened” marker — its semantics is
“the open SLA window is closed for this ticket”.
pub async fn list_for_ticket( &self, ticket_id: Uuid, ) -> Result<Vec<SyndicResponse>, AppError>
Sourcepub async fn escalate_overdue(
&self,
now: DateTime<Utc>,
) -> Result<Vec<Uuid>, AppError>
pub async fn escalate_overdue( &self, now: DateTime<Utc>, ) -> Result<Vec<Uuid>, AppError>
Cron entry point — one pass of SLA escalation.
Returns the list of ticket ids that were just escalated (i.e. went
from sla_escalated_at IS NULL to Some(now)). Subsequent calls
at the same now are no-ops (idempotency).
NOTE: no role guard — the caller is the scheduler, not a user.
Auto Trait Implementations§
impl<R, T> Freeze for SyndicResponseUseCases<R, T>
impl<R, T> RefUnwindSafe for SyndicResponseUseCases<R, T>where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<R, T> Send for SyndicResponseUseCases<R, T>
impl<R, T> Sync for SyndicResponseUseCases<R, T>
impl<R, T> Unpin for SyndicResponseUseCases<R, T>
impl<R, T> UnsafeUnpin for SyndicResponseUseCases<R, T>
impl<R, T> UnwindSafe for SyndicResponseUseCases<R, T>where
R: RefUnwindSafe,
T: RefUnwindSafe,
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.