5d711bd13e
Implements the facility-classes-booking-dashboard plan (backend): - Facility.BookingMode (single Scheduled/AdHoc choice) replaced with independent SupportsClasses/SupportsBooking flags, so one facility can run a class and accept walk-in bookings; a running class now blocks walk-in booking for its window on both create and reschedule. - CustomerPlan.GrantsGymAccess + CustomerPlanClass join table let a customer hold one gym-access plan plus any number of class-only plans. Replaced the old single-subscription resolution (GetActiveSubscriptionByCustomerId/HasAnyActiveSubscriptionAsync) with gym-access-aware and class-aware resolvers across booking creation/cancellation, plan assignment, and customer self-service. Fixed ChangeMembershipPlan/renewal plan-changes, which resolved "the subscription to replace" by most-recent-created and would have deactivated a member's class subscription instead of their gym one. - New FacilityClass model: recurring class definitions (Daily/Weekly/ Monthly/Custom) with lazy occurrence generation (8-week horizon, race-safe via a unique index) and proper unlimited-capacity handling. "Mark not held" replaces the old bare-cancel: cascades to cancel and refund every confirmed booking on the occurrence through the same core CancelBooking uses, and frees the slot for walk-in booking. Scheduling conflicts (a walk-in booking now overlapping a class) are surfaced for staff to resolve via the existing Reschedule flow. - Renamed the pre-existing "AdHoc" booking-mode terminology to "WalkIn" throughout (routes, methods, DTOs, the stored BookingMode value) for a clearer, simpler name. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
134 lines
4.7 KiB
C#
134 lines
4.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Fitness_core_BE.DTOs.Booking
|
|
{
|
|
public class CreateMemberBookingRequest
|
|
{
|
|
[Required]
|
|
public Guid FacilitySessionId { get; set; }
|
|
}
|
|
|
|
public class CreateGuestBookingRequest
|
|
{
|
|
[Required]
|
|
public Guid FacilitySessionId { get; set; }
|
|
|
|
[Required]
|
|
public string GuestName { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public string GuestPhone { get; set; } = string.Empty;
|
|
|
|
/// <summary>Optional link to an existing registered customer (TenantCustomerLinkId) when
|
|
/// staff recognizes the walk-in as an already-registered member -- purely for
|
|
/// identification/auto-fill, doesn't change payment/membership handling at all.</summary>
|
|
public Guid? CustomerId { get; set; }
|
|
}
|
|
|
|
public class CreateWalkInBookingRequest
|
|
{
|
|
[Required]
|
|
public Guid FacilityId { get; set; }
|
|
|
|
[Required]
|
|
public DateTime StartTime { get; set; }
|
|
|
|
[Required, Range(1, int.MaxValue, ErrorMessage = "DurationMinutes must be at least 1")]
|
|
public int DurationMinutes { get; set; }
|
|
|
|
public int? PartySize { get; set; }
|
|
}
|
|
|
|
public class CreateGuestWalkInBookingRequest
|
|
{
|
|
[Required]
|
|
public Guid FacilityId { get; set; }
|
|
|
|
[Required]
|
|
public DateTime StartTime { get; set; }
|
|
|
|
[Required, Range(1, int.MaxValue, ErrorMessage = "DurationMinutes must be at least 1")]
|
|
public int DurationMinutes { get; set; }
|
|
|
|
[Required]
|
|
public string GuestName { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public string GuestPhone { get; set; } = string.Empty;
|
|
|
|
public int? PartySize { get; set; }
|
|
|
|
/// <summary>Overrides the facility's own PricePerHour for this booking's charge only --
|
|
/// the FE pre-fills this from the facility but lets staff adjust it.</summary>
|
|
[Range(typeof(decimal), "0", "79228162514264337593543950335", ErrorMessage = "PricePerHour cannot be negative")]
|
|
public decimal? PricePerHour { get; set; }
|
|
|
|
/// <summary>Optional link to an existing registered customer -- see
|
|
/// CreateGuestBookingRequest.CustomerId.</summary>
|
|
public Guid? CustomerId { get; set; }
|
|
}
|
|
|
|
public class MarkGuestBookingPaidRequest
|
|
{
|
|
[Required]
|
|
public Guid BookingId { get; set; }
|
|
|
|
[Required]
|
|
[Range(0.01, double.MaxValue, ErrorMessage = "AmountCharged must be greater than zero")]
|
|
public decimal AmountCharged { get; set; }
|
|
|
|
/// <summary>"Cash" | "Bank". Defaults to "Cash" if omitted.</summary>
|
|
public string? PaymentMethod { get; set; }
|
|
}
|
|
|
|
/// <summary>Body for POST .../complete. Only required when the booking is a guest booking
|
|
/// still Unpaid -- see BookingService.CompleteBooking. Ignored otherwise (member bookings,
|
|
/// or a guest booking already Paid).</summary>
|
|
public class CompleteBookingRequest
|
|
{
|
|
public bool? MarkPaid { get; set; }
|
|
public decimal? AmountCollected { get; set; }
|
|
/// <summary>"Cash" | "Bank". Defaults to "Cash" if omitted.</summary>
|
|
public string? PaymentMethod { get; set; }
|
|
}
|
|
|
|
public class CheckInBookingRequest
|
|
{
|
|
[Required]
|
|
public string OtpCode { get; set; } = string.Empty;
|
|
|
|
/// <summary>Picked from the club's managed RFID tag pool (GET api/client/rfid-tags?
|
|
/// status=Available) -- never free-typed. Required in practice for a WalkIn booking's
|
|
/// check-in; optional for Scheduled bookings that don't hand out a physical tag.</summary>
|
|
public Guid? RfidTagId { get; set; }
|
|
}
|
|
|
|
public class CancelBookingRequest
|
|
{
|
|
[Required]
|
|
public Guid BookingId { get; set; }
|
|
}
|
|
|
|
public class ReassignBookingRequest
|
|
{
|
|
public string? GuestName { get; set; }
|
|
public string? GuestPhone { get; set; }
|
|
}
|
|
|
|
/// <summary>Exactly one shape applies, matching the booking's current BookingMode: WalkIn
|
|
/// bookings move within the SAME facility to a new StartTime/DurationMinutes; Scheduled
|
|
/// bookings move to a different FacilitySession (also on the same facility). Only allowed
|
|
/// while the booking is still Confirmed, and only onto a slot with room -- re-runs the same
|
|
/// availability check as creation, excluding the booking's own current slot.</summary>
|
|
public class RescheduleBookingRequest
|
|
{
|
|
// WalkIn reschedule.
|
|
public DateTime? StartTime { get; set; }
|
|
[Range(1, int.MaxValue, ErrorMessage = "DurationMinutes must be at least 1")]
|
|
public int? DurationMinutes { get; set; }
|
|
|
|
// Scheduled reschedule.
|
|
public Guid? FacilitySessionId { get; set; }
|
|
}
|
|
}
|