diff --git a/cakk-core/src/main/kotlin/com/cakk/core/dto/response/cake/CakeImageListResponse.kt b/cakk-core/src/main/kotlin/com/cakk/core/dto/response/cake/CakeImageListResponse.kt deleted file mode 100644 index 3440bf27..00000000 --- a/cakk-core/src/main/kotlin/com/cakk/core/dto/response/cake/CakeImageListResponse.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.cakk.core.dto.response.cake - -import com.cakk.domain.mysql.dto.param.cake.CakeImageResponseParam - -data class CakeImageListResponse( - val cakeImages: List, - val lastCakeId: Long?, - val size: Int -) diff --git a/cakk-core/src/main/kotlin/com/cakk/core/mapper/CakeMapper.kt b/cakk-core/src/main/kotlin/com/cakk/core/mapper/CakeMapper.kt index 30d80eb5..eb49394c 100644 --- a/cakk-core/src/main/kotlin/com/cakk/core/mapper/CakeMapper.kt +++ b/cakk-core/src/main/kotlin/com/cakk/core/mapper/CakeMapper.kt @@ -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): CakeImageListResponse { - val size = cakeImages.size - - return CakeImageListResponse( - cakeImages, - if (cakeImages.isEmpty()) null else cakeImages[size - 1].cakeId, - cakeImages.size - ) -} fun supplyCakeImageWithShopInfoListResponse( cakeImages: List @@ -35,23 +24,23 @@ fun supplyCakeImageWithShopInfoListResponse( ) } -fun supplyCakeImageListResponse( - cakeImages: List, +fun supplyCakeImageWithShopInfoListResponse( + cakeImages: List, cakeIds: List -): CakeImageListResponse { - val sortedCakeImages: MutableList = ArrayList() +): CakeImageWithShopInfoListResponse { + val sortedCakeImages: MutableList = 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 ) } diff --git a/cakk-domain/mysql/src/main/java/com/cakk/domain/mysql/dto/param/cake/CakeImageResponseParam.java b/cakk-domain/mysql/src/main/java/com/cakk/domain/mysql/dto/param/cake/CakeImageResponseParam.java deleted file mode 100644 index 6dd5e69c..00000000 --- a/cakk-domain/mysql/src/main/java/com/cakk/domain/mysql/dto/param/cake/CakeImageResponseParam.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.cakk.domain.mysql.dto.param.cake; - -public record CakeImageResponseParam( - Long cakeShopId, - Long cakeId, - String cakeImageUrl -) { -}