Skip to content

Commit

Permalink
Merge pull request #76 from Clubber2024/feat/#74-feat-swagger-설정
Browse files Browse the repository at this point in the history
Feat : Auth, Review, Favorite, User API Swagger 설정
  • Loading branch information
mjKim1229 authored May 18, 2024
2 parents 6decd25 + 55e5800 commit acea2b2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import com.clubber.ClubberServer.domain.auth.dto.KakaoOauthResponse;
import com.clubber.ClubberServer.domain.user.domain.User;
import com.clubber.ClubberServer.domain.auth.service.AuthService;
import com.clubber.ClubberServer.global.config.swagger.DisableSwaggerSecurity;
import com.clubber.ClubberServer.global.infrastructure.outer.api.oauth.dto.KakaoTokenResponse;
import com.clubber.ClubberServer.global.infrastructure.outer.api.oauth.dto.KakaoUserInfoResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -18,6 +21,7 @@
@RestController
@RequestMapping("/v1/auths")
@RequiredArgsConstructor
@Tag(name = "[인증]")
public class AuthController {

private final AuthService authService;
Expand All @@ -31,16 +35,20 @@ public KakaoOauthResponse getCredentialFromKakao(@RequestParam String code){
return authService.generateUserToken(user);
}

@Operation(summary = "토큰 재발급", description = "토큰 만료시 호출 API")
@PostMapping("/refresh")
public KakaoOauthResponse tokenRefresh(@RequestHeader(value = "token") String refreshToken){
return authService.tokenRefresh(refreshToken);
}

@Operation(summary = "카카오 로그아웃")
@PostMapping("/logout")
public void logOutKakaoUser(){
authService.logoutKakaoUser();
}


@Operation(summary = "카카오 회원탈퇴")
@DeleteMapping("/withdraw")
public void withDrawKakaoUser(){
authService.withDrawKakaoUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import com.clubber.ClubberServer.domain.favorite.dto.FavoriteResponse;
import com.clubber.ClubberServer.domain.favorite.service.FavoriteService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -13,15 +15,18 @@
@RestController
@RequestMapping("v1/clubs/{clubId}/favorites")
@RequiredArgsConstructor
@Tag(name = "[즐겨찾기]")
public class FavoriteController {

private final FavoriteService favoriteService;

@Operation(summary = "동아리 즐겨찾기 추가")
@PostMapping
public FavoriteResponse createFavorite(@PathVariable Long clubId){
return favoriteService.createFavorite(clubId);
}

@Operation(summary = "동아리 즐겨찾기 삭제")
@DeleteMapping("/{favoriteId}")
public FavoriteResponse deleteFavorite(@PathVariable Long clubId, @PathVariable Long favoriteId){
return favoriteService.deleteFavorite(clubId, favoriteId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.clubber.ClubberServer.domain.review.dto.ReviewRequest;
import com.clubber.ClubberServer.domain.review.service.ReviewService;
import com.clubber.ClubberServer.global.config.swagger.DisableSwaggerSecurity;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -18,21 +20,26 @@
@RestController
@RequestMapping("/v1/clubs/{clubId}/reviews")
@RequiredArgsConstructor
@Tag(name = "[리뷰]")
public class ReviewController {

private final ReviewService reviewService;

@Operation(summary = "동아리 리뷰 작성", description = "리뷰 키워드 항목을 선택하여 작성")
@PostMapping
public ReviewCreateResponse createReview(@RequestBody ReviewRequest reviewRequest,
@PathVariable Long clubId){
return reviewService.createReview(clubId, reviewRequest);
}

@Operation(summary = "개별 동아리 별 리뷰 조회")
@DisableSwaggerSecurity
@GetMapping
public ClubReviewResponse getClubReviews(@PathVariable Long clubId){
return reviewService.getClubReviews(clubId);
}

@Operation(summary = "개별 동아리 별 리뷰 키워드 통계")
@DisableSwaggerSecurity
@GetMapping("/keyword-stats")
public ClubReviewKeywordStatsResponse getReviewKeywordStats(@PathVariable Long clubId){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.clubber.ClubberServer.domain.review.dto;

import com.clubber.ClubberServer.domain.review.domain.Keyword;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
import lombok.AccessLevel;
Expand All @@ -11,5 +12,7 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ReviewRequest {

@Schema(description = "선택한 리뷰 키워드들",
example = "{\"keywords\": [\"CULTURE\", \"FEE\"]}")
private List<Keyword> keywords;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.clubber.ClubberServer.domain.user.dto.UserFavoritesResponse.FavoriteResponse;
import com.clubber.ClubberServer.domain.user.dto.UserProfileResponse;
import com.clubber.ClubberServer.domain.user.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -15,20 +17,24 @@
@RestController
@RequestMapping("/v1/users")
@RequiredArgsConstructor
@Tag(name = "[회원]")
public class UserController {

private final UserService userService;

@Operation(summary = "회원 정보 조회")
@GetMapping("/me")
public UserProfileResponse getUserProfile(){
return userService.getUserProfile();
}

@Operation(summary = "회원 즐겨찾기 조회")
@GetMapping("/favorite")
public UserFavoritesResponse getUserFavorites() {
return userService.getUserFavorites();
}

@Operation(summary = "회원 작성 리뷰 조회")
@GetMapping("/review")
public UserReviewResponse getUserReviews() { return userService.getUserReviews(); }
}

0 comments on commit acea2b2

Please sign in to comment.