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

Api-v0.2.0-1 #440

Merged
merged 1 commit into from
Feb 25, 2023
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 @@ -2,6 +2,7 @@


import band.gosrock.domain.domains.ticket_item.domain.TicketItem;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Builder;
Expand All @@ -11,11 +12,9 @@
@Builder
public class AppliedOptionGroupResponse {

@Schema(description = "티켓상품 id")
private final Long ticketItemId;

@Schema(description = "이름")
private final String ticketName;
@Schema(description = "TicketItemResponse")
@JsonUnwrapped
private final TicketItemResponse ticketItemResponse;

@Schema(description = "적용된 옵션그룹 리스트")
private final List<OptionGroupResponse> optionGroups;
Expand All @@ -24,8 +23,7 @@ public static AppliedOptionGroupResponse from(
TicketItem ticketItem, List<OptionGroupResponse> optionGroup) {

return AppliedOptionGroupResponse.builder()
.ticketItemId(ticketItem.getId())
.ticketName(ticketItem.getName())
.ticketItemResponse(TicketItemResponse.from(ticketItem, Boolean.TRUE))
.optionGroups(optionGroup)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class TicketItemResponse {
@Schema(description = "계좌 정보")
private final AccountInfoVo accountInfo;

@Schema(description = "재고가 감소한 티켓인지 리턴")
private final Boolean isSold;

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

return TicketItemResponse.builder()
Expand All @@ -63,6 +66,7 @@ public static TicketItemResponse from(TicketItem ticketItem, Boolean isAdmin) {
: null)
.isQuantityPublic(ticketItem.getIsQuantityPublic())
.accountInfo(ticketItem.getAccountInfo())
.isSold(ticketItem.isSold())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ public void increaseQuantity(Long quantity) {
this.quantity = this.quantity + quantity;
}

public Boolean isSold() {
return quantity < supplyCount;
}

public Long getEventId() {
return event.getId();
}
Expand Down