pub struct TicketUseCases { /* private fields */ }Implementations§
Source§impl TicketUseCases
impl TicketUseCases
pub fn new(ticket_repository: Arc<dyn TicketRepository>) -> Self
Sourcepub async fn create_ticket(
&self,
organization_id: Uuid,
created_by: Uuid,
request: CreateTicketRequest,
) -> Result<TicketResponse, String>
pub async fn create_ticket( &self, organization_id: Uuid, created_by: Uuid, request: CreateTicketRequest, ) -> Result<TicketResponse, String>
Create a new maintenance request ticket
Sourcepub async fn get_ticket(
&self,
id: Uuid,
) -> Result<Option<TicketResponse>, String>
pub async fn get_ticket( &self, id: Uuid, ) -> Result<Option<TicketResponse>, String>
Get a ticket by ID
Sourcepub async fn list_tickets_by_building(
&self,
building_id: Uuid,
) -> Result<Vec<TicketResponse>, String>
pub async fn list_tickets_by_building( &self, building_id: Uuid, ) -> Result<Vec<TicketResponse>, String>
List all tickets for a building
Sourcepub async fn list_tickets_by_organization(
&self,
organization_id: Uuid,
) -> Result<Vec<TicketResponse>, String>
pub async fn list_tickets_by_organization( &self, organization_id: Uuid, ) -> Result<Vec<TicketResponse>, String>
List all tickets for an organization
Sourcepub async fn list_my_tickets(
&self,
created_by: Uuid,
) -> Result<Vec<TicketResponse>, String>
pub async fn list_my_tickets( &self, created_by: Uuid, ) -> Result<Vec<TicketResponse>, String>
List tickets created by a specific owner
Sourcepub async fn list_assigned_tickets(
&self,
assigned_to: Uuid,
) -> Result<Vec<TicketResponse>, String>
pub async fn list_assigned_tickets( &self, assigned_to: Uuid, ) -> Result<Vec<TicketResponse>, String>
List tickets assigned to a specific user (syndic/contractor)
Sourcepub async fn list_tickets_by_status(
&self,
building_id: Uuid,
status: TicketStatus,
) -> Result<Vec<TicketResponse>, String>
pub async fn list_tickets_by_status( &self, building_id: Uuid, status: TicketStatus, ) -> Result<Vec<TicketResponse>, String>
List tickets by status for a building
Sourcepub async fn assign_ticket(
&self,
id: Uuid,
request: AssignTicketRequest,
) -> Result<TicketResponse, String>
pub async fn assign_ticket( &self, id: Uuid, request: AssignTicketRequest, ) -> Result<TicketResponse, String>
Assign a ticket to a user (syndic or contractor)
Sourcepub async fn start_work(&self, id: Uuid) -> Result<TicketResponse, String>
pub async fn start_work(&self, id: Uuid) -> Result<TicketResponse, String>
Start working on a ticket (transition to InProgress)
Sourcepub async fn resolve_ticket(
&self,
id: Uuid,
request: ResolveTicketRequest,
) -> Result<TicketResponse, String>
pub async fn resolve_ticket( &self, id: Uuid, request: ResolveTicketRequest, ) -> Result<TicketResponse, String>
Resolve a ticket (mark as work completed)
Sourcepub async fn close_ticket(&self, id: Uuid) -> Result<TicketResponse, String>
pub async fn close_ticket(&self, id: Uuid) -> Result<TicketResponse, String>
Close a ticket (final validation by requester or syndic)
Sourcepub async fn cancel_ticket(
&self,
id: Uuid,
request: CancelTicketRequest,
) -> Result<TicketResponse, String>
pub async fn cancel_ticket( &self, id: Uuid, request: CancelTicketRequest, ) -> Result<TicketResponse, String>
Cancel a ticket with a reason
Sourcepub async fn reopen_ticket(
&self,
id: Uuid,
request: ReopenTicketRequest,
) -> Result<TicketResponse, String>
pub async fn reopen_ticket( &self, id: Uuid, request: ReopenTicketRequest, ) -> Result<TicketResponse, String>
Reopen a ticket (if incorrectly resolved)
Sourcepub async fn delete_ticket(&self, id: Uuid) -> Result<bool, String>
pub async fn delete_ticket(&self, id: Uuid) -> Result<bool, String>
Delete a ticket (only allowed for Open tickets)
Sourcepub async fn get_ticket_statistics(
&self,
building_id: Uuid,
) -> Result<TicketStatistics, String>
pub async fn get_ticket_statistics( &self, building_id: Uuid, ) -> Result<TicketStatistics, String>
Get ticket statistics for a building
Sourcepub async fn get_overdue_tickets(
&self,
building_id: Uuid,
max_days: i64,
) -> Result<Vec<TicketResponse>, String>
pub async fn get_overdue_tickets( &self, building_id: Uuid, max_days: i64, ) -> Result<Vec<TicketResponse>, String>
Check for overdue tickets (open for more than specified days)
Auto Trait Implementations§
impl Freeze for TicketUseCases
impl !RefUnwindSafe for TicketUseCases
impl Send for TicketUseCases
impl Sync for TicketUseCases
impl Unpin for TicketUseCases
impl !UnwindSafe for TicketUseCases
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<T> Chain<T> for T
impl<T> Chain<T> for T
§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.