Skip to content

Commit

Permalink
Feat: 각 API 파라미터 플래그 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yxhwxn committed Aug 11, 2024
1 parent 4e60a4f commit 08a02f6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public class CommentApi {
@Operation(summary = "크롤링된 전체 댓글 조회 API",
description = "주어진 이벤트 ID와 URL의 댓글을 페이지네이션하여 이벤트의 endDate 전에 작성된 댓글들만 조회합니다. 자세한 요청 및 응답 형식은 노션 API 문서를 참고해주세요.")
public ResponseEntity<ApiResponse<CommentResponseDTO.CrawledCommentListDTO>> getComments(
@RequestParam Long eventId,
@RequestParam String url,
@RequestParam("eventId") Long eventId,
@RequestParam("url") String url,
@Parameter(description = "조회할 페이지 번호 (1부터 시작)")
@RequestParam int page,
@RequestParam("page") int page,
@Parameter(description = "한 페이지당 댓글 수")
@RequestParam int size,
@RequestParam("size") int size,
@CurrentAccount Account account) {
CommentResponseDTO.CrawledCommentListDTO comments = commentService.getComments(eventId, url, page, size, account.userId());
return ResponseEntity.ok(ApiResponse.of(comments));
Expand All @@ -55,8 +55,8 @@ public ResponseEntity<ApiResponse<CommentResponseDTO.WinnerResponseDTO>> drawWin
@GetMapping("/winners/keywordFiltering")
@Operation(summary = "키워드별 당첨자 조회 API", description = "주어진 키워드에 따라 1차 랜덤 추첨된 당첨자 중에서 키워드가 포함된 당첨자들을 조회합니다.")
public ResponseEntity<ApiResponse<List<CommentResponseDTO.CommentDetailDTO>>> getWinnersByKeyword(
@RequestParam Long eventId,
@RequestParam String keyword,
@RequestParam("eventId") Long eventId,
@RequestParam("keyword") String keyword,
@CurrentAccount Account account) {
List<CommentResponseDTO.CommentDetailDTO> filteredWinners = commentService.getCommentsByKeyword(eventId, keyword, account.userId());
return ResponseEntity.ok(ApiResponse.of(filteredWinners));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ public class CrawlApi {
@Operation(summary = "크롤링 중복 검증 API",
description = "주어진 URL과 eventId로 중복된 댓글 수집 이력이 있는지 확인합니다.<br><br>" +
"Request<br>" +
"- url: 중복 검증할 URL<br>" +
"- eventId: 댓글 이벤트 생성 후 입력 받은 eventId<br><br>" +
"- url: 중복 검증할 URL<br><br>" +
"Response<br>" +
"- 요청된 URL과 중복된 댓글 수집 이력이 있을 경우 '검증 및 확인되었습니다.' 출력<br>" +
"- 요청된 URL과 중복된 댓글 수집 이력이 없을 경우 '수집 이력이 없습니다.' 출력")
public ResponseEntity<ApiResponse<String>> checkExistingComments(@RequestParam String url, @CurrentAccount Account account) {
public ResponseEntity<ApiResponse<String>> checkExistingComments(@RequestParam("url") String url, @CurrentAccount Account account) {
String message = crawlService.checkExistingComments(url, account.userId());
if (message != null) {
return ResponseEntity.ok(ApiResponse.of(ResponseCode.SUCCESS, message));
Expand All @@ -47,11 +46,12 @@ public ResponseEntity<ApiResponse<String>> checkExistingComments(@RequestParam S
description = "주어진 URL의 유튜브 댓글을 크롤링하여 해당 댓글 데이터를 DB에 저장합니다.<br><br>" +
"Request: url: 크롤링할 URL, eventId: 댓글을 수집할 eventId, forceUpdate: 댓글을 강제로 업데이트할지 여부(Boolean), Authorization: JWT 토큰을 포함한 인증 헤더 <br><br>" +
"<forceUpdate 입력 값이 true일 때> <br> " +
"- 동일한 URL에 대한 댓글 크롤링 요청이지만, 강제로 업데이트하겠다는 의미이기 때문에, 기존 댓글 데이터를 삭제하고 새로 등록합니다. <br><br>" +
"- 동일한 URL에 대한 댓글 크롤링 요청이지만 강제로 업데이트하겠다는 의미이기 때문에, 기존 댓글 데이터를 삭제하고 새로 등록합니다. <br><br>" +
"<forceUpdate 입력 값이 false일 때> <br> " +
"크롤링하려는 URL이 중복되지 않았을 때의 요청이기 때문에, 새로운 댓글을 크롤링합니다. <br>" +
"- DB에 기존 댓글이 존재하는 경우: 크롤링을 중지하고 예외를 던집니다. <br>" +
"- DB에 기존 댓글이 존재하지 않는 경우: 새로운 댓글을 크롤링하고 이를 DB에 저장합니다.")
public ResponseEntity<ApiResponse<String>> crawlYoutubeComments(@RequestParam String url, @RequestParam Long eventId, @RequestParam boolean forceUpdate, @CurrentAccount Account account) {
public ResponseEntity<ApiResponse<String>> crawlYoutubeComments(@RequestParam("url") String url, @RequestParam("eventId") Long eventId, @RequestParam("forceUpdate") boolean forceUpdate, @CurrentAccount Account account) {
crawlService.crawlYoutubeComments(url, eventId, account.userId(), forceUpdate);
return ResponseEntity.ok(ApiResponse.of(ResponseCode.SUCCESS, "댓글 수집이 완료되었습니다."));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public ResponseEntity<ApiResponse<Void>> updateEvent(@PathVariable Long eventId,

@DeleteMapping("/{eventId}")
@Operation(summary = "이벤트 삭제 API", description = "PathVariable: eventId, JWT 토큰만 주시면 됩니다.")
public ResponseEntity<ApiResponse<Void>> deleteEvent(@PathVariable Long eventId, @CurrentAccount Account account) {
public ResponseEntity<ApiResponse<Void>> deleteEvent(@PathVariable("eventId") Long eventId, @CurrentAccount Account account) {
eventService.deleteEvent(eventId, account.userId());
return ResponseEntity.ok(ApiResponse.of(ResponseCode.SUCCESS));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ResponseEntity<ApiResponse<SurveyResponseDTO.SurveyCreateResponse>> creat

@GetMapping("/{surveyId}")
@Operation(summary = "설문지 조회 API", description = "생성된 설문지 전체 정보를 조회합니다. 자세한 요청 및 응답 형식은 노션 API 문서를 참고해주세요.")
public ResponseEntity<ApiResponse<SurveyResponseDTO.SurveyResultDTO>> getSurvey(@PathVariable Long surveyId) {
public ResponseEntity<ApiResponse<SurveyResponseDTO.SurveyResultDTO>> getSurvey(@PathVariable("surveyId") Long surveyId) {
SurveyResponseDTO.SurveyResultDTO response = surveyService.getSurvey(surveyId);
return ResponseEntity.ok(ApiResponse.of(response));
}
Expand All @@ -51,12 +51,12 @@ public ResponseEntity<ApiResponse<Void>> saveSurveyAnswers(@RequestBody @Valid S
@GetMapping("/{surveyId}/answers/{questionId}")
@Operation(summary = "질문별 설문 응답 결과 조회 API", description = "특정 질문에 따라 해당 질문에 대한 설문 결과를 응답합니다. 자세한 요청 및 응답 형식은 노션 API 문서를 참고해주세요.")
public ResponseEntity<ApiResponse<SurveyResponseDTO.SurveyAnswerResultDTO>> getSurveyAnswers(
@PathVariable Long surveyId,
@PathVariable Long questionId,
@PathVariable("surveyId") Long surveyId,
@PathVariable("questionId") Long questionId,
@Parameter(description = "페이지 번호(1부터 시작)", example = "1")
@RequestParam int page,
@RequestParam("page") int page,
@Parameter(description = "페이지 크기", example = "10")
@RequestParam int size,
@RequestParam("size") int size,
@CurrentAccount Account account) {
SurveyResponseDTO.SurveyAnswerResultDTO response = surveyService.getSurveyAnswers(surveyId, questionId, page, size, account.userId());
return ResponseEntity.ok(ApiResponse.of(response));
Expand All @@ -75,14 +75,14 @@ public ResponseEntity<ApiResponse<SurveyResponseDTO.RandomSelectionResponseDTO>>
@GetMapping("/winners/{surveyId}/{participantId}")
@Operation(summary = "당첨자 세부 정보 조회 API", description = "설문 이벤트의 당첨자(익명 참여자) 정보를 조회하며, 해당 참여자가 응답한 모든 설문 내용을 반환합니다. 자세한 요청 및 응답 형식은 노션 API 문서를 참고해주세요.")
public ResponseEntity<ApiResponse<SurveyResponseDTO.WinnerDetailDTO>> getWinnerDetails(
@PathVariable Long surveyId, @PathVariable Long participantId) {
@PathVariable("surveyId") Long surveyId, @PathVariable("participantId") Long participantId) {
SurveyResponseDTO.WinnerDetailDTO winnerDetails = surveyService.getWinnerDetails(surveyId, participantId);
return ResponseEntity.ok(ApiResponse.of(winnerDetails));
}

@DeleteMapping("/winners")
@Operation(summary = "당첨자 리스트 삭제 API(당첨자 재추첨 시, 기존 당첨자 리스트를 삭제 후 진행 해야합니다.)", description = "해당 설문조사의 모든 당첨자들의 isWinner 값을 false로 변경합니다.")
public ResponseEntity<ApiResponse<Void>> deleteWinners(@RequestParam Long surveyId) {
public ResponseEntity<ApiResponse<Void>> deleteWinners(@RequestParam("surveyId") Long surveyId) {
surveyService.deleteWinners(surveyId);
return ResponseEntity.ok(ApiResponse.of(ResponseCode.SUCCESS));
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/cmc/suppin/member/controller/MemberApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public ResponseEntity<ApiResponse<Void>> verifyEmailCode(@RequestBody @Valid Mem
@GetMapping("/checkUserId")
@Operation(summary = "아이디 중복 체크 API", description = "입력한 아이디가 중복된 id인지 검증합니다. 자세한 요청 및 응답 형식은 노션 API 문서를 참고하시면 됩니다.")
@io.swagger.v3.oas.annotations.responses.ApiResponse(description = "중복이면 false, 중복 아니면 true")
public ResponseEntity<ApiResponse<MemberResponseDTO.IdConfirmResultDTO>> checkUserId(@RequestParam String userId) {
public ResponseEntity<ApiResponse<MemberResponseDTO.IdConfirmResultDTO>> checkUserId(@RequestParam("userId") String userId) {
boolean checkUserId = memberService.confirmUserId(userId);

return ResponseEntity.ok(ApiResponse.confirm(MemberConverter.toIdConfirmResultDTO(checkUserId)));
Expand All @@ -67,7 +67,7 @@ public ResponseEntity<ApiResponse<MemberResponseDTO.IdConfirmResultDTO>> checkUs
// 이메일 중복 체크
@GetMapping("/checkEmail")
@Operation(summary = "이메일 중복 체크 API", description = "입력한 이메일이 중복된 이메일인지 검증합니다. 자세한 요청 및 응답 형식은 노션 API 문서를 참고하시면 됩니다.")
public ResponseEntity<ApiResponse<MemberResponseDTO.EmailConfirmResultDTO>> checkEmail(@RequestParam String email) {
public ResponseEntity<ApiResponse<MemberResponseDTO.EmailConfirmResultDTO>> checkEmail(@RequestParam("email") String email) {
boolean checkEmail = memberService.confirmEmail(email);

return ResponseEntity.ok(ApiResponse.confirm(MemberConverter.toEmailConfirmResultDTO(checkEmail)));
Expand Down Expand Up @@ -111,7 +111,7 @@ public ResponseEntity<ApiResponse<Void>> updatePassword(@RequestBody @Valid Memb
// 현재 비밀번호 확인
@GetMapping("/password/check")
@Operation(summary = "현재 비밀번호 확인 API", description = "request : password")
public ResponseEntity<ApiResponse<MemberResponseDTO.CheckPasswordDTO>> checkPassword(@RequestParam String password, @CurrentAccount Account account) {
public ResponseEntity<ApiResponse<MemberResponseDTO.CheckPasswordDTO>> checkPassword(@RequestParam("password") String password, @CurrentAccount Account account) {
memberService.checkPassword(password, account.id());
return ResponseEntity.ok(ApiResponse.confirm(ResponseCode.CONFIRM));
}
Expand Down

0 comments on commit 08a02f6

Please sign in to comment.