-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
17 changed files
with
206 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 0 additions & 138 deletions
138
src/main/kotlin/com/psr/psr/product/dto/assembler/ProductAssembler.kt
This file was deleted.
Oops, something went wrong.
14 changes: 13 additions & 1 deletion
14
src/main/kotlin/com/psr/psr/product/dto/response/GetHomePageRes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
package com.psr.psr.product.dto.response | ||
|
||
import com.psr.psr.product.entity.Product | ||
|
||
data class GetHomePageRes( | ||
val mainTopProductList: List<MainTopProduct>?, | ||
val recentProductList: List<MainProduct>?, | ||
val popularProductList: List<MainProduct>? | ||
) | ||
) { | ||
companion object { | ||
fun toDto(mainTopProductList: List<Product>?, productList: List<Product>?): GetHomePageRes { | ||
return GetHomePageRes( | ||
mainTopProductList = mainTopProductList?.sortedByDescending { it.createdAt }!!.take(3).map { p -> MainTopProduct.toDto(p) }.toList(), | ||
recentProductList = productList?.sortedByDescending { it.createdAt }!!.take(5).map { p -> MainProduct.toDto(p) }.toList(), | ||
popularProductList = productList?.sortedByDescending { it.likeNum?.size }!!.take(5).map { p -> MainProduct.toDto(p) }.toList() | ||
) | ||
} | ||
} | ||
} |
11 changes: 10 additions & 1 deletion
11
src/main/kotlin/com/psr/psr/product/dto/response/GetLikeProductsRes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
package com.psr.psr.product.dto.response | ||
|
||
import com.psr.psr.product.entity.Product | ||
import org.springframework.data.domain.Page | ||
|
||
data class GetLikeProductsRes( | ||
val productList: Page<MyProduct>? | ||
) | ||
) { | ||
companion object { | ||
fun toDto(productList: Page<Product>?): GetLikeProductsRes { | ||
return GetLikeProductsRes( | ||
productList = productList?.map { pl -> MyProduct.toDto(pl) } | ||
) | ||
} | ||
} | ||
} |
11 changes: 10 additions & 1 deletion
11
src/main/kotlin/com/psr/psr/product/dto/response/GetMyProductsRes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
package com.psr.psr.product.dto.response | ||
|
||
import com.psr.psr.product.entity.Product | ||
import org.springframework.data.domain.Page | ||
|
||
data class GetMyProductsRes( | ||
val productList: Page<MyProduct>? | ||
) | ||
) { | ||
companion object { | ||
fun toDto(productList: Page<Product>?): GetMyProductsRes { | ||
return GetMyProductsRes( | ||
productList = productList?.map { MyProduct.toDto(it) } | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
src/main/kotlin/com/psr/psr/product/dto/response/GetProductsByUserRes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
package com.psr.psr.product.dto.response | ||
|
||
import com.psr.psr.product.entity.Product | ||
import com.psr.psr.user.entity.User | ||
import org.springframework.data.domain.Page | ||
|
||
data class GetProductsByUserRes( | ||
val imgUrl: String?, | ||
val type: String, | ||
val nickname: String, | ||
val productList: Page<MyProduct>? | ||
) | ||
) { | ||
companion object { | ||
fun toDto(user: User, productList: Page<Product>?): GetProductsByUserRes { | ||
return GetProductsByUserRes( | ||
imgUrl = user.imgUrl, | ||
type = user.type.value, | ||
nickname = user.nickname, | ||
productList = productList?.map { p -> MyProduct.toDto(p) } | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 13 additions & 1 deletion
14
src/main/kotlin/com/psr/psr/product/dto/response/MainProduct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
package com.psr.psr.product.dto.response | ||
|
||
import com.psr.psr.product.entity.Product | ||
|
||
data class MainProduct( | ||
val id: Long, | ||
val imgUrl: String?, | ||
val name: String | ||
) | ||
) { | ||
companion object { | ||
fun toDto(product: Product): MainProduct { | ||
return MainProduct( | ||
id = product.id!!, | ||
imgUrl = product.imgs.firstOrNull()?.imgUrl, | ||
name = product.name | ||
) | ||
} | ||
} | ||
} |
16 changes: 15 additions & 1 deletion
16
src/main/kotlin/com/psr/psr/product/dto/response/MainTopProduct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
package com.psr.psr.product.dto.response | ||
|
||
import com.psr.psr.product.entity.Product | ||
|
||
data class MainTopProduct( | ||
val id: Long, | ||
val category: String, | ||
val name: String, | ||
val description: String | ||
) | ||
) { | ||
companion object { | ||
fun toDto(product: Product): MainTopProduct { | ||
return MainTopProduct( | ||
id = product.id!!, | ||
category = product.category.value, | ||
name = product.name, | ||
description = product.description | ||
) | ||
} | ||
|
||
} | ||
} |
16 changes: 15 additions & 1 deletion
16
src/main/kotlin/com/psr/psr/product/dto/response/MyProduct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
package com.psr.psr.product.dto.response | ||
|
||
import com.psr.psr.product.entity.Product | ||
|
||
data class MyProduct( | ||
val productId: Long, | ||
val imgUrl: String?, | ||
val category: String, | ||
val name: String, | ||
val price: Int | ||
) | ||
) { | ||
companion object { | ||
fun toDto(product: Product): MyProduct { | ||
return MyProduct( | ||
productId = product.id!!, | ||
imgUrl = product.imgs.firstOrNull()?.imgUrl, | ||
category = product.category.value, | ||
name = product.name, | ||
price = product.price | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.