Skip to content

Commit

Permalink
fix(ticketItem) : 재고 존재 여부 포함 (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-wonjin authored Mar 6, 2023
1 parent 5217942 commit 0b2f291
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class TicketItemResponse {
@Schema(description = "재고가 감소한 티켓인지 리턴")
private final Boolean isSold;

@Schema(description = "재고가 남아있는지 리턴")
private final Boolean isQuantityLeft;

public static TicketItemResponse from(TicketItem ticketItem, Boolean isAdmin) {

return TicketItemResponse.builder()
Expand All @@ -67,6 +70,7 @@ public static TicketItemResponse from(TicketItem ticketItem, Boolean isAdmin) {
.isQuantityPublic(ticketItem.getIsQuantityPublic())
.accountInfo(ticketItem.getAccountInfo())
.isSold(ticketItem.isSold())
.isQuantityLeft(ticketItem.isQuantityLeft())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ public Boolean isSold() {
return quantity < supplyCount;
}

public Boolean isQuantityLeft() {
return quantity > 0;
}

public Long getEventId() {
return eventId;
}
Expand Down

0 comments on commit 0b2f291

Please sign in to comment.