Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ public record AuctionEndMessage(
String liveItemName,
String result,
Long winnerId,
Integer finalPrice
Integer finalPrice,
String winnerNickname
) {
public AuctionEndMessage(Long liveItemId, String liveItemName, String result, Long winnerId, Integer finalPrice) {
this("AUCTION_END", liveItemId, liveItemName, result, winnerId, finalPrice);
public AuctionEndMessage(Long liveItemId, String liveItemName, String result, Long winnerId, Integer finalPrice, String winnerNickname) {
this("AUCTION_END", liveItemId, liveItemName, result, winnerId, finalPrice, winnerNickname);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public record LiveAuctionEndedEvent(
Long sellerUserId,
boolean success,
Long winnerUserId,
Integer finalPrice
Integer finalPrice,
String winnerNickname
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ public void endAuction(Long itemId) {

boolean success = currentBidderIdStr != null && !currentBidderIdStr.isEmpty();
Long winnerId = success ? Long.parseLong(currentBidderIdStr) : null;
String winnerNickname = success ? userService.findById(winnerId).getNickname() : null;
Integer finalPrice = success ? Integer.parseInt(maxBidPriceStr) : liveItem.getInitPrice().intValue();

eventPublisher.publishEvent(
Expand All @@ -686,7 +687,8 @@ public void endAuction(Long itemId) {
liveItem.getSellerUserId(),
success,
winnerId,
finalPrice
finalPrice,
winnerNickname
)
);

Expand All @@ -696,7 +698,8 @@ public void endAuction(Long itemId) {
liveItem.getName(),
success,
winnerId,
finalPrice
finalPrice,
winnerNickname
);

Long nextItemId = liveItemRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public void broadcastAuctionStart(Long auctionRoomId, Long liveItemId,
* @param finalPrice 낙찰가 (유찰시 null)
*/
public void broadcastAuctionEnd(Long auctionRoomId, Long liveItemId,
String liveItemName, boolean success, Long winnerId, Integer finalPrice) {
String liveItemName, boolean success, Long winnerId, Integer finalPrice, String winnerNickname) {
// 전송할 메시지 구조
String result = success ? "SUCCESS" : "FAILED";
AuctionEndMessage message = new AuctionEndMessage(liveItemId, liveItemName, result, winnerId, finalPrice);
AuctionEndMessage message = new AuctionEndMessage(liveItemId, liveItemName, result, winnerId, finalPrice, winnerNickname);

String destination = AUCTION_PREFIX + auctionRoomId;

Expand Down