Skip to content

Commit

Permalink
update overlap check message
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueHorn07 committed Jul 30, 2023
1 parent e7a8ea5 commit f344c80
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/popo/reservation/place/reserve.place.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ReservePlaceService {
date: string,
start_time: string,
end_time: string,
): Promise<boolean> {
): Promise<ReservePlace | null> {
const booked_reservations = await this.find({
place_id: place_id,
date: date,
Expand All @@ -45,10 +45,10 @@ export class ReservePlaceService {
reservation.start_time < end_time && start_time < reservation.end_time;

if (isOverlap) {
return true;
return reservation;
}
}
return false;
return null;
}

async save(dto: CreateReservePlaceDto) {
Expand All @@ -73,7 +73,9 @@ export class ReservePlaceService {
end_time,
);
if (isReservationOverlap) {
throw new BadRequestException(Message.OVERLAP_RESERVATION);
throw new BadRequestException(
`${Message.OVERLAP_RESERVATION}: ${isReservationOverlap.date} ${isReservationOverlap.start_time} ~ ${isReservationOverlap.end_time}`
);
}

// Reservation Duration Check
Expand Down

0 comments on commit f344c80

Please sign in to comment.