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:
@@ -32,6 +32,18 @@ namespace Fitness_core_BE.Controllers
|
||||
public async Task<ActionResult<ApiResponse<object>>> CreateMemberBooking([FromBody] CreateMemberBookingRequest request)
|
||||
=> Response(await _bookingService.CreateMemberBooking(new { facilitySessionId = request.FacilitySessionId }, HttpContext));
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[HttpPost("api/app/bookings/adhoc")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> CreateMemberAdhocBooking([FromBody] CreateAdhocBookingRequest request)
|
||||
=> Response(await _bookingService.CreateMemberAdhocBooking(new
|
||||
{
|
||||
facilityId = request.FacilityId,
|
||||
startTime = request.StartTime.ToString("o"),
|
||||
durationMinutes = request.DurationMinutes,
|
||||
partySize = request.PartySize
|
||||
}, HttpContext));
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[HttpGet("api/app/bookings/mine")]
|
||||
@@ -56,6 +68,19 @@ namespace Fitness_core_BE.Controllers
|
||||
guestPhone = request.GuestPhone
|
||||
}, HttpContext));
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("api/public/bookings/guest/adhoc")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> CreateGuestAdhocBooking([FromBody] CreateGuestAdhocBookingRequest request)
|
||||
=> Response(await _bookingService.CreateGuestAdhocBooking(new
|
||||
{
|
||||
facilityId = request.FacilityId,
|
||||
startTime = request.StartTime.ToString("o"),
|
||||
durationMinutes = request.DurationMinutes,
|
||||
guestName = request.GuestName,
|
||||
guestPhone = request.GuestPhone,
|
||||
partySize = request.PartySize
|
||||
}, HttpContext));
|
||||
|
||||
// The actual "copy the link and share it" page -- BookingDto.ShareUrl points here.
|
||||
// Plain HTML, not the JSON ApiResponse envelope, since this is meant to be opened
|
||||
// directly in a browser (or a chat app's link preview), not consumed by a client SDK.
|
||||
@@ -72,6 +97,24 @@ namespace Fitness_core_BE.Controllers
|
||||
|
||||
// ---------- Staff ----------
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[RequiresPermission("bookings")]
|
||||
[HttpGet("api/client/bookings")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> GetBookings(
|
||||
[FromQuery] Guid? facilityId, [FromQuery] Guid? facilitySessionId,
|
||||
[FromQuery] DateTime? fromDate, [FromQuery] DateTime? toDate, [FromQuery] string? status)
|
||||
=> Response(await _bookingService.GetBookings(new
|
||||
{
|
||||
facilityId,
|
||||
facilitySessionId,
|
||||
fromDate = fromDate?.ToString("o"),
|
||||
toDate = toDate?.ToString("o"),
|
||||
status
|
||||
}, HttpContext));
|
||||
|
||||
// Kept as a thin backward-compat wrapper around the unified GetBookings above --
|
||||
// prefer GET api/client/bookings?facilitySessionId= going forward.
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[RequiresPermission("bookings")]
|
||||
@@ -84,7 +127,7 @@ namespace Fitness_core_BE.Controllers
|
||||
[RequiresPermission("bookings")]
|
||||
[HttpPost("api/client/bookings/check-in")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> CheckInBooking([FromBody] CheckInBookingRequest request)
|
||||
=> Response(await _bookingService.CheckInBooking(new { otpCode = request.OtpCode }, HttpContext));
|
||||
=> Response(await _bookingService.CheckInBooking(new { otpCode = request.OtpCode, rfidTagId = request.RfidTagId }, HttpContext));
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
@@ -99,5 +142,44 @@ namespace Fitness_core_BE.Controllers
|
||||
[HttpPost("api/client/bookings/{id:guid}/cancel")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> CancelBooking(Guid id)
|
||||
=> Response(await _bookingService.CancelBooking(new { bookingId = id }, HttpContext));
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[RequiresPermission("bookings")]
|
||||
[HttpPut("api/client/bookings/{id:guid}/reassign")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> ReassignBooking(Guid id, [FromBody] ReassignBookingRequest request)
|
||||
=> Response(await _bookingService.ReassignBooking(new
|
||||
{
|
||||
bookingId = id,
|
||||
guestName = request.GuestName,
|
||||
guestPhone = request.GuestPhone
|
||||
}, HttpContext));
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[RequiresPermission("bookings")]
|
||||
[HttpPut("api/client/bookings/{id:guid}/reschedule")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> RescheduleBooking(Guid id, [FromBody] RescheduleBookingRequest request)
|
||||
=> Response(await _bookingService.RescheduleBooking(new
|
||||
{
|
||||
bookingId = id,
|
||||
startTime = request.StartTime?.ToString("o"),
|
||||
durationMinutes = request.DurationMinutes,
|
||||
facilitySessionId = request.FacilitySessionId
|
||||
}, HttpContext));
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[RequiresPermission("bookings")]
|
||||
[HttpPost("api/client/bookings/{id:guid}/no-show")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> MarkNoShow(Guid id)
|
||||
=> Response(await _bookingService.MarkNoShow(new { bookingId = id }, HttpContext));
|
||||
|
||||
[CustomMiddleware]
|
||||
[TenantResolution]
|
||||
[RequiresPermission("bookings")]
|
||||
[HttpPost("api/client/bookings/{id:guid}/complete")]
|
||||
public async Task<ActionResult<ApiResponse<object>>> CompleteBooking(Guid id)
|
||||
=> Response(await _bookingService.CompleteBooking(new { bookingId = id }, HttpContext));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user