diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/cart/model/mapper/CartMapper.java b/DuDoong-Api/src/main/java/band/gosrock/api/cart/model/mapper/CartMapper.java index a3b887f2..ba365d81 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/cart/model/mapper/CartMapper.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/cart/model/mapper/CartMapper.java @@ -13,6 +13,7 @@ import band.gosrock.domain.domains.cart.domain.CartLineItem; import band.gosrock.domain.domains.cart.domain.CartOptionAnswer; import band.gosrock.domain.domains.cart.domain.CartValidator; +import band.gosrock.domain.domains.event.adaptor.EventAdaptor; import band.gosrock.domain.domains.event.domain.Event; import band.gosrock.domain.domains.ticket_item.adaptor.OptionAdaptor; import band.gosrock.domain.domains.ticket_item.adaptor.TicketItemAdaptor; @@ -28,6 +29,7 @@ public class CartMapper { private final TicketItemAdaptor ticketItemAdaptor; private final OptionAdaptor optionAdaptor; private final CartValidator cartValidator; + private final EventAdaptor eventAdaptor; private final CartAdaptor cartAdaptor; @@ -45,7 +47,7 @@ public CartResponse toCartResponse(Cart cart) { private CartResponse getCartResponse(Cart cart) { List newCartLineItems = cart.getCartLineItems(); TicketItem ticketItem = ticketItemAdaptor.queryTicketItem(cart.getItemId()); - Event event = ticketItem.getEvent(); + Event event = eventAdaptor.findById(ticketItem.getEventId()); List cartItemResponses = getCartItemResponses(newCartLineItems, ticketItem.getName()); diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java b/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java index cc767ae9..1c7bb20d 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java @@ -37,7 +37,7 @@ public class OrderBriefElement { private final String itemName; @Schema(description = "아이템 총 갯수") - private final int totalQuantity; + private final Long totalQuantity; public static OrderBriefElement of(Order order, Event event, IssuedTickets issuedTickets) { return OrderBriefElement.builder() @@ -48,7 +48,7 @@ public static OrderBriefElement of(Order order, Event event, IssuedTickets issue .orderStatus(order.getOrderStatus()) .eventProfile(event.toEventProfileVo()) .itemName(order.getOrderName()) - .totalQuantity(issuedTickets.getTotalQuantity()) + .totalQuantity(order.getTotalQuantity()) .build(); } } diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketItemMapper.java b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketItemMapper.java index e8cf2370..b89afcf7 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketItemMapper.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketItemMapper.java @@ -22,7 +22,7 @@ public class TicketItemMapper { private final TicketItemAdaptor ticketItemAdaptor; private final EventAdaptor eventAdaptor; - public TicketItem toTicketItem(CreateTicketItemRequest createTicketItemRequest, Event event) { + public TicketItem toTicketItem(CreateTicketItemRequest createTicketItemRequest, Long eventId) { return TicketItem.builder() .payType(createTicketItemRequest.getPayType()) @@ -38,7 +38,7 @@ public TicketItem toTicketItem(CreateTicketItemRequest createTicketItemRequest, .accountHolder(createTicketItemRequest.getAccountHolder()) .isQuantityPublic(createTicketItemRequest.getIsQuantityPublic()) .isSellable(true) - .event(event) + .eventId(eventId) .build(); } diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketOptionMapper.java b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketOptionMapper.java index 5eb01ff1..91b6f306 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketOptionMapper.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/mapper/TicketOptionMapper.java @@ -27,9 +27,9 @@ public class TicketOptionMapper { private final OptionGroupAdaptor optionGroupAdaptor; public OptionGroup toOptionGroup( - CreateTicketOptionRequest createTicketOptionRequest, Event event) { + CreateTicketOptionRequest createTicketOptionRequest, Long eventId) { return OptionGroup.builder() - .event(event) + .eventId(eventId) .type(createTicketOptionRequest.getType()) .name(createTicketOptionRequest.getName()) .description(createTicketOptionRequest.getDescription()) diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketItemUseCase.java b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketItemUseCase.java index d682dce1..311f17c4 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketItemUseCase.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketItemUseCase.java @@ -36,7 +36,7 @@ public TicketItemResponse execute( Boolean isPartner = host.getPartner(); TicketItem ticketItem = ticketItemService.createTicketItem( - ticketItemMapper.toTicketItem(createTicketItemRequest, event), isPartner); + ticketItemMapper.toTicketItem(createTicketItemRequest, eventId), isPartner); return TicketItemResponse.from(ticketItem, true); } diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketOptionUseCase.java b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketOptionUseCase.java index 9e3c98ea..6e87478f 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketOptionUseCase.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/ticketItem/service/CreateTicketOptionUseCase.java @@ -10,7 +10,6 @@ import band.gosrock.common.annotation.UseCase; import band.gosrock.domain.common.vo.Money; import band.gosrock.domain.domains.event.adaptor.EventAdaptor; -import band.gosrock.domain.domains.event.domain.Event; import band.gosrock.domain.domains.ticket_item.domain.OptionGroup; import band.gosrock.domain.domains.ticket_item.service.TicketOptionService; import lombok.RequiredArgsConstructor; @@ -27,11 +26,9 @@ public class CreateTicketOptionUseCase { public OptionGroupResponse execute( CreateTicketOptionRequest createTicketOptionRequest, Long eventId) { - Event event = eventAdaptor.findById(eventId); - OptionGroup ticketOption = ticketOptionMapper - .toOptionGroup(createTicketOptionRequest, event) + .toOptionGroup(createTicketOptionRequest, eventId) .createTicketOption( Money.wons(createTicketOptionRequest.getAdditionalPrice())); OptionGroup ticketOptionResult = ticketOptionService.createTicketOption(ticketOption); diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/cart/domain/CartValidator.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/cart/domain/CartValidator.java index 4a613b84..95f03849 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/cart/domain/CartValidator.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/cart/domain/CartValidator.java @@ -4,6 +4,7 @@ import band.gosrock.common.annotation.Validator; import band.gosrock.domain.domains.cart.exception.CartItemNotOneTypeException; import band.gosrock.domain.domains.cart.exception.CartNotAnswerAllOptionGroupException; +import band.gosrock.domain.domains.event.adaptor.EventAdaptor; import band.gosrock.domain.domains.event.domain.Event; import band.gosrock.domain.domains.issuedTicket.adaptor.IssuedTicketAdaptor; import band.gosrock.domain.domains.ticket_item.adaptor.OptionAdaptor; @@ -20,6 +21,7 @@ public class CartValidator { private final TicketItemAdaptor itemAdaptor; private final IssuedTicketAdaptor issuedTicketAdaptor; + private final EventAdaptor eventAdaptor; private final OptionAdaptor optionAdaptor; @@ -27,7 +29,7 @@ public void validCanCreate(Cart cart) { validItemKindIsOneType(cart); validCorrectAnswer(cart); TicketItem item = getItem(cart); - Event event = item.getEvent(); + Event event = eventAdaptor.findById(item.getEventId()); validAnswerToAllQuestion(cart, item); validEventIsOpen(event); validTicketingTime(event); diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/service/OrderToIssuedTicketService.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/service/OrderToIssuedTicketService.java index 554464e1..4f750a46 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/service/OrderToIssuedTicketService.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/service/OrderToIssuedTicketService.java @@ -25,7 +25,7 @@ public class OrderToIssuedTicketService { public List execute(TicketItem ticketItem, String orderUuid, Long userId) { User user = userAdaptor.queryUser(userId); Order order = orderAdaptor.findByOrderUuid(orderUuid); - Long eventId = ticketItem.getEvent().getId(); + Long eventId = ticketItem.getEventId(); return order.getOrderLineItems().stream() .map( orderLineItem -> diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/OptionGroupAdaptor.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/OptionGroupAdaptor.java index c1b1dd23..4ead0539 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/OptionGroupAdaptor.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/OptionGroupAdaptor.java @@ -22,7 +22,7 @@ public OptionGroup queryOptionGroup(Long optionGroupId) { } public List findAllByEventId(Long eventId) { - return optionGroupRepository.findAllByEvent_IdAndOptionGroupStatus( + return optionGroupRepository.findAllByEventIdAndOptionGroupStatus( eventId, OptionGroupStatus.VALID); } diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/TicketItemAdaptor.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/TicketItemAdaptor.java index 1fe71a13..c01a778d 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/TicketItemAdaptor.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/adaptor/TicketItemAdaptor.java @@ -22,12 +22,12 @@ public TicketItem queryTicketItem(Long ticketItemId) { } public List findAllByEventId(Long eventId) { - return ticketItemRepository.findAllByEvent_IdAndTicketItemStatus( + return ticketItemRepository.findAllByEventIdAndTicketItemStatus( eventId, TicketItemStatus.VALID); } public Boolean existsByEventId(Long eventId) { - return ticketItemRepository.existsByEvent_Id(eventId); + return ticketItemRepository.existsByEventId(eventId); } public TicketItem save(TicketItem ticketItem) { diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/domain/OptionGroup.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/domain/OptionGroup.java index db31fd32..4ae1b230 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/domain/OptionGroup.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/ticket_item/domain/OptionGroup.java @@ -6,7 +6,6 @@ import static band.gosrock.domain.domains.ticket_item.domain.OptionGroupType.*; import band.gosrock.domain.common.vo.Money; -import band.gosrock.domain.domains.event.domain.Event; import band.gosrock.domain.domains.ticket_item.exception.ForbiddenOptionGroupDeleteException; import band.gosrock.domain.domains.ticket_item.exception.InvalidOptionGroupException; import java.util.ArrayList; @@ -28,9 +27,7 @@ public class OptionGroup { @Column(name = "option_group_id") private Long id; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "event_id", nullable = false) - private Event event; + private Long eventId; // 옵션 그룹 응답 형식 @Enumerated(EnumType.STRING) @@ -55,13 +52,13 @@ public class OptionGroup { @Builder public OptionGroup( - Event event, + Long eventId, OptionGroupType type, String name, String description, Boolean isEssential, List