Skip to content

Commit

Permalink
Feature: swagger 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
persi0815 committed Feb 13, 2024
1 parent a2e26b9 commit b766dde
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "장소 좋아요", description = "장소 좋아요 관련 api 입니다.")
@Tag(name = "장소 좋아요", description = "장소 좋아요 관련 api 입니다. - 양지원")
@RestController
@RequestMapping("/locations/{location-id}")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.travelcompass.api.oauth.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
Expand All @@ -8,8 +11,14 @@
import java.util.HashMap;
import java.util.Map;

@Tag(name = "토큰", description = "access token 관련 api 입니다. - 양지원")
@RestController
public class TokenController {

@Operation(summary = "토큰 반환", description = "로컬에서 로그인했을때 토큰 반환받는 메서드입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON_200", description = "Success"),
})
@GetMapping("/token")
public ResponseEntity<Map<String, String>> tokenPagge(
@RequestParam(name = "access-token") String accessToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,36 @@
import com.travelcompass.api.global.api_payload.ApiResponse;
import com.travelcompass.api.global.api_payload.SuccessCode;
import com.travelcompass.api.oauth.jwt.JwtDto;
import com.travelcompass.api.oauth.jwt.JwtTokenUtils;
import com.travelcompass.api.oauth.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;

@Tag(name = "회원", description = "회원 관련 api 입니다. - 양지원")
@RestController
@RequiredArgsConstructor
@RequestMapping("/users")
public class UserController {
private final UserService userService;
private final JwtTokenUtils jwtTokenUtils;

// 로그아웃
@Operation(summary = "로그아웃", description = "로그아웃하는 메서드입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "USER_202", description = "로그아웃 되었습니다."),
})
@DeleteMapping("/logout")
public ApiResponse<Integer> logout(HttpServletRequest request) {
userService.logout(request);
return ApiResponse.onSuccess(SuccessCode.USER_LOGOUT_SUCCESS, 1);
}

// 토큰 재발급
@Operation(summary = "토큰 재발급", description = "토큰을 재발급하는 메서드입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "USER_203", description = "토큰 재발급이 완료되었습니다."),
})
@PostMapping("/reissue")
public ApiResponse<JwtDto> reissue(
HttpServletRequest request
Expand All @@ -33,7 +41,10 @@ public ApiResponse<JwtDto> reissue(
return ApiResponse.onSuccess(SuccessCode.USER_REISSUE_SUCCESS, jwt);
}

// 회원탈퇴
@Operation(summary = "회원탈퇴", description = "회원 탈퇴하는 메서드입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "USER_204", description = "회원탈퇴가 완료되었습니다."),
})
@DeleteMapping("/me")
public ApiResponse<Integer> deleteUser(Authentication auth) {
userService.deleteUser(auth.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
@Tag(name = "여행 계획 좋아요", description = "여행 계획 좋아요 관련 api 입니다.")
@Tag(name = "여행 계획 좋아요", description = "여행 계획 좋아요 관련 api 입니다. - 양지원")
@RestController
@RequestMapping("/plans/{plan-id}")
@RequiredArgsConstructor
Expand Down

0 comments on commit b766dde

Please sign in to comment.