Skip to content

Commit e384909

Browse files
authored
Merge pull request #42 from CodIN-INU/develop
fix: 티켓팅 참여시 이벤트 상태 검증 로직 추가
2 parents 8108e24 + 37c51e9 commit e384909

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/inu/codin/codinticketingapi/domain/ticketing/service/ParticipationService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package inu.codin.codinticketingapi.domain.ticketing.service;
22

33
import inu.codin.codinticketingapi.domain.admin.entity.Event;
4+
import inu.codin.codinticketingapi.domain.admin.entity.EventStatus;
45
import inu.codin.codinticketingapi.domain.ticketing.dto.event.ParticipationCreatedEvent;
56
import inu.codin.codinticketingapi.domain.ticketing.dto.response.ParticipationResponse;
67
import inu.codin.codinticketingapi.domain.ticketing.entity.Participation;
7-
import inu.codin.codinticketingapi.domain.ticketing.entity.ParticipationStatus;
88
import inu.codin.codinticketingapi.domain.ticketing.entity.Stock;
99
import inu.codin.codinticketingapi.domain.ticketing.exception.TicketingErrorCode;
1010
import inu.codin.codinticketingapi.domain.ticketing.exception.TicketingException;
@@ -58,6 +58,11 @@ public ParticipationResponse saveParticipation(Long eventId) {
5858
// 이미 참여한 경우 기존 참여 내용 반환
5959
return ParticipationResponse.of(existingParticipation.get());
6060
}
61+
62+
// 이벤트 상태 검증
63+
if (!event.getEventStatus().equals(EventStatus.ACTIVE)) {
64+
throw new TicketingException(TicketingErrorCode.EVENT_NOT_ACTIVE);
65+
}
6166
// 재고 줄임
6267
Stock stock = ticketingService.decrement(eventId);
6368

0 commit comments

Comments
 (0)