diff --git a/src/main/java/com/readyauction/app/auction/entity/Product.java b/src/main/java/com/readyauction/app/auction/entity/Product.java index 56678aa..f175a62 100644 --- a/src/main/java/com/readyauction/app/auction/entity/Product.java +++ b/src/main/java/com/readyauction/app/auction/entity/Product.java @@ -1,6 +1,8 @@ package com.readyauction.app.auction.entity; import jakarta.persistence.*; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.*; import java.sql.Timestamp; @@ -20,21 +22,25 @@ public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; private Long memberId; + @NotEmpty(message = "상품 이름은 필수 항목입니다.") private String name; @Enumerated(EnumType.STRING) private Category category; private String description; - + @NotNull(message = "입찰 단가는 필 수 입니다.") private Integer bidUnit; + @NotNull(message = "종료 시간은 필수 항목입니다.") private Timestamp endTime; + @NotNull(message = "시작 시간은 필수 항목입니다.") private Timestamp startTime; private Integer startPrice; @@ -43,11 +49,11 @@ public class Product { private Integer immediatePrice; + @NotEmpty(message = "최소 하나의 이미지는 필수 항목입니다.") @ElementCollection @CollectionTable(name = "product_images", joinColumns = @JoinColumn(name = "product_id")) @Column(name = "image_url") private List images; - @Enumerated(EnumType.STRING) private AuctionStatus auctionStatus; // Winner를 임베디드 객체로 선언 diff --git a/src/main/java/com/readyauction/app/auction/service/RedisExpirationListener.java b/src/main/java/com/readyauction/app/auction/service/RedisExpirationListener.java index 460de8e..1d86a56 100644 --- a/src/main/java/com/readyauction/app/auction/service/RedisExpirationListener.java +++ b/src/main/java/com/readyauction/app/auction/service/RedisExpirationListener.java @@ -48,7 +48,7 @@ public void onMessage(Message message, byte[] pattern) { } public void deleteImage(String imageUrl) { - if (imageUrl != null && !imageUrl.isEmpty()) { + if (imageUrl != null && !imageUrl.isEmpty() && productService.findByProductImage(imageUrl).isEmpty()) { String key = imageUrl.substring(imageUrl.indexOf(bucketName) + bucketName.length() + 1); ncpObjectStorageService.deleteFile(key); } diff --git a/src/main/resources/templates/auth/login.html b/src/main/resources/templates/auth/login.html index 4e7c2ca..b683427 100644 --- a/src/main/resources/templates/auth/login.html +++ b/src/main/resources/templates/auth/login.html @@ -65,7 +65,46 @@

Login Your Account

+ + + + +