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

80 lines
2.5 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace Fitness_core_BE.DTOs.Facility
{
public class CreateFacilityRequest
{
[Required]
public string Name { get; set; } = string.Empty;
/// <summary>"Scheduled" | "AdHoc".</summary>
[Required]
public string BookingMode { get; set; } = "Scheduled";
public string? Description { get; set; }
/// <summary>Required (meaningfully) when BookingMode == "Scheduled".</summary>
[Range(1, int.MaxValue, ErrorMessage = "DefaultCapacity must be at least 1")]
public int DefaultCapacity { get; set; } = 1;
/// <summary>Required (meaningfully) when BookingMode == "AdHoc" -- 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 string? BookingMode { 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; }
}
}