34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Fitness_core_BE.Models
|
|
{
|
|
/// <summary>One scheduled, bookable occurrence of a Facility (e.g. "Pool, Tue 6-7pm").
|
|
/// Capacity is enforced by counting non-cancelled Bookings against this row, not by a
|
|
/// denormalized counter, to avoid drift between the two.</summary>
|
|
public class FacilitySession
|
|
{
|
|
[Key]
|
|
public Guid FacilitySessionId { get; set; }
|
|
|
|
public Guid FKFacilityId { get; set; }
|
|
[ForeignKey(nameof(FKFacilityId))]
|
|
public Facility Facility { get; set; }
|
|
|
|
public Guid FKClientId { get; set; }
|
|
[ForeignKey(nameof(FKClientId))]
|
|
public Client Client { get; set; }
|
|
|
|
public DateTime StartTime { get; set; }
|
|
public DateTime EndTime { get; set; }
|
|
|
|
/// <summary>Overrides Facility.DefaultCapacity when set; null = use the facility default.</summary>
|
|
public int? Capacity { get; set; }
|
|
|
|
public bool IsCancelled { get; set; } = false;
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public virtual ICollection<Booking> Bookings { get; set; }
|
|
}
|
|
}
|