Skip to content

Commit

Permalink
📝 docs: swagger 명세 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
strongmhk committed Jul 4, 2024
1 parent 494bce3 commit c891737
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/umc/dream/controller/DreamController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import com.umc.dream.domain.Follow;
import com.umc.dream.dto.*;
import com.umc.dream.service.DreamService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

Expand All @@ -19,13 +22,21 @@ public class DreamController {
private DreamService dreamService;

@PostMapping("/diary")
@Operation(summary = "꿈 일기 생성 API", description = "꿈 일기 생성 API입니다")
@Parameters({
@Parameter(name = "dreamRequestDto", description = "상세 필드는 노션 API 명세를 참고!"),
})
public ApiResponse<AddDreamResponseDto> createDream(@RequestBody DreamRequestDto dreamRequestDto) {
Dream dream = dreamService.createDream(dreamRequestDto);
AddDreamResponseDto addDreamResponseDto = DreamConverter.toAddDreamResponse(dream);
return ApiResponse.onSuccess(addDreamResponseDto);
}

@GetMapping("/diary/{user_id}")
@Operation(summary = "내 꿈 일기 목록 API", description = "내 꿈 일기 목록 조회 API입니다")
@Parameters({
@Parameter(name = "user_id", description = "꿈 일기 목록을 조회하고자하는 사용자의 pk"),
})
private ApiResponse<List<GetDreamResponseDto>> GetDream(@RequestParam Long user_id) {
List<GetDreamResponseDto> getDreamResponseDtos = dreamService.getDream(user_id);
return ApiResponse.onSuccess(getDreamResponseDtos);
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/umc/dream/controller/FollowController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import com.umc.dream.dto.FollowResponseDto;
import com.umc.dream.dto.ViewFollowResponseDto;
import com.umc.dream.service.FollowService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

Expand All @@ -19,19 +22,31 @@ public class FollowController {
private final FollowService followService;

@PostMapping("/user/follow")
@Operation(summary = "친구 추가(팔로우) API", description = "친구 추가 API입니다")
@Parameters({
@Parameter(name = "followRequestDto", description = "followerId(팔로우 하는 사람의 pk)와 acceptorId(팔로우 당하는 사람의 pk)를 담고있는 DTO 객체"),
})
public ApiResponse<FollowResponseDto> follow(@RequestBody FollowRequestDto followRequestDto) {
Follow f = followService.follow(followRequestDto);
FollowResponseDto followResponseDto = FollowConverter.toFollowResponse(f);
return ApiResponse.onSuccess(followResponseDto);
}

@DeleteMapping("/user/followCancel")
@Operation(summary = "친구 삭제(팔로우 취소) API", description = "친구 삭제 API입니다")
@Parameters({
@Parameter(name = "followRequestDto", description = "followerId(팔로우 하는 사람의 pk)와 acceptorId(팔로우 당하는 사람의 pk)를 담고있는 DTO 객체"),
})
public ApiResponse<?> followCancel(@RequestBody FollowRequestDto followRequestDto) {
followService.followCancel(followRequestDto);
return ApiResponse.onSuccess("팔로우 취소됨");
}

@GetMapping("/user/{user_id}/following")
@Operation(summary = "친구 목록 조회 API", description = "친구 목록 조회 API입니다")
@Parameters({
@Parameter(name = "user_id", description = "친구 목록을 조회하고자하는 사용자의 pk"),
})
public ApiResponse<List<ViewFollowResponseDto>> viewFollowings(@PathVariable Long user_id) {
List<ViewFollowResponseDto> viewFollowResponseDtos = followService.viewFollowings(user_id);
return ApiResponse.onSuccess(viewFollowResponseDtos);
Expand Down

0 comments on commit c891737

Please sign in to comment.