-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from farmtedPlaydata/FEAT-#111]-Feign통신
[FEAT #87 ] Feign 전달 객체 정형성 교정 + 추가 입찰 반영
- Loading branch information
Showing
9 changed files
with
197 additions
and
41 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
10 changes: 6 additions & 4 deletions
10
auction-service/src/main/java/com/farmted/auctionservice/vo/ProductVo.java
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,10 @@ | ||
package com.farmted.auctionservice.vo; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public record ProductVo( | ||
String name, | ||
int stock, | ||
String source, | ||
String image | ||
@JsonProperty("name") String name, | ||
@JsonProperty("stock") int stock, | ||
@JsonProperty("source") String source, | ||
@JsonProperty("image") String image | ||
){} |
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
85 changes: 85 additions & 0 deletions
85
front-service/src/components/bidding/biddingList/BiddingModalComponent.tsx
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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// BiddingModal.tsx | ||
|
||
import React, { useState } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
interface BiddingModalProps { | ||
boardUuid: string; | ||
memberUuid: string; | ||
onClose: () => void; | ||
isOpen: boolean; | ||
closeModal: () => void; | ||
modalContent: string; | ||
} | ||
|
||
const ModalWrapper = styled.div` | ||
border: 2px solid #007bff; | ||
padding: 20px; | ||
background-color: #fff; | ||
width: 600px; | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
`; | ||
|
||
const BiddingModal: React.FC<BiddingModalProps> = ({ boardUuid, memberUuid, onClose, isOpen, closeModal, modalContent }) => { | ||
const [newBiddingPrice, setNewBiddingPrice] = useState<number>(); | ||
const [memberPrice, setMemberPrice] = useState<number>(10000); | ||
const [biddingAutoPrice, setBiddingAutoPrice] = useState<number | null>(null); | ||
const [warningMessage, setWarningMessage] = useState<string | null>(null); | ||
|
||
const handleBiddingSubmit = async () => { | ||
if (newBiddingPrice && newBiddingPrice > memberPrice) { | ||
setWarningMessage('입찰 가격이 회원 가격보다 큽니다. 다시 입력해주세요.'); | ||
return; | ||
} | ||
|
||
try { | ||
const response = await fetch(`/api/auction-service/bidding-service/bid/${boardUuid}`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'UUID': memberUuid, | ||
}, | ||
body: JSON.stringify({ | ||
biddingPrice: newBiddingPrice, | ||
memberPrice, | ||
biddingAutoPrice, | ||
}), | ||
}); | ||
|
||
if (response.ok) { | ||
// 성공적으로 입찰이 이루어졌을 때 모달을 닫습니다. | ||
onClose(); | ||
} else { | ||
// 에러 처리 로직을 추가하세요. | ||
console.error('입찰 실패:', response); | ||
} | ||
} catch (error) { | ||
// 네트워크 오류 또는 기타 예외 처리 로직을 추가하세요. | ||
console.error('네트워크 오류'); | ||
} | ||
}; | ||
|
||
return ( | ||
<ModalWrapper> | ||
{/* 모달 내용 및 폼 */} | ||
<label htmlFor="biddingPrice">추가 입찰 희망 가격:</label> | ||
<input type="number" id="biddingPrice" value={newBiddingPrice} onChange={(e) => setNewBiddingPrice(+e.target.value)} /> | ||
|
||
{/* 다른 입력 필드 및 버튼들은 이곳에 추가하세요. */} | ||
|
||
{warningMessage && <div style={{ color: 'red' }}>{warningMessage}</div>} | ||
|
||
<button onClick={handleBiddingSubmit}>입찰 신청</button> | ||
<button onClick={onClose}>취소</button> | ||
|
||
{/* modalContent 표시 */} | ||
<div>이전 낙찰 내역:{modalContent}</div> | ||
<div>현재 잔고: {memberPrice}</div> | ||
</ModalWrapper> | ||
); | ||
}; | ||
|
||
export default BiddingModal; |
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
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
12 changes: 7 additions & 5 deletions
12
product-service/src/main/java/com/farmted/productservice/vo/ResponseAuctionGetVo.java
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,11 +1,13 @@ | ||
package com.farmted.productservice.vo; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
|
||
public record ResponseAuctionGetVo ( | ||
Integer auctionPrice, // 경매 가격 == 낙찰 가격 | ||
LocalDateTime auctionDeadline, // 경매 종료 | ||
String productUuid, | ||
String auctionBuyer, // 낙찰자 | ||
boolean auctionStatus){ } | ||
@JsonProperty("auctionPrice") Integer auctionPrice, // 경매 가격 == 낙찰 가격 | ||
@JsonProperty("auctionDeadline") LocalDateTime auctionDeadline, // 경매 종료 | ||
@JsonProperty("productUuid") String productUuid, | ||
@JsonProperty("auctionBuyer") String auctionBuyer, // 낙찰자 | ||
@JsonProperty("auctionStatus") boolean auctionStatus){ } |