-
Notifications
You must be signed in to change notification settings - Fork 0
chore: patch cancel #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
91e372e
d49a736
7e7624c
8c98ace
0b41a76
2601512
24eed32
feb8176
782be08
01b91ef
e974eac
aeb7e81
9e1eee1
c2b6e7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -63,12 +63,11 @@ public async Task<ActionResult<Booking>> CreateBooking([FromBody] BookingReqDto | |||||||
| await emailQueue.WriteAsync(booking.BookingId); | ||||||||
| return Ok(booking); | ||||||||
| } | ||||||||
|
|
||||||||
| [HttpPut("{bookingId}", Name = "UpdateBooking")] | ||||||||
| public async Task<ActionResult> UpdateBooking(string bookingId, | ||||||||
| [FromBody] BookingReqDto bookingReqDto) { | ||||||||
|
|
||||||||
| [HttpPatch("{bookingId}/cancel", Name = "CancelBooking")] | ||||||||
| public async Task<ActionResult> CancelBooking(string bookingId) { | ||||||||
| Booking? booking = await bookingService.GetBooking(bookingId); | ||||||||
| if (booking is null) { | ||||||||
| if (booking?.Gathering is null) { | ||||||||
| return NotFound(); | ||||||||
| } | ||||||||
|
|
||||||||
|
|
@@ -78,7 +77,8 @@ public async Task<ActionResult> UpdateBooking(string bookingId, | |||||||
| return Forbid(); | ||||||||
| } | ||||||||
|
|
||||||||
| booking = await bookingService.UpdateBooking(bookingId, bookingReqDto); | ||||||||
| booking.CancellationDateTime = DateTimeOffset.UtcNow; | ||||||||
| booking = await bookingService.UpdateBooking(bookingId, bookingReqDto: booking.ToBookingDto()); | ||||||||
|
Comment on lines
+80
to
+81
|
||||||||
| booking.CancellationDateTime = DateTimeOffset.UtcNow; | |
| booking = await bookingService.UpdateBooking(bookingId, bookingReqDto: booking.ToBookingDto()); | |
| booking = await bookingService.CancelBooking(bookingId); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,7 @@ namespace Evently.Server.Features.Gatherings.Controllers; | |||||
| [ApiController] | ||||||
| [Route("api/v1/[controller]")] | ||||||
| public sealed class GatheringsController( | ||||||
| ILogger<GatheringsController> logger, | ||||||
| IGatheringService gatheringService, | ||||||
| IFileStorageService fileStorageService) : ControllerBase { | ||||||
| [HttpGet("{gatheringId:long}", Name = "GetGathering")] | ||||||
|
|
@@ -31,7 +32,9 @@ public async Task<ActionResult<List<Gathering>>> GetGatherings(string? attendeeI | |||||
| string? name, | ||||||
| DateTimeOffset? startDateBefore, DateTimeOffset? startDateAfter, DateTimeOffset? endDateBefore, DateTimeOffset? endDateAfter, | ||||||
| bool? isCancelled, | ||||||
| long[]? categoryIds, | ||||||
| int? offset, int? limit) { | ||||||
| logger.LogInformation("categoryIds: {}", string.Join(",", categoryIds ?? [])); | ||||||
|
||||||
| logger.LogInformation("categoryIds: {}", string.Join(",", categoryIds ?? [])); | |
| logger.LogDebug("categoryIds: {}", string.Join(",", categoryIds ?? [])); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CancelBooking method is still calling UpdateBooking internally after setting CancellationDateTime. Consider creating a dedicated CancelBooking method in the service layer to maintain separation of concerns and make the intent clearer.