diff --git a/src/main/kotlin/kr/wooco/woocobe/plan/domain/usecase/AddPlanUseCase.kt b/src/main/kotlin/kr/wooco/woocobe/plan/domain/usecase/AddPlanUseCase.kt index d5aa580..b7366b8 100644 --- a/src/main/kotlin/kr/wooco/woocobe/plan/domain/usecase/AddPlanUseCase.kt +++ b/src/main/kotlin/kr/wooco/woocobe/plan/domain/usecase/AddPlanUseCase.kt @@ -19,26 +19,35 @@ data class AddPlanInput( val categories: List, ) +data class AddPlanOutput( + val planId: Long, +) + @Service class AddPlanUseCase( private val planStorageGateway: PlanStorageGateway, -) : UseCase { +) : UseCase { @Transactional - override fun execute(input: AddPlanInput) { + override fun execute(input: AddPlanInput): AddPlanOutput { val region = PlanRegion( primaryRegion = input.primaryRegion, secondaryRegion = input.secondaryRegion, ) - val plan = Plan.register( - userId = input.userId, - title = input.title, - description = input.description, - region = region, - visitDate = input.visitDate, - placeIds = input.placeIds, - categories = input.categories, + val plan = planStorageGateway.save( + Plan.register( + userId = input.userId, + title = input.title, + description = input.description, + region = region, + visitDate = input.visitDate, + placeIds = input.placeIds, + categories = input.categories, + ), + ) + + return AddPlanOutput( + planId = plan.id, ) - planStorageGateway.save(plan) } } diff --git a/src/main/kotlin/kr/wooco/woocobe/plan/ui/web/controller/response/CreatePlanResponse.kt b/src/main/kotlin/kr/wooco/woocobe/plan/ui/web/controller/response/CreatePlanResponse.kt new file mode 100644 index 0000000..9b0c997 --- /dev/null +++ b/src/main/kotlin/kr/wooco/woocobe/plan/ui/web/controller/response/CreatePlanResponse.kt @@ -0,0 +1,5 @@ +package kr.wooco.woocobe.plan.ui.web.controller.response + +data class CreatePlanResponse( + val id: Long, +)