Skip to content

Commit

Permalink
Merge pull request #86 from Travalue/develop
Browse files Browse the repository at this point in the history
Refactor: swagger 관련 수정
  • Loading branch information
seohyun-106 authored Jul 19, 2023
2 parents 715857a + 3108680 commit 5dd7e63
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.deploy.Travalue.travel.controller.dto.request.CategoryRequestDto;
import com.deploy.Travalue.travel.service.CategoryService;
import com.deploy.Travalue.travel.service.dto.response.CategoryListResponseDto;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

import org.springframework.http.HttpStatus;
Expand All @@ -28,6 +29,7 @@ public class CategoryController {
@Auth
@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
@ApiOperation("카테고리 생성")
public ApiResponse create(@UserId Long userId, @ModelAttribute @Valid final CategoryRequestDto request) {
final String imagePath = s3Service.uploadImage(request.getThumbnail(), "category");
categoryService.create(userId, imagePath, request);
Expand All @@ -37,6 +39,7 @@ public ApiResponse create(@UserId Long userId, @ModelAttribute @Valid final Cate
@Auth
@ResponseStatus(HttpStatus.OK)
@PutMapping(value = "{categoryId}")
@ApiOperation("카테고리 수정")
public ApiResponse update(@UserId Long userId, @PathVariable final Long categoryId, @ModelAttribute @Valid final CategoryRequestDto request) {
final String imagePath = s3Service.uploadImage(request.getThumbnail(), "category");
categoryService.update(userId, categoryId, imagePath, request);
Expand All @@ -46,6 +49,7 @@ public ApiResponse update(@UserId Long userId, @PathVariable final Long category
@Auth
@ResponseStatus(HttpStatus.OK)
@DeleteMapping(value = "{categoryId}")
@ApiOperation("카테고리 삭제")
public ApiResponse delete(@UserId Long userId, @PathVariable final Long categoryId) {
categoryService.delete(userId, categoryId);
return ApiResponse.success(SuccessCode.DELETE_CATEGORY_SUCCESS);
Expand All @@ -54,6 +58,7 @@ public ApiResponse delete(@UserId Long userId, @PathVariable final Long category
@Auth
@ResponseStatus(HttpStatus.OK)
@GetMapping(value = "")
@ApiOperation("카테고리 전체 조회")
public ApiResponse<List<CategoryListResponseDto>> getList(@UserId Long userId) {
return ApiResponse.success(SuccessCode.GET_CATEGORT_LIST_SUCCESS, categoryService.getList(userId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ApiResponse create(@UserId Long userId, @ModelAttribute @Valid final Trav
}

@Auth
@ApiOperation("Travveller 수정 API")
@ApiOperation("Traveller 수정 API")
@PutMapping("traveller/{travellerId}")
@ResponseStatus(HttpStatus.OK)
public ApiResponse update(@UserId Long userId, @PathVariable Long travellerId, @ModelAttribute @Valid final TravellerRequestDto request) {
Expand Down Expand Up @@ -83,7 +83,7 @@ public ApiResponse<List<TravellersResponseDto>> getTravellers() {
}

@Auth
@ApiOperation("Travel 상세 조회 API")
@ApiOperation("게시물 상세 조회 API")
@GetMapping("{id}")
public ApiResponse<TravelResponseDto> getTravelById(@PathVariable("id") Long travelId, @UserId Long userId) {
final TravelResponseDto data = travelService.getTravelById(travelId, userId);
Expand All @@ -100,7 +100,7 @@ public ApiResponse deleteTravelById(@PathVariable("id") Long travelId) {
@Auth
@ApiOperation("공유 중인 Traveller 전체 조회 API")
@GetMapping("traveller/share/{pageOwnerUserId}")
public ApiResponse<?> getTravellers(@PathVariable Long pageOwnerUserId, @UserId Long userId) {
public ApiResponse<List<SharedTravelDetailDto>> getTravellers(@PathVariable Long pageOwnerUserId, @UserId Long userId) {
log.info("공유 중인 Travellser 전체 조회 API - pageOwnerUserId : " + pageOwnerUserId);
final List<SharedTravelDetailDto> travellers = travelService.getTravellersByProfileOwnerId(userId, pageOwnerUserId);
return ApiResponse.success(SuccessCode.READ_SHARED_TRAVELLERS_SUCCESS, travellers);
Expand All @@ -109,7 +109,7 @@ public ApiResponse<?> getTravellers(@PathVariable Long pageOwnerUserId, @UserId
@Auth
@ApiOperation("공유 중인 Traveller 카테고리별 조회 API")
@GetMapping("traveller/share/{pageOwnerUserId}/{categoryId}")
public ApiResponse<?> getTravellers(@PathVariable Long pageOwnerUserId, @PathVariable Long categoryId, @UserId Long userId) {
public ApiResponse<List<SharedTravelDetailDto>> getTravellers(@PathVariable Long pageOwnerUserId, @PathVariable Long categoryId, @UserId Long userId) {
// TODO: 이거 getRravellers 함수명 3곳에서 공유했는데 변경해주는게 좋겠지? 오버로딩으로 되길래 사용했는데...
log.info("공유 중인 Travellser 카테고리별 조회 API - pageOwnerUserId : " + pageOwnerUserId + " categoryId : " + categoryId + " userId : " + userId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public ApiResponse<NicknameResponseDto> updateNickname(@Valid @RequestParam Stri
@Auth
@PostMapping("/block/{userId}")
@ApiOperation("유저 차단")
public ApiResponse<?> blockUser(@UserId Long myId, @PathVariable Long userId) {
public ApiResponse blockUser(@UserId Long myId, @PathVariable Long userId) {
userService.blockUser(myId, userId);
return ApiResponse.success(SuccessCode.USER_BLOCK_SUCCESS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.deploy.Travalue.user.controller.dto.myTrip.request.MyTripRequestDto;
import com.deploy.Travalue.user.service.myTrip.MyTripService;
import com.deploy.Travalue.user.service.myTrip.dto.response.MyTripResponseDto;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
Expand All @@ -22,6 +23,7 @@ public class MyTripController {

@Auth
@PostMapping("")
@ApiOperation("여행지 리스트 추가")
@ResponseStatus(HttpStatus.CREATED)
public ApiResponse createMyTrip(@UserId Long userId, @RequestBody @Valid final MyTripRequestDto request) {
myTripService.createMyTrip(userId, request);
Expand Down

0 comments on commit 5dd7e63

Please sign in to comment.