Skip to content

Commit

Permalink
✨ feat(api): Add ApiResponse, ApiErrorReponse Annotation (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunyoung1819 authored Oct 5, 2023
1 parent 6325715 commit ca81704
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@


import com.depromeet.common.dto.ResponseDto;
import com.depromeet.common.error.dto.ErrorCode;
import com.depromeet.domains.geo.dto.request.ReverseGeocodeRequestDto;
import com.depromeet.domains.geo.dto.response.ReverseGeocodeResponseDto;
import com.depromeet.domains.geo.service.GeoService;
import com.depromeet.external.swagger.annotation.ApiErrorResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
Expand All @@ -23,6 +26,8 @@ public class GeoController {
private final GeoService geoService;

@Operation(summary = "Reverse Geocoding")
@ApiResponse(responseCode = "200", description = "좌표 주소 변환 성공")
@ApiErrorResponse(errorCode = ErrorCode.NOT_SUPPORT_LOCATION, description = "유효하지 않은 좌표 입니다")
@GetMapping("/reverse-geocode")
public ResponseEntity<ReverseGeocodeResponseDto> reverseGeocode(
@Valid ReverseGeocodeRequestDto reverseGeocodeRequestDto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class UserController {
private final UserLevelService userLevelService;

@Operation(summary = "내 정보 가져오기")
@ApiResponse(responseCode = "200", description = "내 정보 가져오기 성공")
@GetMapping("/me")
public ResponseEntity<UserResponseDto> getUserInfo(
@ReqUser User user
Expand All @@ -37,6 +38,7 @@ public ResponseEntity<UserResponseDto> getUserInfo(
}

@Operation(summary = "닉네임 변경하기")
@ApiResponse(responseCode = "200", description = "닉네임 변경 성공")
@PatchMapping("/me/nickname")
public ResponseEntity<UserResponseDto> changeNickname(
@ReqUser User user,
Expand All @@ -48,6 +50,7 @@ public ResponseEntity<UserResponseDto> changeNickname(
}

@Operation(summary = "사용자 뮤직 앱 변경")
@ApiResponse(responseCode = "200", description = "사용자 레벨 조회 성공")
@PatchMapping("/music-app")
public ResponseEntity<UserResponseDto> changeMusicApp(
@ReqUser User user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import com.depromeet.common.dto.InfiniteScrollResponseDto;
import com.depromeet.common.dto.ResponseDto;
import com.depromeet.common.error.dto.ErrorCode;
import com.depromeet.domains.user.service.UserItemService;
import com.depromeet.external.swagger.annotation.ApiErrorResponse;
import com.depromeet.security.annotation.ReqUser;
import com.depromeet.user.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
Expand All @@ -23,6 +26,7 @@ public class UserItemController {
private final UserItemService userItemService;

@Operation(summary = "사용자가 드랍한 아이템 조회")
@ApiResponse(responseCode = "200", description = "사용자가 드랍한 아이템 조회 성공")
@GetMapping("/drop")
public ResponseEntity<InfiniteScrollResponseDto<?, ?>> getUserDropItems(
@ReqUser User user,
Expand All @@ -33,6 +37,7 @@ public class UserItemController {
}

@Operation(summary = "사용자가 찜한 아이템 조회")
@ApiResponse(responseCode = "200", description = "사용자가 찜한 아이템 조회 성공")
@GetMapping("/like")
public ResponseEntity<InfiniteScrollResponseDto<?, ?>> getUserLikedItems(
@ReqUser User user,
Expand Down

0 comments on commit ca81704

Please sign in to comment.