Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rename] imgKey -> imgUrl 변경 #89

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/kotlin/com/psr/psr/cs/dto/NoticeRes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ data class NoticeRes (
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
val date: LocalDateTime,
@JsonInclude(JsonInclude.Include.NON_NULL)
val imgKey: String ?= null
val imgUrl: String ?= null
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CsAssembler {

// 공지사항 상세
fun toNoticeRes(notice: Notice): NoticeRes {
return NoticeRes(notice.id, notice.title, notice.createdAt, notice.imgKey)
return NoticeRes(notice.id, notice.title, notice.createdAt, notice.imgUrl)
}

// 자주 묻는 질문 메인
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/psr/psr/cs/entity/Notice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ data class Notice(
@Column(length = 500)
var content: String,

var imgKey: String
var imgUrl: String

): BaseEntity()
14 changes: 7 additions & 7 deletions src/main/kotlin/com/psr/psr/order/dto/OrderAssembler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ class OrderAssembler {
}

// 요청 목록 조회 시
fun toListDto(order: Order, type: String, productImgKey: String): OrderListRes {
fun toListDto(order: Order, type: String, productImgUrl: String): OrderListRes {
val userName =
if (type == SELL) order.ordererName
else order.product.user.nickname
val profileImg: String? =
if (type == SELL) order.user.imgKey
else order.product.user.imgKey
if (type == SELL) order.user.imgUrl
else order.product.user.imgUrl

return OrderListRes(
orderId = order.id!!,
orderDate = order.createdAt.format(DateTimeFormatter.ISO_DATE),
userName = userName,
profileImgKey = profileImg,
profileImgUrl = profileImg,
productId = order.product.id,
productName = order.product.name,
productImgKey = productImgKey,
productImgUrl = productImgUrl,
isReviewed = null
)
}
Expand All @@ -66,10 +66,10 @@ class OrderAssembler {
orderId = order.id!!,
orderDate = order.createdAt.format(DateTimeFormatter.ISO_DATE),
userName = userName,
profileImgKey = null,
profileImgUrl = null,
productId = order.product.id,
productName = order.product.name,
productImgKey = null,
productImgUrl = null,
isReviewed = order.isReviewed
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/psr/psr/order/dto/OrderListRes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ data class OrderListRes (
val orderId: Long,
val orderDate: String,
val userName: String,
val profileImgKey: String?,
val profileImgUrl: String?,
val productId: Long,
val productName: String,
@JsonInclude(JsonInclude.Include.NON_NULL)
val productImgKey: String?,
val productImgUrl: String?,
@JsonInclude(JsonInclude.Include.NON_NULL)
val isReviewed: Boolean?
)
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OrderService(
orderRepository.findByProductUserAndStatus(user, ACTIVE_STATUS, pageable)
else
orderRepository.findByUserAndStatus(user, ACTIVE_STATUS, pageable)
return orderList.map { order: Order -> orderAssembler.toListDto(order, type, order.product.imgs.get(0).imgKey) }
return orderList.map { order: Order -> orderAssembler.toListDto(order, type, order.product.imgs[0].imgUrl) }
}

// 요청 목록 조회(요청 상태별)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import org.springframework.stereotype.Component

@Component
class ProductAssembler {
fun toMyProductDto(product: Product, imgKey: String): MyProduct {
fun toMyProductDto(product: Product, imgUrl: String): MyProduct {
return MyProduct(
productId = product.id,
imgKey = imgKey,
imgUrl = imgUrl,
category = product.category.value,
name = product.name,
price = product.price
Expand All @@ -20,7 +20,7 @@ class ProductAssembler {

fun toGetProductsByUserResDto(user: User, productList: List<MyProduct>?): GetProductsByUserRes {
return GetProductsByUserRes(
imgKey = user.imgKey,
imgUrl = user.imgUrl,
type = user.type.value,
nickname = user.nickname,
productList = productList
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.psr.psr.product.dto.response

data class GetProductsByUserRes(
val imgKey: String?,
val imgUrl: String?,
val type: String,
val nickname: String,
val productList: List<MyProduct>?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.psr.psr.product.dto.response

data class MyProduct(
val productId: Long,
val imgKey: String,
val imgUrl: String,
val category: String,
val name: String,
val price: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.querydsl.core.annotations.QueryProjection

data class PopularProductDetail @QueryProjection constructor(
val productId: Long,
val imgKey: String,
val imgUrl: String,
val name: String,
val price: Int,
val numOfLike: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.querydsl.core.annotations.QueryProjection

data class ProductDetail @QueryProjection constructor(
val productId: Long,
val imgKey: String,
val userIdx: Long,
val imgUrl: String,
val userId: Long,
val nickname: String,
val name: String,
val price: Int,
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/com/psr/psr/product/entity/ProductImg.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import org.jetbrains.annotations.NotNull
@Entity
data class ProductImg(
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Long,
var id: Long,

@ManyToOne
var product: Product,
var product: Product,

@NotNull
var imgKey: String
var imgUrl: String

): BaseEntity()
) : BaseEntity()
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ProductRepositoryImpl(
return queryFactory
.select(QPopularProductDetail(
product.id,
JPAExpressions.select(productImg.imgKey).from(productImg).where(productImg.id.eq(JPAExpressions.select(productImg.id.min()).from(productImg).where(productImg.product.eq(product)))),
JPAExpressions.select(productImg.imgUrl).from(productImg).where(productImg.id.eq(JPAExpressions.select(productImg.id.min()).from(productImg).where(productImg.product.eq(product)))),
product.name,
product.price,
ExpressionUtils.`as`(product.likeNum, "numOfLike"),
Expand All @@ -54,7 +54,7 @@ class ProductRepositoryImpl(
.select(
QProductDetail(
product.id,
JPAExpressions.select(productImg.imgKey).from(productImg).where(
JPAExpressions.select(productImg.imgUrl).from(productImg).where(
productImg.id.eq(
JPAExpressions.select(productImg.id.min()).from(productImg)
.where(productImg.product.eq(product))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ProductService(

return myProductList?.map { p: Product ->
val productImg = productImgRepository.findTop1ByProductAndStatusOrderByCreatedAtDesc(p, ACTIVE_STATUS)
productAssembler.toMyProductDto(p, productImg.imgKey)
productAssembler.toMyProductDto(p, productImg.imgUrl)
}
}

Expand All @@ -56,7 +56,7 @@ class ProductService(

val productList = products?.map { p: Product ->
val productImg = productImgRepository.findTop1ByProductAndStatusOrderByCreatedAtDesc(p, ACTIVE_STATUS)
productAssembler.toMyProductDto(p, productImg.imgKey)
productAssembler.toMyProductDto(p, productImg.imgUrl)
}
return productAssembler.toGetProductsByUserResDto(user, productList)
}
Expand Down
9 changes: 4 additions & 5 deletions src/main/kotlin/com/psr/psr/review/dto/ReviewAssembler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.psr.psr.review.dto

import com.psr.psr.global.entity.ReportCategory
import com.psr.psr.order.entity.Order
import com.psr.psr.product.entity.Product
import com.psr.psr.review.entity.Review
import com.psr.psr.review.entity.ReviewImg
import com.psr.psr.review.entity.ReviewReport
Expand All @@ -21,10 +20,10 @@ class ReviewAssembler {
)
}

fun toImgEntity(review: Review, imgKey: String): ReviewImg {
fun toImgEntity(review: Review, imgUrl: String): ReviewImg {
return ReviewImg(
review = review,
imgKey = imgKey
imgUrl = imgUrl
)
}

Expand All @@ -38,7 +37,7 @@ class ReviewAssembler {

fun toDto(review: Review): ReviewListRes {
val reviewImgs =
if (review.imgs?.size != 0) review.imgs?.map { img -> img.imgKey }
if (review.imgs?.size != 0) review.imgs?.map { img -> img.imgUrl }
else null
return ReviewListRes(
reviewId = review.id!!,
Expand All @@ -47,7 +46,7 @@ class ReviewAssembler {
imgList = reviewImgs,
reviewedDate = review.createdAt.format(DateTimeFormatter.ISO_DATE),
nickName = review.order.user.nickname,
profileImgKey = review.order.user.imgKey
profileImgUrl = review.order.user.imgUrl
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/psr/psr/review/dto/ReviewListRes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ data class ReviewListRes(
val imgList: List<String>?,
val reviewedDate: String,
val nickName: String,
val profileImgKey: String?
val profileImgUrl: String?
)
21 changes: 0 additions & 21 deletions src/main/kotlin/com/psr/psr/review/dto/ReviewReportReq.kt

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/kotlin/com/psr/psr/review/dto/ReviewReq.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ data class ReviewReq(
@field:Size(max = 250, message = "내용은 최대 250자입니다.")
val content: String,

@field:Size(min = 1, max = 5, message = "imgKey는 null 또는 1~5개이어야 합니다.")
@field:Size(min = 1, max = 5, message = "imgUrl은 null 또는 1~5개이어야 합니다.")
val imgList: List<String>?
)
3 changes: 1 addition & 2 deletions src/main/kotlin/com/psr/psr/review/entity/ReviewImg.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.psr.psr.review.entity

import com.psr.psr.global.entity.BaseEntity
import jakarta.persistence.*
import org.hibernate.annotations.SQLDelete
import org.jetbrains.annotations.NotNull

@Entity
Expand All @@ -15,6 +14,6 @@ data class ReviewImg(
var review: Review,

@NotNull
var imgKey: String
var imgUrl: String

) : BaseEntity()
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ data class ReviewReport(
@Enumerated(EnumType.STRING)
var category: ReportCategory


) : BaseEntity()
2 changes: 1 addition & 1 deletion src/main/kotlin/com/psr/psr/user/dto/MyPageInfoRes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.psr.psr.user.dto

data class MyPageInfoRes(
val email: String,
val imgKey: String ?= null,
val imgUrl: String ?= null,
val type: String,
val phone: String,
)
3 changes: 1 addition & 2 deletions src/main/kotlin/com/psr/psr/user/dto/ProfileReq.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package com.psr.psr.user.dto
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern


data class ProfileReq(
@field:NotBlank
@field:Pattern(
regexp = "^([a-zA-Z0-9ㄱ-ㅎ|ㅏ-ㅣ|가-힣]).{0,10}\$",
message = "한글, 영어, 숫자만 입력해주세요. (10글자)"
)
val nickname: String,
val profileImgKey: String? = null
val profileImgUrl: String? = null
)
2 changes: 1 addition & 1 deletion src/main/kotlin/com/psr/psr/user/dto/ProfileRes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package com.psr.psr.user.dto

data class ProfileRes(
val email: String,
val imgKey: String? = null
val imgUrl: String? = null
)
6 changes: 1 addition & 5 deletions src/main/kotlin/com/psr/psr/user/dto/SignUpReq.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.psr.psr.user.dto

import com.psr.psr.user.entity.*
import jakarta.annotation.Nullable
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotEmpty
import jakarta.validation.constraints.Pattern
import org.jetbrains.annotations.NotNull
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.stream.Collectors


data class SignUpReq (
Expand All @@ -30,7 +26,7 @@ data class SignUpReq (
)
val phone: String,
@field:Nullable
val imgKey: String? = null,
val imgUrl: String? = null,
@field:NotBlank
@field:Pattern(
regexp = "^([a-zA-Z0-9ㄱ-ㅎ|ㅏ-ㅣ|가-힣]).{0,10}\$",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class UserAssembler {
password = signUpReq.password,
type = Type.getTypeByName(signUpReq.type),
phone = signUpReq.phone,
imgKey = signUpReq.imgKey,
imgUrl = signUpReq.imgUrl,
provider = Provider.LOCAL,
marketing = signUpReq.marketing,
notification = signUpReq.notification,
Expand Down Expand Up @@ -61,11 +61,11 @@ class UserAssembler {
* toDto
*/
fun toMyPageInfoRes(user: User) : MyPageInfoRes {
return MyPageInfoRes(user.email, user.imgKey, user.type.value, user.phone)
return MyPageInfoRes(user.email, user.imgUrl, user.type.value, user.phone)
}

fun toProfileRes(user: User) : ProfileRes {
return ProfileRes(user.email, user.imgKey)
return ProfileRes(user.email, user.imgUrl)
}

fun toTokenDto(tokenDto: TokenDto) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/psr/psr/user/entity/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class User(
@Column(length = 15)
var phone:String,

var imgKey: String? = null,
var imgUrl: String? = null,

@NotNull
@Enumerated(EnumType.STRING)
Expand Down
Loading
Loading