Skip to content

Commit

Permalink
Fix | CAKK-94 | 필요 없는 dto 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
YongsHub committed Oct 17, 2024
1 parent 7f928f8 commit f4cf301
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 36 deletions.

This file was deleted.

27 changes: 8 additions & 19 deletions cakk-core/src/main/kotlin/com/cakk/core/mapper/CakeMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,14 @@ package com.cakk.core.mapper
import java.util.*

import com.cakk.core.dto.response.cake.CakeDetailResponse
import com.cakk.core.dto.response.cake.CakeImageListResponse
import com.cakk.core.dto.response.cake.CakeImageWithShopInfoListResponse
import com.cakk.core.dto.response.like.HeartCakeImageListResponse
import com.cakk.domain.mysql.dto.param.cake.CakeDetailParam
import com.cakk.domain.mysql.dto.param.cake.CakeImageResponseParam
import com.cakk.domain.mysql.dto.param.cake.CakeImageWithShopInfoResponseParam
import com.cakk.domain.mysql.dto.param.like.HeartCakeImageResponseParam
import com.cakk.domain.mysql.dto.param.tag.TagParam
import com.cakk.domain.mysql.entity.cake.Cake

fun supplyCakeImageListResponse(cakeImages: List<CakeImageResponseParam>): CakeImageListResponse {
val size = cakeImages.size

return CakeImageListResponse(
cakeImages,
if (cakeImages.isEmpty()) null else cakeImages[size - 1].cakeId,
cakeImages.size
)
}

fun supplyCakeImageWithShopInfoListResponse(
cakeImages: List<CakeImageWithShopInfoResponseParam>
Expand All @@ -35,23 +24,23 @@ fun supplyCakeImageWithShopInfoListResponse(
)
}

fun supplyCakeImageListResponse(
cakeImages: List<CakeImageResponseParam>,
fun supplyCakeImageWithShopInfoListResponse(
cakeImages: List<CakeImageWithShopInfoResponseParam>,
cakeIds: List<Long>
): CakeImageListResponse {
val sortedCakeImages: MutableList<CakeImageResponseParam> = ArrayList()
): CakeImageWithShopInfoListResponse {
val sortedCakeImages: MutableList<CakeImageWithShopInfoResponseParam> = ArrayList()

for (cakeId in cakeIds) {
cakeImages.stream()
.filter { cakeImage: CakeImageResponseParam -> cakeImage.cakeId == cakeId }
.filter { cakeImage: CakeImageWithShopInfoResponseParam -> cakeImage.cakeId == cakeId }
.findFirst()
.ifPresent { e: CakeImageResponseParam -> sortedCakeImages.add(e) }
.ifPresent { e: CakeImageWithShopInfoResponseParam -> sortedCakeImages.add(e) }
}

return CakeImageListResponse(
return CakeImageWithShopInfoListResponse(
sortedCakeImages,
null,
sortedCakeImages.size
cakeImages.size
)
}

Expand Down

This file was deleted.

0 comments on commit f4cf301

Please sign in to comment.