ResourceBookingRepository

Trait ResourceBookingRepository 

Source
pub trait ResourceBookingRepository: Send + Sync {
Show 18 methods // Required methods fn create<'life0, 'life1, 'async_trait>( &'life0 self, booking: &'life1 ResourceBooking, ) -> Pin<Box<dyn Future<Output = Result<ResourceBooking, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_building_and_resource_type<'life0, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_resource<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, resource_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_by_user<'life0, 'async_trait>( &'life0 self, user_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_user_and_status<'life0, 'async_trait>( &'life0 self, user_id: Uuid, status: BookingStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_building_and_status<'life0, 'async_trait>( &'life0 self, building_id: Uuid, status: BookingStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_upcoming<'life0, 'async_trait>( &'life0 self, building_id: Uuid, limit: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_active<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_past<'life0, 'async_trait>( &'life0 self, building_id: Uuid, limit: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_conflicts<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, resource_name: &'life1 str, start_time: DateTime<Utc>, end_time: DateTime<Utc>, exclude_booking_id: Option<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update<'life0, 'life1, 'async_trait>( &'life0 self, booking: &'life1 ResourceBooking, ) -> Pin<Box<dyn Future<Output = Result<ResourceBooking, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn count_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn count_by_building_and_status<'life0, 'async_trait>( &'life0 self, building_id: Uuid, status: BookingStatus, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn count_by_resource<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, resource_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_statistics<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<BookingStatisticsDto, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Repository trait for ResourceBooking persistence operations

Defines the contract for storing and retrieving resource bookings. Implementations must handle conflict detection, statistics, and filtering.

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, booking: &'life1 ResourceBooking, ) -> Pin<Box<dyn Future<Output = Result<ResourceBooking, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new booking

Source

fn find_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find booking by ID

Source

fn find_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all bookings for a building

Source

fn find_by_building_and_resource_type<'life0, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all bookings for a building with a specific resource type

Source

fn find_by_resource<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, resource_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find all bookings for a specific resource (building_id, resource_type, resource_name)

Source

fn find_by_user<'life0, 'async_trait>( &'life0 self, user_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find bookings by user (owner who made the booking)

Source

fn find_by_user_and_status<'life0, 'async_trait>( &'life0 self, user_id: Uuid, status: BookingStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find bookings by user and status

Source

fn find_by_building_and_status<'life0, 'async_trait>( &'life0 self, building_id: Uuid, status: BookingStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find bookings by building and status

Source

fn find_upcoming<'life0, 'async_trait>( &'life0 self, building_id: Uuid, limit: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find upcoming bookings (start_time in the future, status Confirmed or Pending)

Source

fn find_active<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find active bookings (currently in progress: now >= start_time AND now < end_time)

Source

fn find_past<'life0, 'async_trait>( &'life0 self, building_id: Uuid, limit: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find past bookings (end_time < now)

Source

fn find_conflicts<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, resource_name: &'life1 str, start_time: DateTime<Utc>, end_time: DateTime<Utc>, exclude_booking_id: Option<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceBooking>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find conflicting bookings for a time range and resource

Returns bookings that overlap with the given time range for the same resource. Excludes cancelled, completed, and no-show bookings. Excludes the booking with exclude_booking_id (useful for update conflict checks).

Conflict logic: start1 < end2 AND start2 < end1

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, booking: &'life1 ResourceBooking, ) -> Pin<Box<dyn Future<Output = Result<ResourceBooking, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update booking

Source

fn delete<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete booking

Source

fn count_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count total bookings for a building

Source

fn count_by_building_and_status<'life0, 'async_trait>( &'life0 self, building_id: Uuid, status: BookingStatus, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count bookings by building and status

Source

fn count_by_resource<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, resource_type: ResourceType, resource_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count bookings by resource

Source

fn get_statistics<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<BookingStatisticsDto, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get booking statistics for a building

Implementors§