Files
HarithaRandunu 7d8a8478ff 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.
2026-09-29 13:02:52 +05:30

50 lines
2.3 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Fitness_core_BE.Models
{
/// <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>"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 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;
}
}