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.1.6 #386

Merged
merged 6 commits into from
Feb 20, 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
58 changes: 58 additions & 0 deletions .github/workflows/BuildBatchServer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Batch Server
on:
push:
tags:
- Batch-v*.*.*

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
outputs:
version: ${{ steps.get_version.outputs.BRANCH_NAME }}

steps:
- name: Check Out The Repository
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'corretto'

- name: Get the version
id: get_version
run: |
RELEASE_VERSION_WITHOUT_V="$(cut -d'v' -f2 <<< ${GITHUB_REF#refs/*/})"
echo ::set-output name=VERSION::$RELEASE_VERSION_WITHOUT_V

#테스트 수행용 도커 컴포즈
- name: Start containers
run: docker-compose up -d

- name: Gradle Build
uses: gradle/gradle-build-action@v2

- name: Execute Gradle build
run: ./gradlew :DuDoong-Batch:build --no-daemon

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./DuDoong-Batch
push: true
tags: |
water0641/dudoong-batch:${{ steps.get_version.outputs.VERSION }}
water0641/dudoong-batch:latest

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.gosrock.api.cart.model.dto.response;


import band.gosrock.domain.common.vo.AccountInfoVo;
import band.gosrock.domain.common.vo.Money;
import band.gosrock.domain.domains.cart.domain.Cart;
import band.gosrock.domain.domains.ticket_item.domain.TicketItem;
Expand Down Expand Up @@ -41,7 +42,7 @@ public class CartResponse {
private final TicketPayType ticketPayType;

@Schema(description = "계좌정보", nullable = true)
private final String accountNumber;
private final AccountInfoVo accountInfo;

public static CartResponse of(
List<CartItemResponse> cartItemResponses, Cart cart, TicketItem item) {
Expand All @@ -54,7 +55,7 @@ public static CartResponse of(
.totalQuantity(cart.getTotalQuantity())
.approveType(item.getType())
.ticketPayType(item.getPayType())
.accountNumber(item.getAccountNumber())
.accountInfo(item.getAccountInfo())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class EventController {
private final UpdateEventBasicUseCase updateEventBasicUseCase;
private final UpdateEventDetailUseCase updateEventDetailUseCase;
private final UpdateEventStatusUseCase updateEventStatusUseCase;
private final OpenEventUseCase openEventStatusUseCase;
private final OpenEventUseCase openEventUseCase;
private final DeleteEventUseCase deleteEventUseCase;

@Operation(summary = "자신이 관리 중인 이벤트 리스트를 가져옵니다.")
@GetMapping
Expand Down Expand Up @@ -83,7 +84,7 @@ public EventResponse updateEventDetail(
@Operation(summary = "공연을 오픈 상태로 변경합니다. 모든 체크리스트를 달성해야 합니다.")
@PatchMapping("/{eventId}/open")
public EventResponse updateEventStatus(@PathVariable Long eventId) {
return openEventStatusUseCase.execute(eventId);
return openEventUseCase.execute(eventId);
}

@Operation(summary = "공연 상태를 변경합니다. (OPEN 제외)")
Expand All @@ -93,4 +94,10 @@ public EventResponse updateEventStatus(
@RequestBody @Valid UpdateEventStatusRequest updateEventDetailRequest) {
return updateEventStatusUseCase.execute(eventId, updateEventDetailRequest);
}

@Operation(summary = "공연을 삭제합니다. 조건에 맞지 않을 경우 삭제할 수 없습니다.")
@PatchMapping("/{eventId}/delete")
public EventResponse deleteEvent(@PathVariable Long eventId) {
return deleteEventUseCase.execute(eventId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package band.gosrock.api.event.service;

import static band.gosrock.api.common.aop.hostRole.FindHostFrom.EVENT_ID;
import static band.gosrock.api.common.aop.hostRole.HostQualification.MANAGER;

import band.gosrock.api.common.aop.hostRole.HostRolesAllowed;
import band.gosrock.api.event.model.dto.response.EventResponse;
import band.gosrock.common.annotation.UseCase;
import band.gosrock.domain.domains.event.adaptor.EventAdaptor;
import band.gosrock.domain.domains.event.domain.Event;
import band.gosrock.domain.domains.event.service.EventService;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

@UseCase
@RequiredArgsConstructor
public class DeleteEventUseCase {
private final EventService eventService;
private final EventAdaptor eventAdaptor;

@Transactional
@HostRolesAllowed(role = MANAGER, findHostFrom = EVENT_ID)
public EventResponse execute(Long eventId) {
final Event event = eventAdaptor.findById(eventId);
return EventResponse.of(eventService.deleteEventSoft(event));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static band.gosrock.api.common.aop.hostRole.FindHostFrom.EVENT_ID;
import static band.gosrock.api.common.aop.hostRole.HostQualification.MANAGER;

import band.gosrock.api.common.UserUtils;
import band.gosrock.api.common.aop.hostRole.HostRolesAllowed;
import band.gosrock.api.event.model.dto.request.UpdateEventBasicRequest;
import band.gosrock.api.event.model.dto.response.EventResponse;
Expand All @@ -14,15 +13,12 @@
import band.gosrock.domain.domains.event.domain.EventBasic;
import band.gosrock.domain.domains.event.domain.EventPlace;
import band.gosrock.domain.domains.event.service.EventService;
import band.gosrock.domain.domains.host.service.HostService;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

@UseCase
@RequiredArgsConstructor
public class UpdateEventBasicUseCase {
private final UserUtils userUtils;
private final HostService hostService;
private final EventService eventService;
private final EventAdaptor eventAdaptor;
private final EventMapper eventMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static band.gosrock.api.common.aop.hostRole.FindHostFrom.EVENT_ID;
import static band.gosrock.api.common.aop.hostRole.HostQualification.MANAGER;

import band.gosrock.api.common.UserUtils;
import band.gosrock.api.common.aop.hostRole.HostRolesAllowed;
import band.gosrock.api.event.model.dto.request.UpdateEventStatusRequest;
import band.gosrock.api.event.model.dto.response.EventResponse;
Expand All @@ -12,15 +11,12 @@
import band.gosrock.domain.domains.event.domain.Event;
import band.gosrock.domain.domains.event.domain.EventStatus;
import band.gosrock.domain.domains.event.service.EventService;
import band.gosrock.domain.domains.host.service.HostService;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

@UseCase
@RequiredArgsConstructor
public class UpdateEventStatusUseCase {
private final UserUtils userUtils;
private final HostService hostService;
private final EventService eventService;
private final EventAdaptor eventAdaptor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package band.gosrock.api.issuedTicket.controller;


import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketListResponse;
import band.gosrock.api.common.page.PageResponse;
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketDTO;
import band.gosrock.api.issuedTicket.service.EntranceIssuedTicketUseCase;
import band.gosrock.api.issuedTicket.service.ReadIssuedTicketsUseCase;
import band.gosrock.domain.common.vo.IssuedTicketInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -29,12 +32,12 @@ public class AdminIssuedTicketController {

@Operation(summary = "[어드민 기능] 발급 티켓 리스트 가져오기 API 입니다.")
@GetMapping
public RetrieveIssuedTicketListResponse getIssuedTickets(
public PageResponse<RetrieveIssuedTicketDTO> getIssuedTickets(
@PathVariable Long eventId,
@RequestParam Long page,
@ParameterObject Pageable pageable,
@RequestParam(required = false) String userName,
@RequestParam(required = false) String phoneNumber) {
return readIssuedTicketsUseCase.execute(page, eventId, userName, phoneNumber);
return readIssuedTicketsUseCase.execute(pageable, eventId, userName, phoneNumber);
}

@Operation(summary = "[어드민 기능] 발급 티켓 입장 처리 API 입니다.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package band.gosrock.api.issuedTicket.mapper;


import band.gosrock.api.common.page.PageResponse;
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketDTO;
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketDetailResponse;
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketListResponse;
import band.gosrock.common.annotation.Mapper;
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.issuedTicket.domain.IssuedTicket;
import band.gosrock.domain.domains.issuedTicket.dto.condition.IssuedTicketCondition;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;

@Mapper
Expand All @@ -21,10 +24,10 @@ public class IssuedTicketMapper {
private final EventAdaptor eventAdaptor;

@Transactional(readOnly = true)
public RetrieveIssuedTicketListResponse toIssuedTicketPageResponse(
Long page, IssuedTicketCondition condition) {
return RetrieveIssuedTicketListResponse.of(
issuedTicketAdaptor.searchIssuedTicket(page, condition));
public PageResponse<RetrieveIssuedTicketDTO> toIssuedTicketPageResponse(
Pageable page, IssuedTicketCondition condition) {
Page<IssuedTicket> issuedTickets = issuedTicketAdaptor.searchIssuedTicket(page, condition);
return PageResponse.of(issuedTickets.map(RetrieveIssuedTicketDTO::of));
}

@Transactional(readOnly = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import static band.gosrock.api.common.aop.hostRole.HostQualification.MANAGER;

import band.gosrock.api.common.aop.hostRole.HostRolesAllowed;
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketListResponse;
import band.gosrock.api.common.page.PageResponse;
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketDTO;
import band.gosrock.api.issuedTicket.mapper.IssuedTicketMapper;
import band.gosrock.common.annotation.UseCase;
import band.gosrock.domain.domains.event.service.EventService;
import band.gosrock.domain.domains.issuedTicket.dto.condition.IssuedTicketCondition;
import band.gosrock.domain.domains.issuedTicket.service.IssuedTicketDomainService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;

@UseCase
@RequiredArgsConstructor
Expand All @@ -25,9 +27,9 @@ public class ReadIssuedTicketsUseCase {
* 로직이 너무 복잡해짐 => 일단 연관관계 매핑 걸어두고 나중에 QueryDsl 설정 들어오면 바꿔야 할 듯 => QueryDsl 추가 완료
*/
@HostRolesAllowed(role = MANAGER, findHostFrom = EVENT_ID)
public RetrieveIssuedTicketListResponse execute(
Long page, Long eventId, String userName, String phoneNumber) {
public PageResponse<RetrieveIssuedTicketDTO> execute(
Pageable pageable, Long eventId, String userName, String phoneNumber) {
return issuedTicketMapper.toIssuedTicketPageResponse(
page, new IssuedTicketCondition(eventId, userName, phoneNumber));
pageable, new IssuedTicketCondition(eventId, userName, phoneNumber));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.gosrock.api.order.model.dto.response;


import band.gosrock.domain.common.vo.AccountInfoVo;
import band.gosrock.domain.common.vo.Money;
import band.gosrock.domain.domains.order.domain.Order;
import band.gosrock.domain.domains.order.domain.OrderMethod;
Expand Down Expand Up @@ -43,7 +44,7 @@ public class CreateOrderResponse {
private final TicketPayType ticketPayType;

@Schema(description = "계좌정보", nullable = true)
private final String accountNumber;
private final AccountInfoVo accountInfo;

public static CreateOrderResponse from(Order order, TicketItem item, Profile profile) {
return CreateOrderResponse.builder()
Expand All @@ -56,7 +57,7 @@ public static CreateOrderResponse from(Order order, TicketItem item, Profile pro
.isNeedPayment(order.isNeedPaid())
.approveType(item.getType())
.ticketPayType(item.getPayType())
.accountNumber(item.getAccountNumber())
.accountInfo(item.getAccountInfo())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.gosrock.api.order.model.dto.response;


import band.gosrock.common.annotation.DateFormat;
import band.gosrock.domain.common.vo.Money;
import band.gosrock.domain.common.vo.RefundInfoVo;
import band.gosrock.domain.common.vo.UserInfoVo;
Expand Down Expand Up @@ -35,12 +36,15 @@ public class OrderAdminTableElement {
private final String orderName;

@Schema(description = "주문 생성 시간")
@DateFormat
private final LocalDateTime createdAt;

@Schema(description = "철회 완료 시간")
@DateFormat
private final LocalDateTime withDrawAt;

@Schema(description = "승인 된 시간")
@DateFormat
private final LocalDateTime approveAt;

@Schema(description = "아이템 총 갯수")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.gosrock.api.order.model.dto.response;


import band.gosrock.common.annotation.DateFormat;
import band.gosrock.domain.common.vo.Money;
import band.gosrock.domain.common.vo.OptionAnswerVo;
import band.gosrock.domain.domains.order.domain.Order;
Expand All @@ -24,6 +25,7 @@ public class OrderLineTicketResponse {
private final String ticketNos;

@Schema(description = "구매 일시")
@DateFormat
private final LocalDateTime paymentAt;

@Schema(description = "유저이름")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

import band.gosrock.domain.common.alarm.EventSlackAlarm;
import band.gosrock.domain.common.events.event.EventDeletionEvent;
import band.gosrock.domain.domains.event.adaptor.EventAdaptor;
import band.gosrock.domain.domains.event.domain.Event;
import band.gosrock.domain.domains.host.adaptor.HostAdaptor;
import band.gosrock.domain.domains.host.domain.Host;
import band.gosrock.infrastructure.config.slack.SlackMessageProvider;
Expand All @@ -20,7 +18,6 @@
@Slf4j
public class EventDeletionEventHandler {
private final HostAdaptor hostAdaptor;
private final EventAdaptor eventAdaptor;
private final SlackMessageProvider slackMessageProvider;

@Async
Expand All @@ -29,9 +26,8 @@ public class EventDeletionEventHandler {
phase = TransactionPhase.AFTER_COMMIT)
public void handle(EventDeletionEvent eventDeletionEvent) {
final Host host = hostAdaptor.findById(eventDeletionEvent.getHostId());
final Event event = eventAdaptor.findById(eventDeletionEvent.getEventId());
final String message = EventSlackAlarm.deletionOf(event);

final String eventName = eventDeletionEvent.getEventName();
final String message = EventSlackAlarm.deletionOf(eventName);
slackMessageProvider.sendMessage(host.getSlackUrl(), message);
}
}
Loading