Skip to content

Commit

Permalink
feat: Add checking event on going
Browse files Browse the repository at this point in the history
  • Loading branch information
210-reverof committed Aug 19, 2024
1 parent fb896c4 commit 03a39be
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.mashup.pic.event.applicationService

import com.mashup.pic.common.exception.PicException
import com.mashup.pic.common.exception.PicExceptionType
import com.mashup.pic.domain.event.EventService
import com.mashup.pic.domain.event.EventStatus
import com.mashup.pic.domain.event.UploadService
import com.mashup.pic.event.applicationService.dto.CreateEventServiceRequest
import com.mashup.pic.event.applicationService.dto.MarkEventVisitedServiceRequest
Expand All @@ -19,6 +22,11 @@ class EventApplicationService(
) {
@Transactional
fun create(request: CreateEventServiceRequest): CreateEventResponse {
val lastEvent = eventService.getLastEvent(request.groupId)
if (lastEvent != null && lastEvent.eventStatus != EventStatus.COMPLETE) {
throw PicException.of(PicExceptionType.ARGUMENT_NOT_VALID, "이미 진행하고 있는 이벤트 존재")
}

val savedEvent =
CreateEventResponse(
eventService.create(
Expand Down

0 comments on commit 03a39be

Please sign in to comment.