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

Feature/8 : 이미지 추가 및 수정 #22

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Feature/8 : 이미지 추가 및 수정 #22

wants to merge 15 commits into from

Conversation

soleu
Copy link
Collaborator

@soleu soleu commented Oct 21, 2024

#️⃣연관된 이슈

#7, #8

📝작업 내용

ProductStatus.WAIT (진행 전) 상태에서만 수정 가능

스크린샷 (선택)

@soleu soleu requested a review from mason136 October 21, 2024 00:04
@soleu soleu self-assigned this Oct 21, 2024
@soleu soleu changed the title Feature/8 : 이미지 수정 Feature/8 : 이미지 추가 및 수정 Oct 21, 2024
class UnAuthorizationException : RuntimeException()

class UnsupportedFileExtensionException : RuntimeException()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예외가 발생할 때마다 클래스를 만들 수 없으니 응답 코드, 메세지를 받는 예외 클래스를 만들어보시죠

fileNames.forEach { delete(it) }
}

fun delete(fileName: String) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 함수 private으로 바꾸시죠

throw UnsupportedFileExtensionException()
}
val extension = fileName.substring(extensionIndex + 1)
require(IMAGE_EXTENSIONS.contains(extension)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확장자가 대문자로 오는 경우도 예외 발생 안하게 해주세요

@Convert(converter = ProductImagesConverter::class)
@Column(name = "IMAGES")
val images: ProductImagesVo,
@Convert(converter = ProductImagesConverter::class) @Column(name = "IMAGES") val images: ProductImagesVo,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

왜 한줄로 하시나요??,

@Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long = 0L,
) : AuditingTimeEntity() {
fun updateProduct(dto: ProductEditReq): Product {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Product를 리턴할 필요가 있을까요?


companion object {
fun validateProduct(startPrice: Int, startDate: LocalDateTime, endDate: LocalDateTime) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 로직이 static 함수로 명시가 되있는게 이상합니다.
kotlin에 init을 활용해 Product 생성시 검증을 진행하는게 더 적합하빈다.

}

private fun validateStartPrice(startPrice: Int) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

마찬가지로 static 함수로 명시된게 이상합니다.

Copy link

sonarcloud bot commented Oct 31, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants