Skip to content

Commit

Permalink
Merge pull request #189 from Team-Smeme/sohyeon_#188
Browse files Browse the repository at this point in the history
[DELETE] 스웨거 코드 삭제
  • Loading branch information
thguss authored Jan 17, 2024
2 parents a48a4a5 + 3d47867 commit bd464e5
Show file tree
Hide file tree
Showing 22 changed files with 9 additions and 154 deletions.
26 changes: 2 additions & 24 deletions src/main/java/com/smeme/server/controller/AuthController.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package com.smeme.server.controller;


import com.smeme.server.dto.auth.SignInRequestDTO;
import com.smeme.server.dto.auth.SignInResponseDTO;
import com.smeme.server.dto.auth.token.TokenResponseDTO;
import com.smeme.server.service.auth.AuthService;
import com.smeme.server.util.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
Expand All @@ -25,46 +20,29 @@
@RestController
@RequiredArgsConstructor
@RequestMapping("api/v2/auth")
@Tag(name = "Auth", description = "인증/인가 관련 API")
public class AuthController {

private final AuthService authService;

@Operation(summary = "소셜 로그인", description = "소셜 로그인을 합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "로그인 성공",
content = @io.swagger.v3.oas.annotations.media.Content(schema = @io.swagger.v3.oas.annotations.media.Schema(implementation = SignInResponseDTO.class)))})
@PostMapping
public ResponseEntity<ApiResponse> signIn(@RequestHeader("Authorization") String socialAccessToken, @RequestBody SignInRequestDTO request) throws NoSuchAlgorithmException, InvalidKeySpecException {
public ResponseEntity<ApiResponse> signIn(@RequestHeader("Authorization") String socialAccessToken, @RequestBody SignInRequestDTO request
) throws NoSuchAlgorithmException, InvalidKeySpecException {
SignInResponseDTO response = authService.signIn(socialAccessToken, request);
return ResponseEntity.ok(success(SUCCESS_SIGNIN.getMessage(), response));
}

@Operation(summary = "토큰 재발급", description = "토큰을 재발급 받습니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "토큰 재발급 성공",
content = @io.swagger.v3.oas.annotations.media.Content(schema = @io.swagger.v3.oas.annotations.media.Schema(implementation = TokenResponseDTO.class)))})
@PostMapping("/token")
public ResponseEntity<ApiResponse> reissueToken(Principal principal) {
TokenResponseDTO response = authService.issueToken(getMemberId(principal));
return ResponseEntity.ok(success(SUCCESS_ISSUE_TOKEN.getMessage(), response));
}

@SecurityRequirement(name = "Authorization")
@Operation(summary = "로그아웃", description = "로그아웃 합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "로그아웃 성공",
content = @io.swagger.v3.oas.annotations.media.Content(schema = @io.swagger.v3.oas.annotations.media.Schema(implementation = ApiResponse.class)))})
@PostMapping("/sign-out")
public ResponseEntity<ApiResponse> signOut(Principal principal) {
authService.signOut(getMemberId(principal));
return ResponseEntity.ok(success(SUCCESS_SIGNOUT.getMessage()));
}

