Skip to content

Commit

Permalink
refactor: 플랜 생성시 응답 데이터 추가 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
junseoparkk committed Jan 16, 2025
1 parent aefd2a2 commit 8760f85
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,35 @@ data class AddPlanInput(
val categories: List<String>,
)

data class AddPlanOutput(
val planId: Long,
)

@Service
class AddPlanUseCase(
private val planStorageGateway: PlanStorageGateway,
) : UseCase<AddPlanInput, Unit> {
) : UseCase<AddPlanInput, AddPlanOutput> {
@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)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package kr.wooco.woocobe.plan.ui.web.controller.response

data class CreatePlanResponse(
val id: Long,
)

0 comments on commit 8760f85

Please sign in to comment.