Refactor CustomerPlanService to use FacilityRepository, remove PlaceService, and introduce RfidTagService
- Updated CustomerPlanService to replace references to PlaceRepo with FacilityRepository for managing customer plans and associated facilities. - Removed PlaceService and its related methods, consolidating functionality into FacilityService. - Added RfidTagService for managing RFID tags, including methods for creating, updating, and setting statuses of tags. - Updated TenantDbContext to include new DbSet for RfidTags and CustomerPlanFacilities, and adjusted model configurations accordingly. - Enhanced FacilityService to support new booking modes and validation for facility creation and updates.
This commit is contained in:
+25
-8
@@ -3,29 +3,46 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Fitness_core_BE.Models
|
||||
{
|
||||
/// <summary>A bookable area of the club — the gym floor, the pool, a court, a class type
|
||||
/// (karate, etc). Gym-floor access itself keeps working through the existing
|
||||
/// CustomerPlan/Attendance flow unchanged; Facility/FacilitySession/Booking below are for
|
||||
/// the new capacity-limited, session-based areas (pool, courts, classes).</summary>
|
||||
/// <summary>A physical area of the club (e.g. "Pool Area", "Indoor Gym", "Court 1") that can
|
||||
/// both be booked (Booking/FacilitySession below) and fitted with its own fingerprint/face
|
||||
/// terminal for membership-plan access scoping (AccessDevice.FKFacilityId,
|
||||
/// CustomerPlanFacility). Merged from the formerly-separate Facility (bookable capacity) and
|
||||
/// Place (access zone) concepts -- see the booking redesign plan for the migration that
|
||||
/// carried Place's rows over reusing this table's original PlaceId values as FacilityId.</summary>
|
||||
public class Facility
|
||||
{
|
||||
[Key]
|
||||
public Guid FacilityId { get; set; }
|
||||
|
||||
public Guid FKClientId { get; set; }
|
||||
[ForeignKey(nameof(FKClientId))]
|
||||
public Client Client { get; set; }
|
||||
|
||||
[MaxLength(128)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>"Gym" | "Pool" | "Court" | "Class" — informational grouping for the admin
|
||||
/// UI; booking rules themselves live on FacilitySession/CustomerPlan, not on this type.</summary>
|
||||
public string FacilityType { get; set; } = "Class";
|
||||
/// <summary>"Scheduled" | "AdHoc". Scheduled: staff pre-creates fixed-time
|
||||
/// FacilitySessions that many bookings share one capacity pool against (classes).
|
||||
/// AdHoc: a booking claims one of NumberOfUnits identical units directly for an
|
||||
/// arbitrary time window, no pre-created session needed (courts/pool).</summary>
|
||||
public string BookingMode { get; set; } = "Scheduled";
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>Default per-session headcount limit; a specific FacilitySession can override.</summary>
|
||||
/// <summary>Default per-session headcount limit when BookingMode == "Scheduled"; a
|
||||
/// specific FacilitySession can override.</summary>
|
||||
public int DefaultCapacity { get; set; } = 1;
|
||||
|
||||
/// <summary>Number of identical, independently-bookable units when BookingMode ==
|
||||
/// "AdHoc" (e.g. 3 for "3 courts") -- availability is this minus overlapping
|
||||
/// non-cancelled/non-completed AdHoc bookings in the requested window.</summary>
|
||||
public int NumberOfUnits { get; set; } = 1;
|
||||
|
||||
/// <summary>Hourly rate used to compute a guest AdHoc booking's suggested AmountCharged
|
||||
/// (PricePerHour * duration-in-hours) at creation time.</summary>
|
||||
public decimal PricePerHour { get; set; } = 0m;
|
||||
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user