Skip to content

Commit b824996

Browse files
eugbyteCopilot
andauthored
Update src/Evently.Server/Features/Bookings/Services/BookingService.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2f21f26 commit b824996

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Evently.Server/Features/Bookings/Services/BookingService.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ public async Task<Booking> CreateBooking(BookingReqDto bookingReqDto) {
7171
throw new ArgumentException(string.Join("\n", values: validationResult.Errors.Select(e => e.ErrorMessage)));
7272
}
7373

74-
bool hasPrevBooking =
75-
await db.Bookings.AnyAsync(b => b.AccountId == booking.AccountId && b.GatheringId == booking.GatheringId && b.CancellationDateTime == null);
76-
if (hasPrevBooking) {
77-
throw new ArgumentException("Account has already booked");
74+
throw new ArgumentException($"Account has already booked this gathering (GatheringId: {booking.GatheringId})");
7875
}
7976

8077
booking.BookingId = $"book_{await Nanoid.GenerateAsync(size: 10)}";

0 commit comments

Comments
 (0)