Skip to content

Commit

Permalink
Feat/deal api (#97)
Browse files Browse the repository at this point in the history
* Fix: 기타 API 추가

* Feat: 1분 주석 및 농산물 상세에 판매자 이미지 추가
  • Loading branch information
klkim1913 authored Aug 11, 2023
1 parent ce64304 commit 3827e10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ public class ProduceResponse {
private final int startPrice;
private final int kg;
private final int ea;
private final String sellerImage;
private final LocalDateTime startDate;
private final LocalDateTime endDate;
private final int status;
private final List<AuctionResponse> auctionResponseList;
private final int dibNum;

@Builder
public ProduceResponse(long id, String name, Member member, String description, String image, int startPrice, int kg, int ea, LocalDateTime startDate, LocalDateTime endDate, int status, AuctionResponseList auctionResponseList, List<Dib> dibList) {
public ProduceResponse(long id, String name, Member member, String description, String image, int startPrice, int kg, int ea, String sellerImage, LocalDateTime startDate, LocalDateTime endDate, int status, AuctionResponseList auctionResponseList, List<Dib> dibList) {
this.id = id;
this.name = name;
this.seller = member.getNickname();
Expand All @@ -39,6 +40,7 @@ public ProduceResponse(long id, String name, Member member, String description,
this.startPrice = startPrice;
this.kg = kg;
this.ea = ea;
this.sellerImage = sellerImage;
this.startDate = startDate;
this.endDate = endDate;
this.status = status;
Expand All @@ -51,6 +53,7 @@ public static ProduceResponse toResponse(Produce produce) {
.id(produce.getId())
.name(produce.getName())
.member(produce.getSeller())
.sellerImage(produce.getSeller().getImage())
// .member(new Member())
.description(produce.getDescription())
.image(produce.getImage())
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/anywayclear/service/AuctionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

import static com.anywayclear.exception.ExceptionCode.*;

@Service
Expand All @@ -40,9 +40,10 @@ public BiddingResponse Bidding(long auctionId, String consumerId, BiddingRequest
if (auction.getStatus() == 0 || auction.getStatus() == 2) {
throw new CustomException(INVALID_AUCTION_STATUS);
}
if (LocalDateTime.now().isAfter(auction.getUpdatedAt().plusMinutes(1))) {
throw new CustomException(EXPIRED_AUCTION_TIME);
}
/* 테스트동안 제한 안함 */
// if (LocalDateTime.now().isAfter(auction.getUpdatedAt().plusMinutes(1))) {
// throw new CustomException(EXPIRED_AUCTION_TIME);
// }
Member consumer = memberRepository.findByUserId(consumerId).orElseThrow(() -> new CustomException(INVALID_MEMBER));
if (request.getPrice() < auction.getPrice() + 100) { // 가격 기준 정해지면 수정할 로직
throw new CustomException(INVALID_PRICE);
Expand Down

0 comments on commit 3827e10

Please sign in to comment.