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>
72 lines
3.3 KiB
C#
72 lines
3.3 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Fitness_core_BE.DTOs.CustomerPlan
|
|
{
|
|
public class CreateCustomerPlanRequest
|
|
{
|
|
[Required]
|
|
public string PlanName { get; set; } = string.Empty;
|
|
|
|
public string? PlanDescription { get; set; }
|
|
|
|
[Required]
|
|
[Range(0, double.MaxValue, ErrorMessage = "Plan price must be a positive value")]
|
|
public decimal PlanPrice { get; set; }
|
|
|
|
public bool? HasOnboardingFee { get; set; }
|
|
|
|
[Range(0, double.MaxValue, ErrorMessage = "Onboarding fee must be zero or greater")]
|
|
public decimal? OnboardingFeeAmount { get; set; }
|
|
|
|
/// <summary>Required when DurationMode is "Rolling" (validated in the service).</summary>
|
|
[Range(1, int.MaxValue, ErrorMessage = "Duration must be at least 1 day")]
|
|
public int? DurationInDays { get; set; }
|
|
|
|
/// <summary>"Individual" (default) | "Group".</summary>
|
|
public string? PlanScope { get; set; }
|
|
|
|
/// <summary>Required >= 2 when PlanScope is "Group".</summary>
|
|
public int? MemberLimit { get; set; }
|
|
|
|
/// <summary>"Rolling" (default) | "FixedRange".</summary>
|
|
public string? DurationMode { get; set; }
|
|
|
|
public DateTime? ValidFrom { get; set; }
|
|
public DateTime? ValidTo { get; set; }
|
|
|
|
public bool? AllowSplitPayments { get; set; }
|
|
|
|
/// <summary>Number of mostly-equal installments; defaults to plan duration in months when split is enabled.</summary>
|
|
public int? InstallmentCount { get; set; }
|
|
|
|
/// <summary>Null (default) = unlimited-access plan. A number = this plan grants that
|
|
/// many bookable Facility sessions per billing cycle (e.g. "4 pool sessions a month").</summary>
|
|
[Range(1, int.MaxValue, ErrorMessage = "SessionsPerCycle must be at least 1 when set")]
|
|
public int? SessionsPerCycle { get; set; }
|
|
|
|
/// <summary>"NoRollover" (default) | "GracePeriod". Only meaningful when SessionsPerCycle is set.</summary>
|
|
public string? SessionRolloverPolicy { get; set; }
|
|
|
|
/// <summary>Required (>= 1) when SessionRolloverPolicy is "GracePeriod".</summary>
|
|
[Range(0, int.MaxValue, ErrorMessage = "RolloverGraceDays must be zero or greater")]
|
|
public int? RolloverGraceDays { get; set; }
|
|
|
|
/// <summary>"Prepaid" (default, pay before the cycle starts) | "Postpaid" (use first,
|
|
/// invoice at cycle end, access suspended if unpaid past due). Asked once per package.</summary>
|
|
public string? BillingTiming { get; set; }
|
|
|
|
/// <summary>Places this plan grants access to. Null/omitted or empty = unrestricted
|
|
/// (reaches every active access device, today's behavior).</summary>
|
|
public List<Guid>? PlaceIds { get; set; }
|
|
|
|
/// <summary>Set only by the Classes tab's "Manage Plan" action -- links this new plan to
|
|
/// one class via CustomerPlanClass. Omitted for an ordinary gym plan.</summary>
|
|
public Guid? FacilityClassId { get; set; }
|
|
|
|
/// <summary>Only meaningful when FacilityClassId is set -- whether this class plan also
|
|
/// grants general gym-floor access ("class + gym" as one product) instead of class-only.
|
|
/// Defaults to false (class-only) when omitted.</summary>
|
|
public bool? GrantsGymAccess { get; set; }
|
|
}
|
|
}
|