Skip to content

Commit

Permalink
Merge pull request #266 from leeeeeyeon/feature/api-version
Browse files Browse the repository at this point in the history
feat: URL에 API 버전 추가
  • Loading branch information
leeeeeyeon authored Oct 12, 2023
2 parents 56d8937 + 99a552b commit ba7a58e
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "Admin 관련 API")
@RequestMapping("/admin")
@RequestMapping("/api/v1/admin")
@RestController
@RequiredArgsConstructor
public class AdminController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@Tag(name = "Agora 관련 API")
@RestController
@RequestMapping("/crews/voice-room")
@RequestMapping("/api/v1/crews/voice-room")
@RequiredArgsConstructor
public class AgoraController {
private final AgoraService agoraService;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/gsm/blabla/auth/api/AuthController.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@Tag(name = "OAuth 관련 API")
@RestController
@RequestMapping("/oauth")
@RequestMapping("/api/v1/oauth")
@RequiredArgsConstructor
public class AuthController {
private final AuthService authService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@Validated
@Tag(name = "컨텐츠 관련 API")
@RestController
@RequestMapping("/contents")
@RequestMapping("/api/v1/contents")
@RequiredArgsConstructor
public class ContentController {

Expand Down
20 changes: 6 additions & 14 deletions src/main/java/com/gsm/blabla/crew/api/CrewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@

@Tag(name = "Crew 관련 API")
@RestController
@RequestMapping("/api/v1/crews/reports")
@RequiredArgsConstructor
public class CrewController {

private final CrewService crewService;


@Operation(summary = "음성 파일 분석 API")
@PostMapping(value = "/crews/reports/voice-file")
@PostMapping(value = "/voice-file")
public DataResponseDto<Map<String, String>> createVoiceFile(
@RequestBody VoiceAnalysisResponseDto voiceAnalysisResponseDto) {
return DataResponseDto.of(crewService.createVoiceFile(voiceAnalysisResponseDto));
}

@Operation(summary = "음성 파일 분석 요청 API")
@PostMapping(value = "/crews/reports/{reportId}/voice-file/request")
@PostMapping(value = "/{reportId}/voice-file/request")
public DataResponseDto<Map<String, Long>> createVoiceFileRequest(
@PathVariable("reportId") Long reportId,
@RequestParam("file") MultipartFile file,
Expand All @@ -37,35 +38,26 @@ public DataResponseDto<Map<String, Long>> createVoiceFileRequest(
}

@Operation(summary = "크루 리포트 생성 API")
@PostMapping(value = "/crews/reports/{reportId}")
@PostMapping(value = "/{reportId}")
public DataResponseDto<Map<String, String>> createReport(
@PathVariable("reportId") Long reportId) {
return DataResponseDto.of(crewService.createReport(reportId));
}

@Operation(summary = "크루 리포트 생성 요청 API")
@PostMapping(value = "/crews/reports/{reportId}/request")
@PostMapping(value = "/{reportId}/request")
public DataResponseDto<Map<String, String>> createReportRequest(
@PathVariable("reportId") Long reportId) {
return DataResponseDto.of(crewService.createReportRequest(reportId));
}

@Operation(summary = "크루 리포트 조회 API")
@GetMapping(value = "/crews/reports/{reportId}")
@GetMapping(value = "/{reportId}")
public DataResponseDto<CrewReportResponseDto> getReport(
@PathVariable("reportId") Long reportId) {
return DataResponseDto.of(crewService.getReport(reportId));
}

@Operation(summary = "멤버 프로필 조회 API")
@GetMapping("/{language}/crews/{crewId}/profile/{memberId}")
public DataResponseDto<MemberProfileResponseDto> getMemberProfile(
@PathVariable String language,
@PathVariable Long crewId,
@PathVariable Long memberId) {
return DataResponseDto.of(crewService.getMemberProfile(language, crewId, memberId));
}

@Operation(summary = "음성 채팅 유저 피드백 저장 API")
@PostMapping(value = "/voice-files/{voiceFileId}/feedback")
public DataResponseDto<Map<String, String>> createFeedback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@Tag(name = "크루 스페이스 일정 관련 API")
@RestController
@RequestMapping("/crews/schedules")
@RequestMapping("/api/v1/crews/schedules")
@RequiredArgsConstructor
public class ScheduleController {

Expand Down
13 changes: 0 additions & 13 deletions src/main/java/com/gsm/blabla/crew/application/CrewService.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,6 @@ public Map<String, Long> createVoiceFileRequest(Long reportId, MultipartFile fil
return Collections.singletonMap("voiceFileId", voiceFileId);
}

@Transactional(readOnly = true)
public MemberProfileResponseDto getMemberProfile(String language, Long crewId, Long memberId) {
if (!Objects.equals(language, "ko") && !Objects.equals(language, "en")) {
throw new GeneralException(Code.LANGUAGE_NOT_SUPPORTED, "ko 또는 en만 지원합니다.");
}

Member member = memberRepository.findById(memberId).orElseThrow(
() -> new GeneralException(Code.MEMBER_NOT_FOUND, "존재하지 않는 유저입니다.")
);

return MemberProfileResponseDto.getCrewMemberProfile(member);
}

public Map<String, String> createReportRequest(Long reportId) {

LocalDateTime endAt = LocalDateTime.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@Validated
@Tag(name = "멤버 관련 API")
@RestController
@RequestMapping("/api/v1")
@RequiredArgsConstructor
public class MemberController {
private final MemberService memberService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@Tag(name = "Report 관련 API")
@RestController
@RequestMapping("/reports")
@RequestMapping("/api/v1/reports")
@RequiredArgsConstructor
public class ReportController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AdminControllerTest extends ControllerTestSupport {
@WithCustomMockUser
void getHealthCheck() throws Exception {
mockMvc.perform(
get("/admin/health-check")
get("/api/v1/admin/health-check")
)
.andDo(print())
.andExpect(status().isOk())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void create() throws Exception {

// when // then
mockMvc.perform(
post("/crews/voice-room")
post("/api/v1/crews/voice-room")
.with(csrf())
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(
Expand Down Expand Up @@ -73,7 +73,7 @@ void getMembers() throws Exception {

// when // then
mockMvc.perform(
get("/crews/voice-room")
get("/api/v1/crews/voice-room")

)
.andDo(print())
Expand All @@ -94,7 +94,7 @@ void accuse() throws Exception {

// when // then
mockMvc.perform(
post("/crews/voice-room/accuse")
post("/api/v1/crews/voice-room/accuse")
.with(csrf())
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(AccuseRequestDto.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void signUp() throws Exception {

// when // then
mockMvc.perform(
post("/oauth/sign-up")
post("/api/v1/oauth/sign-up")
.with(csrf())
.contentType(MediaType.APPLICATION_JSON_VALUE)
.header("Authorization", "test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void getContents() throws Exception {

// when // then
mockMvc.perform(
get("/contents").header("Content-Language", "ko")
get("/api/v1/contents").header("Content-Language", "ko")
)
.andDo(print())
.andExpect(status().isOk())
Expand Down Expand Up @@ -73,7 +73,7 @@ void getContentDetails() throws Exception {

// when // then
mockMvc.perform(
get("/contents/{contentId}", 1L)
get("/api/v1/contents/{contentId}", 1L)
)
.andDo(print())
.andExpect(status().isOk())
Expand Down Expand Up @@ -113,7 +113,7 @@ void getContentDetail() throws Exception {

// when // then
mockMvc.perform(
get("/contents/detail/{contentDetailId}", 1L)
get("/api/v1/contents/detail/{contentDetailId}", 1L)
)
.andDo(print())
.andExpect(status().isOk())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void getReport() throws Exception {

// when // then
mockMvc.perform(
get("/crews/reports/{reportId}", any(Long.class))
get("/api/v1/crews/reports/{reportId}", any(Long.class))
)
.andDo(print())
.andExpect(status().isOk())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void create() throws Exception {

// when // then
mockMvc.perform(
post("/crews/schedules")
post("/api/v1/crews/schedules")
.with(csrf())
.contentType(MediaType.APPLICATION_JSON_VALUE)
.header("Authorization", "test")
Expand Down Expand Up @@ -66,7 +66,7 @@ void getAll() throws Exception {

// when // then
mockMvc.perform(
get("/crews/schedules")
get("/api/v1/crews/schedules")
)
.andDo(print())
.andExpect(status().isOk())
Expand All @@ -90,7 +90,7 @@ void getUpcomingSchedule() throws Exception {

// when // then
mockMvc.perform(
get("/crews/schedules/upcoming")
get("/api/v1/crews/schedules/upcoming")
)
.andDo(print())
.andExpect(status().isOk())
Expand All @@ -111,7 +111,7 @@ void joinSchedule() throws Exception {

// when // then
mockMvc.perform(
post("/crews/schedules/join")
post("/api/v1/crews/schedules/join")
.with(csrf())
.header("Authorization", "test")
.contentType(MediaType.APPLICATION_JSON_VALUE)
Expand All @@ -136,7 +136,7 @@ void cancelSchedule() throws Exception {

// when // then
mockMvc.perform(
delete("/crews/schedules")
delete("/api/v1/crews/schedules")
.with(csrf())
.header("Authorization", "test")
.contentType(MediaType.APPLICATION_JSON_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void getHistory() throws Exception {

// when // then
mockMvc.perform(
get("/reports/history")
get("/api/v1/reports/history")
.with(csrf())
)
.andDo(print())
Expand Down

0 comments on commit ba7a58e

Please sign in to comment.