@Operation(summary = "회원 탈퇴", description = "회원 탈퇴를 합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "회원 탈퇴 성공",
content = @io.swagger.v3.oas.annotations.media.Content(schema = @io.swagger.v3.oas.annotations.media.Schema(implementation = ApiResponse.class)))})
@DeleteMapping
public ResponseEntity<ApiResponse> withDrawl(Principal principal) {
authService.withdraw(getMemberId(principal));
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/smeme/server/controller/BadgeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
import com.smeme.server.dto.badge.BadgeListResponseDTO;
import com.smeme.server.service.BadgeService;
import com.smeme.server.util.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -24,16 +18,10 @@
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/members/badges")
@Tag(name = "Badge", description = "뱃지 관련 API")
@SecurityRequirement(name = "Authorization")
public class BadgeController {

private final BadgeService badgeService;

@Operation(summary = "사용자 뱃지 조회", description = "사용자의 뱃지를 조회합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "뱃지 조회 성공",
content = @Content(schema = @Schema(implementation = BadgeListResponseDTO.class)))})
@GetMapping
public ResponseEntity<ApiResponse> getBadgeList(Principal principal) {
BadgeListResponseDTO response = badgeService.getBadgeList(getMemberId(principal));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.smeme.server.service.DiaryService;
import com.smeme.server.util.ApiResponse;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;

@RestController
Expand All @@ -34,7 +33,6 @@
public class DiaryController {
private final DiaryService diaryService;

@Operation(description = "일기 생성")
@PostMapping
public ResponseEntity<ApiResponse> save(Principal principal, @RequestBody DiaryRequestDTO request) {
CreatedDiaryResponseDTO response = diaryService.save(getMemberId(principal), request);
Expand All @@ -43,28 +41,24 @@ public ResponseEntity<ApiResponse> save(Principal principal, @RequestBody DiaryR
.body(success(SUCCESS_CREATE_DIARY.getMessage(), response));
}

@Operation(description = "일기 조회")
@GetMapping("/{diaryId}")
public ResponseEntity<ApiResponse> getDetail(@PathVariable Long diaryId) {
DiaryResponseDTO response = diaryService.getDetail(diaryId);
return ResponseEntity.ok(success(SUCCESS_GET_DIARY.getMessage(), response));
}

@Operation(description = "일기 수정")
@PatchMapping("/{diaryId}")
public ResponseEntity<ApiResponse> update(@PathVariable Long diaryId, @RequestBody DiaryRequestDTO request) {
diaryService.update(diaryId, request);
return ResponseEntity.ok(success(SUCCESS_UPDATE_DAIRY.getMessage()));
}

@Operation(description = "일기 삭제")
@DeleteMapping("/{diaryId}")
public ResponseEntity<ApiResponse> delete(@PathVariable Long diaryId) {
diaryService.delete(diaryId);
return ResponseEntity.ok(success(SUCCESS_DELETE_DIARY.getMessage()));
}

@Operation(description = "일기 리스트 조회")
@GetMapping
public ResponseEntity<ApiResponse> getDiaries(
Principal principal,
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/smeme/server/controller/GoalController.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,21 @@
import com.smeme.server.service.GoalService;
import com.smeme.server.util.ApiResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;

@Tag(name = "Goal", description = "학습 목표 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/goals")
public class GoalController {

private final GoalService goalService;

@Operation(description = "전체 학습 목표 조회")
@GetMapping
public ResponseEntity<ApiResponse> getAll() {
GoalsResponseDTO response = goalService.getAll();
return ResponseEntity.ok(success(SUCCESS_GET_GOALS.getMessage(), response));
}

@Operation(description = "학습 목표 조회")
@GetMapping("/{type}")
public ResponseEntity<ApiResponse> getByType(@PathVariable GoalType type) {
GoalResponseDTO response = goalService.getByType(type);
Expand Down
27 changes: 1 addition & 26 deletions src/main/java/com/smeme/server/controller/MemberController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
import com.smeme.server.dto.member.*;
import com.smeme.server.service.MemberService;
import com.smeme.server.util.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
Expand All @@ -24,53 +18,34 @@
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/members")
@Tag(name = "Member", description = "사용자 관련 API")
@SecurityRequirement(name = "Authorization")
public class MemberController {

private final MemberService memberService;

@Operation(summary = "사용자 정보 수정", description = "사용자의 정보를 수정합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "사용자 정보 수정 성공")})
@PatchMapping()
@PatchMapping
public ResponseEntity<ApiResponse> updateProfile(Principal principal, @RequestBody MemberUpdateRequestDTO request) {
MemberUpdateResponseDTO response = memberService.updateMember(getMemberId(principal), request);
return ResponseEntity.ok(success(SUCCESS_UPDATE_USERNAME.getMessage(), response));
}

@Operation(summary = "사용자 정보 조회", description = "사용자의 정보를 조회합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "사용자 정보 수정 성공"
, content = @Content(schema = @Schema(implementation = MemberGetResponseDTO.class)))})
@GetMapping("/me")
public ResponseEntity<ApiResponse> getProfile(Principal principal) {
MemberGetResponseDTO response = memberService.getProfile(getMemberId(principal));
return ResponseEntity.ok(success(SUCCESS_GET_USER.getMessage(), response));
}

@Operation(summary = "사용자 학습 계획 변경", description = "사용자의 학습 계획을 변경합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "사용자 학습 계획 성공")})
@PatchMapping("/plan")
public ResponseEntity<ApiResponse> updateUserPlan(Principal principal, @Valid @RequestBody MemberPlanUpdateRequestDTO request) {
memberService.updateMemberPlan(getMemberId(principal), request);
return ResponseEntity.ok(success(SUCCESS_UPDATE_USER_PLAN.getMessage()));
}

@Operation(summary = "닉네임 중복 체크", description = "닉네임 중복 체크를 합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "닉네임 중복 체크 성공"
, content = @Content(schema = @Schema(implementation = MemberNameResponseDTO.class)))})
@GetMapping("/nickname/check")
public ResponseEntity<ApiResponse> checkDuplicatedName(@Parameter(description = "유저 닉네임") @RequestParam String name) {
MemberNameResponseDTO response = memberService.checkDuplicatedName(name);
return ResponseEntity.ok(success(SUCCESS_CHECK_DUPLICATED_NAME.getMessage(), response));
}

@Operation(summary = "사용자 푸쉬 알람 동의 여부 수정", description = "사용자의 푸쉬 알람 동의 여부를 수정합니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "사용자 푸쉬 알람 동의 여부 수정 성공")})
@PatchMapping("/push")
public ResponseEntity<ApiResponse> updateUserPush(Principal principal, @RequestBody MemberPushUpdateRequestDTO request) {
memberService.updateHasAlarm(getMemberId(principal), request);
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/smeme/server/controller/TestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
import com.smeme.server.service.MessageService;
import com.smeme.server.util.ApiResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;

@Tag(name = "Test", description = "테스트 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/test")
Expand All @@ -28,19 +24,11 @@ public class TestController {
private final MessageService messageService;
private final ValueConfig valueConfig;

@Operation(summary = "서버 연결 테스트", description = "서버 연결을 테스트합니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "서버 연결 성공")
})
@GetMapping
public ResponseEntity<ApiResponse> test() {
return ResponseEntity.ok(success("server connect"));
}

@Operation(summary = "푸시 알림 테스트", description = "푸시 알림을 테스트합니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "알림 전송 성공")
})
@GetMapping("/alarm")
public ResponseEntity<ApiResponse> alarmTest(@Parameter(hidden = true) Principal principal) {
messageService.pushTest(valueConfig.getMESSAGE_TITLE(), valueConfig.getMESSAGE_BODY(), Long.valueOf(principal.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static com.smeme.server.util.ApiResponse.success;
import static com.smeme.server.util.message.ResponseMessage.*;

import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -13,23 +12,15 @@
import com.smeme.server.service.TopicService;
import com.smeme.server.util.ApiResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;

@Tag(name = "Topic", description = "랜덤 주제 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/topics")
@SecurityRequirement(name = "Authorization")
public class TopicController {

private final TopicService topicService;

@Operation(summary = "랜덤 주제 조회", description = "랜덤 주제를 임의로 조회합니다.")
@GetMapping("/random")
public ResponseEntity<ApiResponse> getRandom() {
TopicResponseDTO response = topicService.getRandom();
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/smeme/server/dto/auth/SignInRequestDTO.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.smeme.server.dto.auth;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.smeme.server.model.SocialType;
import io.swagger.v3.oas.annotations.media.Schema;

public record SignInRequestDTO(
@Schema(description = "소셜 로그인 타입", example = "KAKAO")
@JsonProperty("social")
SocialType socialType,
@Schema(description = "fcm 토큰", example = "dsdsdsdsds")
String fcmToken
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@


import com.smeme.server.dto.auth.token.TokenVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;


@Builder
public record SignInResponseDTO(
@Schema(description = "smeme access token", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0IiwiaWF0IjoxNjIyMjU0NjY4LCJleHAiO")
String accessToken,
@Schema(description = "smeme refresh token", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0IiwiaWF0IjoxNjIyMjU0NjY4LCJleHAiO")
String refreshToken,
@Schema(description = "회원 정보 등록 여부", example = "true")
boolean isRegistered,
@Schema(description = "회원의 목표 언어", example = "EN")
boolean hasPlan
) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.smeme.server.dto.auth.beta;

import io.swagger.v3.oas.annotations.media.Schema;

public record BetaSignInRequestDTO(
@Schema(description = "FCM 토큰", example = "dsdsdsdsds")
String fcmToken
) {
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.smeme.server.dto.auth.beta;

import com.smeme.server.dto.badge.BadgeResponseDTO;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;

public record BetaTokenResponseDTO(
@Schema(description = "smeme beta access token", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0IiwiaWF0IjoxNjIyMjU0NjY4LCJleHAiO")
String accessToken,
List<BadgeResponseDTO> badges
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.smeme.server.dto.badge;


import java.util.List;

public record BadgeListResponseDTO(List<BadgeResponseDTO> badges) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

import com.smeme.server.model.badge.Badge;
import com.smeme.server.model.badge.MemberBadge;
import io.swagger.v3.oas.annotations.media.Schema;

public record BadgeResponseDTO(
@Schema(description = "뱃지 id", example = "1")
Long id,
@Schema(description = "뱃지 이름", example = "연속 3일 일기 뱃지")
String name,
@Schema(description = "뱃지 타입", example = "STREAK")
String type,
@Schema(description = "뱃지 이미지 url", example = "https://m.s3.ap-northeast-2.amazonaws.com/badge/streak.png")
String imageUrl) {
String imageUrl
) {
public static BadgeResponseDTO of(MemberBadge memberBadge) {
return new BadgeResponseDTO(memberBadge.getBadge().getId(), memberBadge.getBadge().getName(), memberBadge.getBadge().getType().toString(), memberBadge.getBadge().getImageUrl());
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/smeme/server/dto/diary/DiaryRequestDTO.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.smeme.server.dto.diary;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.NonNull;

@Schema(description = "일기 생성 요청 DTO")
public record DiaryRequestDTO(
@NonNull
String content,
Expand Down
Loading

0 comments on commit bd464e5

Please sign in to comment.