Files
Core_Be/Interfaces/IBookingRepository.cs
HarithaRandunu 51f0021e27 feat: Enhance booking functionality with invoice management and dashboard summary
- Added customerId to guest booking requests for better identification.
- Implemented new endpoints for managing booking invoices and dashboard summaries.
- Created BookingInvoice and BookingDashboardSummary DTOs to support new features.
- Updated Booking and BookingInvoice models to include payment method and timestamps.
- Enhanced BookingService to handle invoice creation upon payment confirmation.
- Modified BookingRepository to support CRUD operations for BookingInvoice.
- Updated TenantDbContext to include BookingInvoice DbSet and relevant configurations.
- Improved error handling and validation for booking completion and payment processes.
2026-10-01 03:46:03 +05:30

50 lines
2.6 KiB
C#

using Fitness_core_BE.Models;
namespace Fitness_core_BE.Interfaces
{
public interface IBookingRepository
{
Task<Booking> CreateBooking(Booking booking);
Task<Booking?> GetBookingById(Guid bookingId);
// "Confirmed" only -- an OTP that's already been used/cancelled shouldn't check anyone in.
Task<Booking?> GetActiveBookingByOtp(string otpCode);
Task<List<Booking>> GetBookingsForSession(Guid facilitySessionId);
Task<List<Booking>> GetBookingsForCustomer(Guid customerId);
Task<bool> CustomerHasActiveBookingForSession(Guid facilitySessionId, Guid customerId);
/// <summary>Unified roster query covering both Scheduled and AdHoc bookings -- backs
/// GET api/client/bookings. All filters are optional/AND-combined.</summary>
Task<List<Booking>> GetBookings(Guid clientId, Guid? facilityId, Guid? facilitySessionId, DateTime? fromUtc, DateTime? toUtc, string? status);
// --- Lazy overdue reconciliation (BookingService.SweepOverdueBookingsAsync), run at the
// top of every check-in AND every checkout instead of a background job -- see
// Booking.Status doc comment. ---
/// <summary>Bulk-flips every Confirmed booking for this client whose EndTime has passed
/// to NoShow. Returns the number of rows affected (informational/logging only).</summary>
Task<int> MarkOverdueConfirmedAsNoShowAsync(Guid clientId, DateTime now);
/// <summary>Atomically flips a tag from Available to InUse -- the ONE place a real race
/// matters (two staff picking the same tag for two different bookings must not both
/// win), so this uses a conditional bulk update rather than read-then-write. Returns
/// false if the tag was no longer Available.</summary>
Task<bool> TryClaimRfidTagAsync(Guid tagId, DateTime now);
// --- Booking invoices (snapshot receipts created when a payment is recorded) ---
Task<BookingInvoice> CreateBookingInvoice(BookingInvoice invoice);
/// <summary>Listed on their own "Invoices" tab -- deliberately not mixed into the
/// membership-based Customer Payments view.</summary>
Task<List<BookingInvoice>> GetBookingInvoices(Guid clientId, DateTime? fromUtc, DateTime? toUtc);
Task<BookingInvoice?> GetBookingInvoiceById(Guid bookingInvoiceId);
/// <summary>Aggregate counts/sums backing the Bookings page's Dashboard tab.</summary>
Task<(int bookingsToday, decimal revenueToday, int checkedInNow, int upcomingConfirmed, decimal outstandingUnpaid)>
GetDashboardSummaryAsync(Guid clientId, DateTime now);
}
}