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

Merge Master 2024년 8월 28일 #288

Merged
merged 3 commits into from
Aug 28, 2024
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
10 changes: 8 additions & 2 deletions src/main/java/com/readyauction/app/auction/entity/Product.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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<String> images;

@Enumerated(EnumType.STRING)
private AuctionStatus auctionStatus;
// Winner를 임베디드 객체로 선언
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
39 changes: 39 additions & 0 deletions src/main/resources/templates/auth/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,46 @@ <h3>Login Your Account</h3>
<!-- </div>-->
</div>
</div>

</section>
<!-- 알림 메시지 -->
<div id="alert-box" style="display:none; position:fixed; top:20px; right:20px; z-index:1000; padding:10px; background-color:#f0ad4e; color:white; border-radius:5px;">
<span id="alert-message"></span>
</div>

<script>
// 로그인 결과에 따른 알림 메시지 표시
window.onload = function() {
/* 서버에서 로그인 성공 또는 실패 여부에 대한 정보를 받기 위한 Thymeleaf 코드 */
/* 예: 서버에서 model.addAttribute("loginSuccess", true 또는 false); 를 사용하여 결과 전달 */
/* 아래 코드에서 loginSuccess 및 loginFailure는 서버에서 전달받는 속성이라고 가정 */

/* 로그인 성공 알림 */
var loginSuccess = /*[[${loginSuccess}]]*/ false; // 서버에서 제공하는 값
if (loginSuccess) {
showAlert("로그인 성공!");
}

/* 로그인 실패 알림 */
var loginFailure = /*[[${loginFailure}]]*/ false; // 서버에서 제공하는 값
if (loginFailure) {
showAlert("로그인 실패. 다시 시도해주세요.");
}
}

// 알림 메시지 표시 함수
function showAlert(message) {
var alertBox = document.getElementById("alert-box");
var alertMessage = document.getElementById("alert-message");
alertMessage.textContent = message;
alertBox.style.display = "block";

// 3초 후 알림 메시지 자동 닫기
setTimeout(function() {
alertBox.style.display = "none";
}, 3000);
}
</script>


</div>
Expand Down
Loading