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>
81 lines
2.6 KiB
C#
81 lines
2.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Fitness_core_BE.DTOs.Facility
|
|
{
|
|
public class CreateFacilityRequest
|
|
{
|
|
[Required]
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
/// <summary>At least one of SupportsClasses/SupportsBooking must be true.</summary>
|
|
public bool SupportsClasses { get; set; } = true;
|
|
public bool SupportsBooking { get; set; } = false;
|
|
|
|
public string? Description { get; set; }
|
|
|
|
/// <summary>Required (meaningfully) when SupportsClasses.</summary>
|
|
[Range(1, int.MaxValue, ErrorMessage = "DefaultCapacity must be at least 1")]
|
|
public int DefaultCapacity { get; set; } = 1;
|
|
|
|
/// <summary>Required (meaningfully) when SupportsBooking -- e.g. 3 for "3 courts".</summary>
|
|
[Range(1, int.MaxValue, ErrorMessage = "NumberOfUnits must be at least 1")]
|
|
public int NumberOfUnits { get; set; } = 1;
|
|
|
|
[Range(typeof(decimal), "0", "79228162514264337593543950335", ErrorMessage = "PricePerHour cannot be negative")]
|
|
public decimal PricePerHour { get; set; } = 0m;
|
|
}
|
|
|
|
public class UpdateFacilityRequest
|
|
{
|
|
[Required]
|
|
public Guid FacilityId { get; set; }
|
|
public string? Name { get; set; }
|
|
public bool? SupportsClasses { get; set; }
|
|
public bool? SupportsBooking { get; set; }
|
|
public string? Description { get; set; }
|
|
public int? DefaultCapacity { get; set; }
|
|
public int? NumberOfUnits { get; set; }
|
|
public decimal? PricePerHour { get; set; }
|
|
public bool? IsActive { get; set; }
|
|
}
|
|
|
|
public class SetFacilityStatusRequest
|
|
{
|
|
[Required]
|
|
public bool IsActive { get; set; }
|
|
}
|
|
|
|
public class CreateFacilitySessionRequest
|
|
{
|
|
[Required]
|
|
public Guid FacilityId { get; set; }
|
|
|
|
[Required]
|
|
public DateTime StartTime { get; set; }
|
|
|
|
[Required]
|
|
public DateTime EndTime { get; set; }
|
|
|
|
/// <summary>Overrides the facility's default capacity for this specific session.</summary>
|
|
public int? Capacity { get; set; }
|
|
}
|
|
|
|
/// <summary>Absorbed from the old AssignPlaceDeviceRequest.</summary>
|
|
public class AssignFacilityDeviceRequest
|
|
{
|
|
// Null unassigns the facility's current device.
|
|
public Guid? DeviceId { get; set; }
|
|
}
|
|
|
|
public class GetFacilityAvailabilityRequest
|
|
{
|
|
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; }
|
|
}
|
|
}
|