Skip to content

Commit

Permalink
#2 Food -> Meal 용어 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Qbeom0925 committed Aug 17, 2024
1 parent a61c9ce commit 24f3c1e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ package com.core.adapter.`in`.web

import com.core.adapter.`in`.web.dto.AdapterMealDto
import com.core.application.port.`in`.GetMealUseCase
import com.core.application.port.`in`.dto.ApplicationMealDto
import com.core.common.response.ApplicationResponse
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController


@RestController("/api/v1/foods")
@RestController("/api/v1/meals")
class MealController(private val getMealUseCase: GetMealUseCase) {

@GetMapping
fun getFood() : ApplicationResponse<List<AdapterMealDto.GetFoodRes>> {
fun getMeal() : ApplicationResponse<List<AdapterMealDto.GetMealRes>> {
val data = getMealUseCase.execute()
val toResponse = AdapterMealDto.GetFoodRes.toResponse(data)
val toResponse = AdapterMealDto.GetMealRes.toResponse(data)
return ApplicationResponse.ok(toResponse)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package com.core.adapter.`in`.web.dto

import com.core.application.port.`in`.dto.ApplicationMealDto
import java.time.LocalDateTime

class AdapterMealDto {

data class GetFoodRes(
data class GetMealRes(
val idx: Long,
val type: String,
val status: String,
val meals: String
) {
companion object {
fun toResponse(data: List<ApplicationMealDto.GetFoodRes>) : List<GetFoodRes>{
fun toResponse(data: List<ApplicationMealDto.GetMealRes>) : List<GetMealRes>{
return data.map {
GetFoodRes(
GetMealRes(
idx = it.idx,
type = it.type,
status = it.status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.springframework.stereotype.Service
@Service
class MealReadService : GetMealUseCase {

override fun execute(): List<ApplicationMealDto.GetFoodRes> {
override fun execute(): List<ApplicationMealDto.GetMealRes> {
TODO("Not yet implemented")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import com.core.application.port.`in`.dto.ApplicationMealDto

interface GetMealUseCase {

fun execute(): List<ApplicationMealDto.GetFoodRes>
fun execute(): List<ApplicationMealDto.GetMealRes>

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data class ApplicationMealDto (
val price: Int,
val description: String
) {
data class GetFoodRes(
data class GetMealRes(
val idx: Long,
val type: String,
val status: String,
Expand Down

0 comments on commit 24f3c1e

Please sign in to comment.