Skip to content

Commit

Permalink
Merge pull request #33 from woogieon8on/feat/21-admin-ticket
Browse files Browse the repository at this point in the history
Feat/21 admin ticket
  • Loading branch information
woogieon8on authored Jul 21, 2024
2 parents 80fc7b6 + 6d2fcb9 commit 2220214
Show file tree
Hide file tree
Showing 37 changed files with 163 additions and 107 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.confg;
package kahlua.KahluaProject.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.confg;
package kahlua.KahluaProject.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.confg;
package kahlua.KahluaProject.config;

import kahlua.KahluaProject.security.ExceptionFilter;
import kahlua.KahluaProject.security.jwt.JwtAccessDeniedHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.confg;
package kahlua.KahluaProject.config;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
Expand Down
26 changes: 17 additions & 9 deletions src/main/java/kahlua/KahluaProject/controller/AdminController.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package kahlua.KahluaProject.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import kahlua.KahluaProject.apipayload.ApiResponse;
import kahlua.KahluaProject.apipayload.code.status.ErrorStatus;
import kahlua.KahluaProject.domain.user.UserType;
import kahlua.KahluaProject.dto.response.ApplyGetResponse;
import kahlua.KahluaProject.dto.response.ApplyListResponse;
import kahlua.KahluaProject.dto.apply.response.ApplyGetResponse;
import kahlua.KahluaProject.dto.apply.response.ApplyListResponse;
import kahlua.KahluaProject.exception.GeneralException;
import kahlua.KahluaProject.security.AuthDetails;
import kahlua.KahluaProject.dto.response.TicketListResponse;
import kahlua.KahluaProject.dto.ticket.response.TicketListResponse;
import kahlua.KahluaProject.service.ApplyService;
import kahlua.KahluaProject.service.TicketService;
import lombok.RequiredArgsConstructor;
Expand All @@ -17,6 +19,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "관리자", description = "관리자 페이지 관련 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/admin")
Expand All @@ -26,12 +29,14 @@ public class AdminController {
private final TicketService ticketService;

@GetMapping("/apply")
@Operation(summary = "지원자 리스트 조회", description = "id 기준으로 정렬된 지원자 리스트를 조회합니다")
public ApiResponse<ApplyListResponse> getApplyList(@AuthenticationPrincipal AuthDetails authDetails) {
ApplyListResponse applyListResponse = applyService.getApplyList(authDetails.user());
return ApiResponse.onSuccess(applyListResponse);
}

@GetMapping("/apply/{applyId}")
@Operation(summary = "지원자 상세정보 조회", description = "지원자 상세정보를 조회합니다")
public ApiResponse<ApplyGetResponse> getApplyDetail(@PathVariable Long applyId, @AuthenticationPrincipal AuthDetails authDetails) {
if(authDetails.getUser().getUserType() != UserType.ADMIN){
throw new GeneralException(ErrorStatus.UNAUTHORIZED);
Expand All @@ -41,20 +46,23 @@ public ApiResponse<ApplyGetResponse> getApplyDetail(@PathVariable Long applyId,
}

@GetMapping("/tickets")
public ApiResponse<TicketListResponse> getTicketList() {
TicketListResponse ticketListResponse = ticketService.getTicketList();
@Operation(summary = "전체 티켓 리스트 조회", description = "id 기준으로 정렬된 전체 티켓 리스트를 조회합니다")
public ApiResponse<TicketListResponse> getTicketList(@AuthenticationPrincipal AuthDetails authDetails) {
TicketListResponse ticketListResponse = ticketService.getTicketList(authDetails.user());
return ApiResponse.onSuccess(ticketListResponse);
}

@GetMapping("/tickets/general/")
public ApiResponse<TicketListResponse> getGeneralTicketList() {
TicketListResponse ticketListResponse = ticketService.getGeneralTicketList();
@Operation(summary = "일반 티켓 리스트 조회", description = "id 기준으로 정렬된 일반 티켓 리스트를 조회합니다")
public ApiResponse<TicketListResponse> getGeneralTicketList(@AuthenticationPrincipal AuthDetails authDetails) {
TicketListResponse ticketListResponse = ticketService.getGeneralTicketList(authDetails.user());
return ApiResponse.onSuccess(ticketListResponse);
}

@GetMapping("/tickets/freshman/")
public ApiResponse<TicketListResponse> getFreshmanTicketList() {
TicketListResponse ticketListResponse = ticketService.getFreshmanTicketList();
@Operation(summary = "신입생 티켓 리스트 조회", description = "id 기준으로 정렬된 신입생 티켓 리스트를 조회합니다")
public ApiResponse<TicketListResponse> getFreshmanTicketList(@AuthenticationPrincipal AuthDetails authDetails) {
TicketListResponse ticketListResponse = ticketService.getFreshmanTicketList(authDetails.user());
return ApiResponse.onSuccess(ticketListResponse);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package kahlua.KahluaProject.controller;

import kahlua.KahluaProject.apipayload.ApiResponse;
import kahlua.KahluaProject.dto.request.ApplyCreateRequest;
import kahlua.KahluaProject.dto.response.ApplyCreateResponse;
import kahlua.KahluaProject.dto.response.ApplyGetResponse;
import kahlua.KahluaProject.dto.apply.request.ApplyCreateRequest;
import kahlua.KahluaProject.dto.apply.response.ApplyCreateResponse;
import kahlua.KahluaProject.dto.apply.response.ApplyGetResponse;
import kahlua.KahluaProject.service.ApplyService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import jakarta.validation.Valid;
import kahlua.KahluaProject.apipayload.ApiResponse;
import kahlua.KahluaProject.apipayload.code.status.ErrorStatus;
import kahlua.KahluaProject.dto.request.SignInRequest;
import kahlua.KahluaProject.dto.request.SignUpRequest;
import kahlua.KahluaProject.dto.response.TokenResponse;
import kahlua.KahluaProject.dto.user.request.SignInRequest;
import kahlua.KahluaProject.dto.user.request.SignUpRequest;
import kahlua.KahluaProject.dto.user.response.TokenResponse;
import kahlua.KahluaProject.exception.GeneralException;
import kahlua.KahluaProject.security.AuthDetails;
import kahlua.KahluaProject.security.jwt.JwtProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package kahlua.KahluaProject.controller;

import kahlua.KahluaProject.apipayload.ApiResponse;
import kahlua.KahluaProject.dto.request.TicketCreateRequest;
import kahlua.KahluaProject.dto.response.TicketCreateResponse;
import kahlua.KahluaProject.dto.response.TicketGetResponse;
import kahlua.KahluaProject.dto.ticket.request.TicketCreateRequest;
import kahlua.KahluaProject.dto.ticket.response.TicketCreateResponse;
import kahlua.KahluaProject.dto.ticket.response.TicketGetResponse;
import kahlua.KahluaProject.service.TicketService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package kahlua.KahluaProject.converter;

import kahlua.KahluaProject.domain.apply.Apply;
import kahlua.KahluaProject.dto.request.ApplyCreateRequest;
import kahlua.KahluaProject.dto.response.ApplyCreateResponse;
import kahlua.KahluaProject.dto.response.ApplyGetResponse;
import kahlua.KahluaProject.dto.apply.request.ApplyCreateRequest;
import kahlua.KahluaProject.dto.apply.response.ApplyCreateResponse;
import kahlua.KahluaProject.dto.apply.response.ApplyGetResponse;

public class ApplyConverter {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package kahlua.KahluaProject.converter;

import kahlua.KahluaProject.domain.user.User;
import kahlua.KahluaProject.dto.response.SignInResponse;
import kahlua.KahluaProject.dto.response.TokenResponse;
import kahlua.KahluaProject.dto.user.response.SignInResponse;
import kahlua.KahluaProject.dto.user.response.TokenResponse;

public class AuthConverter {
public static SignInResponse toSignInResDto(User user, TokenResponse tokenResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

import kahlua.KahluaProject.domain.ticket.Participants;
import kahlua.KahluaProject.domain.ticket.Ticket;
import kahlua.KahluaProject.dto.request.ParticipantsCreateRequest;
import kahlua.KahluaProject.dto.request.TicketCreateRequest;
import kahlua.KahluaProject.dto.response.ParticipantsResponse;
import kahlua.KahluaProject.dto.response.TicketCreateResponse;
import kahlua.KahluaProject.dto.response.TicketGetResponse;
import kahlua.KahluaProject.repository.ParticipantsRepository;
import kahlua.KahluaProject.repository.TicketRepository;
import org.springframework.stereotype.Component;
import kahlua.KahluaProject.dto.ticket.request.TicketCreateRequest;
import kahlua.KahluaProject.dto.ticket.response.ParticipantsResponse;
import kahlua.KahluaProject.dto.ticket.response.TicketCreateResponse;
import kahlua.KahluaProject.dto.ticket.response.TicketGetResponse;

import java.util.List;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package kahlua.KahluaProject.converter;

import kahlua.KahluaProject.domain.user.User;
import kahlua.KahluaProject.dto.response.UserResponse;
import kahlua.KahluaProject.dto.user.response.UserResponse;

public class UserConverter {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.dto.request;
package kahlua.KahluaProject.dto.apply.request;


import kahlua.KahluaProject.domain.apply.Gender;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.dto.response;
package kahlua.KahluaProject.dto.apply.response;

import kahlua.KahluaProject.domain.apply.Gender;
import kahlua.KahluaProject.domain.apply.Major;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.dto.response;
package kahlua.KahluaProject.dto.apply.response;

import kahlua.KahluaProject.domain.apply.Gender;
import kahlua.KahluaProject.domain.apply.Major;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kahlua.KahluaProject.dto.response;
package kahlua.KahluaProject.dto.apply.response;

import io.swagger.v3.oas.annotations.media.Schema;
import kahlua.KahluaProject.domain.apply.Gender;
import kahlua.KahluaProject.domain.apply.Major;
import kahlua.KahluaProject.domain.apply.Preference;
Expand All @@ -12,17 +13,30 @@
@Builder
public class ApplyItemResponse {

@Schema(description = "지원자 id")
private Long id;

@Schema(description = "지원자 이름")
private String name;

@Schema(description = "지원자 전화번호")
private String phone_num;

@Schema(description = "지원자 생년월일")
private String birth_date;

@Schema(description = "지원자 성별")
private Gender gender;

@Schema(description = "지원자 주소")
private String address;

@Schema(description = "지원자 전공")
private Major major;

@Schema(description = "지원자 1지망 악기")
private Preference first_preference;

@Schema(description = "지원자 2지망 악기")
private Preference second_preference;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package kahlua.KahluaProject.dto.apply.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

@Getter
@AllArgsConstructor
@Builder
@Schema(title = "지원자 리스트 응답 DTO")
public class ApplyListResponse<T> {

@Schema(description = "지원자 리스트")
private T applies;
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.dto.request;
package kahlua.KahluaProject.dto.ticket.request;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package kahlua.KahluaProject.dto.request;
package kahlua.KahluaProject.dto.ticket.request;

import kahlua.KahluaProject.domain.ticket.Meeting;
import kahlua.KahluaProject.domain.ticket.Participants;
import kahlua.KahluaProject.domain.ticket.Type;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.dto.response;
package kahlua.KahluaProject.dto.ticket.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kahlua.KahluaProject.dto.response;
package kahlua.KahluaProject.dto.ticket.response;

import kahlua.KahluaProject.domain.ticket.Meeting;
import kahlua.KahluaProject.domain.ticket.Participants;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package kahlua.KahluaProject.dto.response;
package kahlua.KahluaProject.dto.ticket.response;

import kahlua.KahluaProject.domain.ticket.Meeting;
import kahlua.KahluaProject.domain.ticket.Participants;
import kahlua.KahluaProject.domain.ticket.Status;
import kahlua.KahluaProject.domain.ticket.Type;
import kahlua.KahluaProject.repository.ParticipantsRepository;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package kahlua.KahluaProject.dto.ticket.response;

import io.swagger.v3.oas.annotations.media.Schema;
import kahlua.KahluaProject.domain.ticket.Meeting;
import kahlua.KahluaProject.domain.ticket.Status;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
@AllArgsConstructor
public class TicketItemResponse {

@Schema(description = "티켓 id")
private Long id;

@Schema(description = "결제상태")
private Status status;

@Schema(description = "예약번호")
private String reservation_id;

@Schema(description = "티켓 구매자 이름")
private String buyer;

@Schema(description = "티켓 구매자 전화번호")
private String phone_num;

@Schema(description = "티켓 매수")
private Integer total_ticket;

@Schema(description = "티켓 구매자 전공")
private String major;

@Schema(description = "뒷풀이 참여여부")
private Meeting meeting;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kahlua.KahluaProject.dto.response;
package kahlua.KahluaProject.dto.ticket.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -9,8 +10,12 @@
@Getter
@Builder
@AllArgsConstructor
@Schema(title = "티켓 리스트 응답 DTO")
public class TicketListResponse {

@Schema(description = "전체 티켓 매수")
private Integer total;

@Schema(description = "티켓 리스트")
private List<TicketItemResponse> tickets;
}
Loading

0 comments on commit 2220214

Please sign in to comment.