Skip to content

Commit e256d45

Browse files
authored
Merge pull request #53 from MUIT-UMC/develop
[merge] 250131 / 7th deploy
2 parents 0ddfb83 + 057d0b3 commit e256d45

31 files changed

+532
-117
lines changed

src/main/java/muit/backend/controller/EventController.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,32 @@
33
import io.swagger.v3.oas.annotations.Operation;
44
import io.swagger.v3.oas.annotations.Parameter;
55
import io.swagger.v3.oas.annotations.Parameters;
6+
import io.swagger.v3.oas.annotations.tags.Tag;
67
import lombok.RequiredArgsConstructor;
78
import muit.backend.apiPayLoad.ApiResponse;
89
import muit.backend.dto.eventDTO.EventResponseDTO;
910
import muit.backend.service.EventService;
1011

12+
import org.springframework.data.domain.Page;
13+
import org.springframework.data.domain.PageRequest;
14+
import org.springframework.data.domain.Pageable;
1115
import org.springframework.web.bind.annotation.*;
1216

1317
import java.time.LocalDate;
18+
import java.util.List;
1419

20+
@Tag(name = "이벤트")
1521
@RestController
1622
@RequiredArgsConstructor
1723
@RequestMapping("/events")
1824
public class EventController {
1925
private final EventService eventService;
2026

21-
@GetMapping("/")
22-
@Operation(summary = "현재 진행중인 뮤지컬 이벤트 조회 API", description = "시작 날짜가 오늘 날짜 이후인 이벤트를 하나라도 갖고 있는 모든 뮤지컬의 이벤트 목록을 조회하는 API")
23-
public ApiResponse<EventResponseDTO.EventGroupListDTO> getEventListSortedByEvFrom(){
27+
@GetMapping("")
28+
@Operation(summary = "현재 진행중인 뮤지컬 이벤트 조회 API", description = "시작 날짜가 오늘 날짜 이후인 이벤트를 하나라도 갖고 있는 모든 뮤지컬의 이벤트 목록을 조회하는 API, 한 페이지에 뮤지컬 6개씩")
29+
public ApiResponse<Page<EventResponseDTO.EventResultListDTO>> getEventListSortedByEvFrom(@RequestParam("page") Integer page){
2430
LocalDate today = LocalDate.now();
25-
return ApiResponse.onSuccess(eventService.getEventListOrderByEvFrom(today));
31+
return ApiResponse.onSuccess(eventService.getEventListOrderByEvFrom(today, page));
2632
}
2733

2834
@GetMapping("/{musicalId}")

src/main/java/muit/backend/controller/MusicalController.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
import io.swagger.v3.oas.annotations.Operation;
44
import io.swagger.v3.oas.annotations.Parameter;
55
import io.swagger.v3.oas.annotations.Parameters;
6+
import io.swagger.v3.oas.annotations.tags.Tag;
67
import lombok.RequiredArgsConstructor;
78
import muit.backend.apiPayLoad.ApiResponse;
89
import muit.backend.dto.musicalDTO.MusicalResponseDTO;
910
import muit.backend.dto.theatreDTO.TheatreResponseDTO;
1011
import muit.backend.service.musicalService.MusicalService;
12+
import org.springframework.data.domain.Page;
13+
import org.springframework.data.domain.PageRequest;
1114
import org.springframework.web.bind.annotation.*;
1215

16+
import java.awt.print.Pageable;
17+
18+
@Tag(name = "뮤지컬")
1319
@RestController
1420
@RequiredArgsConstructor
1521
@RequestMapping("/musicals")
@@ -32,7 +38,8 @@ public ApiResponse<MusicalResponseDTO.MusicalHomeListDTO> getFiveHotMusicals() {
3238
@GetMapping("/hot/all")
3339
@Operation(summary = "뮤지컬 조회 - 리스트 HOT NOW 전체보기", description = "현재 HOT한 뮤지컬 전체 조회하는 API")
3440
@Parameter( name = "page", description = "페이지를 정수로 입력")
35-
public ApiResponse<MusicalResponseDTO.MusicalHomeListDTO> getAllHotMusicals(@RequestParam(defaultValue = "0", name = "page") Integer page) {
41+
public ApiResponse<Page<MusicalResponseDTO.MusicalHomeDTO>> getAllHotMusicals(@RequestParam Integer page) {
42+
3643
return ApiResponse.onSuccess(musicalService.getAllHotMusicals(page));
3744
}
3845

@@ -44,7 +51,7 @@ public ApiResponse<MusicalResponseDTO.MusicalHomeListDTO> getFiveRankMusicals()
4451

4552
@GetMapping("/rank/all")
4653
@Operation(summary = "뮤지컬 조회 - 리스트 RANKING 전체보기", description = "RANKING 뮤지컬 전체 조회하는 API")
47-
public ApiResponse<MusicalResponseDTO.MusicalHomeListDTO> getAllRankMusicals(@RequestParam(defaultValue = "0", name = "page") Integer page) {
54+
public ApiResponse<Page<MusicalResponseDTO.MusicalHomeDTO>> getAllRankMusicals(@RequestParam(defaultValue = "0", name = "page") Integer page) {
4855
return ApiResponse.onSuccess(musicalService.getAllHotMusicals(page));
4956
}
5057

src/main/java/muit/backend/controller/TheatreController.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@
33
import io.swagger.v3.oas.annotations.Operation;
44
import io.swagger.v3.oas.annotations.Parameter;
55
import io.swagger.v3.oas.annotations.Parameters;
6+
import io.swagger.v3.oas.annotations.tags.Tag;
7+
import jakarta.persistence.Enumerated;
68
import lombok.RequiredArgsConstructor;
79
import muit.backend.apiPayLoad.ApiResponse;
10+
import muit.backend.domain.enums.Floor;
811
import muit.backend.domain.enums.SectionType;
912
import muit.backend.dto.sectionDTO.SectionResponseDTO;
1013
import muit.backend.dto.theatreDTO.TheatreResponseDTO;
1114
import muit.backend.service.theatreService.TheatreService;
1215
import org.springframework.web.bind.annotation.*;
1316

17+
@Tag(name = "공연장")
1418
@RestController
1519
@RequiredArgsConstructor
1620
@RequestMapping("/theatres")
1721
public class TheatreController {
1822
private final TheatreService theatreService;
1923

20-
@GetMapping ("/")
24+
@GetMapping ("")
2125
@Operation(summary = "공연장 검색", description = "시야확인에서 공연장을 검색하는 API 입니다.")
2226
@Parameters({
2327
@Parameter(name = "theatreName", description = "공연장 이름을 검색어로 입력")
@@ -26,8 +30,14 @@ public ApiResponse<TheatreResponseDTO.TheatreResultListDTO> getTheatre(@RequestP
2630
return ApiResponse.onSuccess(theatreService.findTheatreByName(theatreName));
2731
}
2832

29-
@GetMapping ("/{theatreId}")
30-
@Operation(summary = "공연장 좌석 조회", description = "특정 공연장의 좌석 정보를 조회하는 API 입니다.")
33+
@GetMapping("/{theatreId}/floor")
34+
@Operation(summary = "층 별 섹션 조회", description = "특정 공연장의 층에 따른 섹션을 조회하는 API 입니다.")
35+
public ApiResponse<SectionResponseDTO.FloorResultDTO> getFloorSection(@PathVariable("theatreId") Long theatreId, @RequestParam("floor")Floor floor){
36+
return ApiResponse.onSuccess(theatreService.getFloor(theatreId, floor));
37+
}
38+
39+
@GetMapping ("/{theatreId}/sectionType")
40+
@Operation(summary = "섹션 별 좌석 조회", description = "선택한 섹션의 좌석 정보를 조회하는 API 입니다.")
3141
@Parameters({
3242
@Parameter(name = "theatreId", description = "좌석 조회할 공연장 id"),
3343
@Parameter(name = "sectionType", description = "A,B,C,D... 조회할 자리가 속한 섹션 선택")
@@ -36,4 +46,6 @@ public ApiResponse<SectionResponseDTO.SectionResultDTO> getSeatInfo(@PathVariabl
3646
return ApiResponse.onSuccess(theatreService.getSection(theatreId, sectionType));
3747
}
3848

49+
50+
3951
}

src/main/java/muit/backend/controller/adminController/AdminWebController.java

+2-26
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io.swagger.v3.oas.annotations.Operation;
44
import io.swagger.v3.oas.annotations.Parameter;
55
import io.swagger.v3.oas.annotations.Parameters;
6+
import io.swagger.v3.oas.annotations.tags.Tag;
67
import lombok.RequiredArgsConstructor;
78
import muit.backend.apiPayLoad.ApiResponse;
89
import muit.backend.dto.adminDTO.manageEventDTO.ManageEventResponseDTO;
@@ -20,6 +21,7 @@
2021
import java.util.List;
2122
import java.util.Set;
2223

24+
@Tag(name = "외부 웹 이용")
2325
@RestController
2426
@RequiredArgsConstructor
2527
@RequestMapping("/admin")
@@ -44,31 +46,5 @@ public ApiResponse<String> createMusical(@RequestParam("kopisMusicalId") String
4446
return ApiResponse.onSuccess("뮤지컬 정보를 성공적으로 저장하였습니다.");
4547
}
4648

47-
@GetMapping("/events")
48-
@Operation(summary = "관리자 기능 중 이벤트 관리 초기 화면", description = "DB의 전체 뮤지컬 항목을 조회하는 API (이벤트 존재하는 뮤지컬 우선 정렬)")
49-
public ApiResponse<Page<ManageEventResponseDTO.ManageEventResultListDTO>> getAllMusicals(@ParameterObject Pageable pageable,
50-
@RequestParam(required = false) String keyword,
51-
@RequestParam(required = false) Set<String> selectedFields) {
52-
Page<ManageEventResponseDTO.ManageEventResultListDTO> events = manageEventService.getAllMusicals(pageable, keyword, selectedFields);
53-
return ApiResponse.onSuccess(events);
54-
}
55-
56-
@GetMapping("/events/{musicalId}")
57-
@Operation(summary = "이벤트 관리에서 특정 뮤지컬 상세 화면", description = "이벤트 관리 - 상세 버튼 클릭 - 해당 뮤지컬의 이벤트들을 조회하는 API")
58-
@Parameters({
59-
@Parameter(name = "musicalId", description = "이벤트 정보를 알고 싶은 뮤지컬id 입력")
60-
})
61-
public ApiResponse<ManageEventResponseDTO.ManageEventResultDTO> getEvent(@PathVariable("musicalId") Long musicalId) {
62-
return ApiResponse.onSuccess(manageEventService.getEvent(musicalId));
63-
}
64-
65-
@PostMapping("/events/{musicalId}")
66-
@Operation(summary = "특정 뮤지컬의 이벤트를 추가하는 API", description = "이벤트 관리 - 상세 - (+)로 폼 채운 후 적용하기 버튼 클릭 - 해당 뮤지컬의 이벤트를 생성하는 API")
67-
@Parameters({
68-
@Parameter(name = "musicalId", description = "이벤트를 생성하고 싶은 뮤지컬id 입력")
69-
})
70-
public ApiResponse<EventResponseDTO.EventResultDTO> createEvent(@PathVariable("musicalId") Long musicalId, @RequestBody EventRequestDTO.EventCreateDTO eventCreateDTO) {
71-
return ApiResponse.onSuccess(eventService.createEvent(musicalId, eventCreateDTO));
72-
}
7349

7450
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package muit.backend.controller.adminController;
2+
3+
import io.swagger.v3.oas.annotations.Operation;
4+
import io.swagger.v3.oas.annotations.Parameter;
5+
import io.swagger.v3.oas.annotations.Parameters;
6+
import io.swagger.v3.oas.annotations.tags.Tag;
7+
import lombok.RequiredArgsConstructor;
8+
import muit.backend.apiPayLoad.ApiResponse;
9+
import muit.backend.dto.adminDTO.manageEventDTO.ManageEventResponseDTO;
10+
import muit.backend.dto.eventDTO.EventRequestDTO;
11+
import muit.backend.dto.eventDTO.EventResponseDTO;
12+
import muit.backend.service.EventService;
13+
import muit.backend.service.adminService.ManageEventService;
14+
import org.springdoc.core.annotations.ParameterObject;
15+
import org.springframework.data.domain.Page;
16+
import org.springframework.data.domain.Pageable;
17+
import org.springframework.web.bind.annotation.*;
18+
19+
import java.util.Set;
20+
21+
@Tag(name = "어드민이 이벤트 관리")
22+
@RestController
23+
@RequiredArgsConstructor
24+
@RequestMapping("/admin/events")
25+
public class ManageEventController {
26+
private final ManageEventService manageEventService;
27+
private final EventService eventService;
28+
29+
@GetMapping("")
30+
@Operation(summary = "관리자 기능 중 이벤트 관리 초기 화면", description = "DB의 전체 뮤지컬 항목을 조회하는 API (이벤트 존재하는 뮤지컬 우선 정렬)")
31+
public ApiResponse<Page<ManageEventResponseDTO.ManageEventResultListDTO>> getAllMusicals(@ParameterObject Pageable pageable,
32+
@RequestParam(required = false) String keyword,
33+
@RequestParam(required = false) Set<String> selectedFields) {
34+
Page<ManageEventResponseDTO.ManageEventResultListDTO> events = manageEventService.getAllMusicals(pageable, keyword, selectedFields);
35+
return ApiResponse.onSuccess(events);
36+
}
37+
38+
@GetMapping("/{musicalId}")
39+
@Operation(summary = "이벤트 관리에서 특정 뮤지컬 상세 화면", description = "이벤트 관리 - 상세 버튼 클릭 - 해당 뮤지컬의 이벤트들을 조회하는 API")
40+
@Parameters({
41+
@Parameter(name = "musicalId", description = "이벤트 정보를 알고 싶은 뮤지컬id 입력")
42+
})
43+
public ApiResponse<ManageEventResponseDTO.ManageEventResultDTO> getEvent(@PathVariable("musicalId") Long musicalId) {
44+
return ApiResponse.onSuccess(manageEventService.getEvent(musicalId));
45+
}
46+
47+
@PostMapping("/{musicalId}")
48+
@Operation(summary = "특정 뮤지컬의 이벤트를 추가하는 API", description = "이벤트 관리 - 상세 - (+)로 폼 채운 후 적용하기 버튼 클릭 - 해당 뮤지컬의 이벤트를 생성하는 API")
49+
@Parameters({
50+
@Parameter(name = "musicalId", description = "이벤트를 생성하고 싶은 뮤지컬id 입력")
51+
})
52+
public ApiResponse<EventResponseDTO.EventResultDTO> createEvent(@PathVariable("musicalId") Long musicalId, @RequestBody EventRequestDTO.EventCreateDTO eventCreateDTO) {
53+
return ApiResponse.onSuccess(eventService.createEvent(musicalId, eventCreateDTO));
54+
}
55+
56+
}

src/main/java/muit/backend/controller/adminController/ManageViewController.java

+45-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@
66
import io.swagger.v3.oas.annotations.tags.Tag;
77
import lombok.RequiredArgsConstructor;
88
import muit.backend.apiPayLoad.ApiResponse;
9+
import muit.backend.domain.enums.SectionType;
910
import muit.backend.dto.adminDTO.manageViewDTO.ManageViewResponseDTO;
11+
import muit.backend.dto.sectionDTO.SectionRequestDTO;
12+
import muit.backend.dto.sectionDTO.SectionResponseDTO;
1013
import muit.backend.dto.theatreDTO.TheatreResponseDTO;
1114
import muit.backend.service.theatreService.TheatreService;
1215
import org.springframework.data.domain.Page;
1316
import org.springframework.data.domain.PageRequest;
1417
import org.springframework.data.domain.Pageable;
1518
import org.springframework.data.domain.Sort;
19+
import org.springframework.http.MediaType;
1620
import org.springframework.web.bind.annotation.*;
21+
import org.springframework.web.multipart.MultipartFile;
22+
23+
import javax.print.attribute.standard.Media;
1724

1825
@Tag(name = "어드민이 시야 관리")
1926
@RestController
@@ -31,11 +38,48 @@ public ApiResponse<ManageViewResponseDTO.AdminTheatreResultListDTO> getTheatres(
3138
}
3239

3340
@GetMapping("/{theatreId}")
34-
@Operation(summary = "시야 관리에서 특정 공연장 상세 화면", description = "시야 관리 - 상세 버튼 클릭 - 해당 공연장의 좌석 정보를 조회하는 API")
41+
@Operation(summary = "시야 관리에서 특정 공연장 상세 화면", description = "시야 관리 - 상세 버튼 클릭 - 해당 공연장의 정보를 조회하는 API")
3542
@Parameters({
3643
@Parameter(name = "theatreId", description = "시야 관리할 공연장 ID 입력")
3744
})
3845
public ApiResponse<TheatreResponseDTO.AdminTheatreDetailDTO> getTheatre(@PathVariable("theatreId") Long theatreId){
3946
return ApiResponse.onSuccess(theatreService.getTheatreDetail(theatreId));
4047
}
48+
49+
@GetMapping("/{theatreId}/section")
50+
@Operation(summary = "시야 관리에서 특정 공연장 상세 화면에서 섹션 선택", description = "시야 관리 - 상세 - 섹션(A,B,C,D ..)의 좌석정보를 조회하는 API")
51+
@Parameters({
52+
@Parameter(name = "theatreId", description = "시야 관리할 공연장 ID 입력"),
53+
@Parameter(name = "sectionType", description = "좌석 정보를 조회할 섹션 선택")
54+
})
55+
public ApiResponse<SectionResponseDTO.SectionResultDTO> getSection(@PathVariable("theatreId") Long theatreId, @RequestParam SectionType sectionType){
56+
return ApiResponse.onSuccess(theatreService.getSection(theatreId, sectionType));
57+
}
58+
59+
@GetMapping("{theatreId}/edit")
60+
@Operation(summary = "공연장 정보 조회", description = "시야관리 - 상세 - 수정하기 : 공연장 정보(전체사진, 섹션 정보) 조회")
61+
public ApiResponse<TheatreResponseDTO.AdminTheatreSectionListDTO> getTheatreSections(@PathVariable("theatreId") Long theatreId){
62+
return ApiResponse.onSuccess(theatreService.getTheatreSections(theatreId));
63+
}
64+
65+
@PatchMapping(value = "/{theatreId}/edit/theatrePic", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
66+
@Operation(summary = "공연장 전체 사진 등록/수정", description = "시야관리 - 상세 - 수정하기 - 공연장 전체사진 수정 - 사진첨부 - 등록하기 : 공연장 전체사진 등록")
67+
@Parameter(name = "theatreId", description = "사진을 등록할 공연장 Id 입력")
68+
public ApiResponse<TheatreResponseDTO.TheatreResultDTO> uploadTheatrePic(@PathVariable("theatreId") Long theatreId, @RequestPart(value = "img", required = false) MultipartFile img){
69+
return ApiResponse.onSuccess(theatreService.uploadTheatrePic(theatreId, img));
70+
}
71+
72+
@PostMapping(value = "/{theatreId}/edit/addSec", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
73+
@Operation(summary = "섹션 정보 등록하기", description = "시야관리 - 상세 - 수정하기 - 추가하기 - 정보, 사진 등록 - 등록하기 : 섹션 정보 및 사진 등록")
74+
public ApiResponse<SectionResponseDTO.SectionResultDTO> addSection(@PathVariable("theatreId") Long theatreId, @RequestPart("requestDTO") SectionRequestDTO.SectionCreateDTO requestDTO, @RequestPart(value = "img", required = false) MultipartFile img){
75+
return ApiResponse.onSuccess(theatreService.createSection(theatreId, requestDTO, img));
76+
}
77+
78+
@PatchMapping(value = "/{sectionId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
79+
@Operation(summary = "기존 섹션 정보 수정하기", description = "시야관리 - 상세 - 수정하기 - 수정, 미등록 버튼 : 섹션 정보 수정")
80+
public ApiResponse<SectionResponseDTO.SectionResultDTO> editSection(@PathVariable("sectionId") Long sectionId, @RequestPart("requestDTO") SectionRequestDTO.SectionCreateDTO requestDTO, @RequestPart(value = "img", required = false) MultipartFile img){
81+
return ApiResponse.onSuccess(theatreService.editSection(sectionId, requestDTO, img));
82+
}
83+
84+
4185
}

src/main/java/muit/backend/converter/EventConverter.java

+6-18
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,20 @@ public static EventResponseDTO.EventResultDTO toEventResultDTO(Event event) {
2121
}
2222

2323
//특정 뮤지컬의 여러 Event 리스트로 반환
24-
public static EventResponseDTO.EventResultListDTO toEventResultListDTO(List<Event> eventList) {
24+
public static EventResponseDTO.EventResultListDTO toEventResultListDTO(Musical musical, List<Event> eventList) {
2525
List<EventResponseDTO.EventResultDTO> eventResultListDTO = eventList.stream()
2626
.map(EventConverter::toEventResultDTO).collect(Collectors.toList());
2727

2828
return EventResponseDTO.EventResultListDTO.builder()
29-
.musicalId((eventList.get(0).getMusical().getId()))
30-
.musicalName(eventList.get(0).getMusical().getName())
31-
.theatreName(eventList.get(0).getMusical().getTheatre().getName())
32-
.perFrom(eventList.get(0).getMusical().getPerFrom())
33-
.perTo(eventList.get(0).getMusical().getPerTo())
29+
.musicalId(musical.getId())
30+
.musicalName(musical.getName())
31+
.theatreName(musical.getTheatre().getName())
32+
.perFrom(musical.getPerFrom())
33+
.perTo(musical.getPerTo())
3434
.eventResultListDTO(eventResultListDTO)
3535
.build();
3636
}
3737

38-
39-
//특정 뮤지컬의 여러 Event 리스트로 반환
40-
public static EventResponseDTO.EventGroupListDTO toEventGroupListDTO(List<List<Event>> eventGroupList) {
41-
List<EventResponseDTO.EventResultListDTO> eventResultListDTOList = eventGroupList.stream()
42-
.map(EventConverter::toEventResultListDTO)
43-
.collect(Collectors.toList());
44-
45-
return EventResponseDTO.EventGroupListDTO.builder()
46-
.eventResultListDTOList(eventResultListDTOList)
47-
.build();
48-
}
49-
5038
public static Event toEvent(EventRequestDTO.EventCreateDTO eventCreateDTO, Musical musical) {
5139
return Event.builder()
5240
.musical(musical)

0 commit comments

Comments
 (0)