-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] ๊ฒ์ํ API ๊ตฌํ
- Loading branch information
Showing
61 changed files
with
3,996 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/umc/networkingService/config/QueryDSLConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.umc.networkingService.config; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import jakarta.persistence.EntityManager; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class QueryDSLConfig { | ||
private final EntityManager entityManager; | ||
|
||
@Bean | ||
public JPAQueryFactory jpaQueryFactory() { | ||
return new JPAQueryFactory(entityManager); | ||
} | ||
} |
125 changes: 125 additions & 0 deletions
125
src/main/java/com/umc/networkingService/domain/board/controller/BoardCommentController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
package com.umc.networkingService.domain.board.controller; | ||
|
||
import com.umc.networkingService.config.security.auth.CurrentMember; | ||
import com.umc.networkingService.domain.board.dto.request.comment.BoardCommentAddRequest; | ||
import com.umc.networkingService.domain.board.dto.request.comment.BoardCommentUpdateRequest; | ||
import com.umc.networkingService.domain.board.dto.response.comment.BoardCommentIdResponse; | ||
import com.umc.networkingService.domain.board.dto.response.comment.BoardCommentPagingResponse; | ||
import com.umc.networkingService.domain.board.dto.response.member.MyBoardCommentPagingWebResponse; | ||
import com.umc.networkingService.domain.board.dto.response.member.MyBoardPagingResponse; | ||
import com.umc.networkingService.domain.board.entity.BoardType; | ||
import com.umc.networkingService.domain.board.entity.HostType; | ||
import com.umc.networkingService.domain.board.service.BoardCommentService; | ||
import com.umc.networkingService.domain.member.entity.Member; | ||
import com.umc.networkingService.global.common.base.BaseResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.Parameters; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Sort; | ||
import org.springframework.data.web.PageableDefault; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.UUID; | ||
|
||
@Tag(name = "๊ฒ์ํ ๋๊ธ API", description = "๊ฒ์ํ ๋๊ธ ๊ด๋ จ API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/boards/comments") | ||
public class BoardCommentController { | ||
|
||
private final BoardCommentService boardCommentService; | ||
|
||
@Operation(summary = "๋๊ธ ์์ฑ API", description = "๋๊ธ์ ์์ฑํ๋ API์ ๋๋ค.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "์ฑ๊ณต"), | ||
}) | ||
@PostMapping | ||
public BaseResponse<BoardCommentIdResponse> addBoardComment(@CurrentMember Member member, | ||
@Valid @RequestBody BoardCommentAddRequest request) { | ||
return BaseResponse.onSuccess(boardCommentService.addBoardComment(member, request)); | ||
} | ||
|
||
@Operation(summary = "๋๊ธ ์์ API", description = "๋๊ธ์ ์์ ํ๋ API์ ๋๋ค.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "์ฑ๊ณต"), | ||
@ApiResponse(responseCode = "COMMENT001", description = "๋๊ธ์ ์ฐพ์ ์ ์์ ๊ฒฝ์ฐ ๋ฐ์"), | ||
@ApiResponse(responseCode = "COMMENT002", description = "๋๊ธ ์์ ๊ถํ์ด ์์ ๊ฒฝ์ฐ ๋ฐ์"), | ||
|
||
}) | ||
@PatchMapping("/{commentId}") | ||
public BaseResponse<BoardCommentIdResponse> updateBoardComment(@CurrentMember Member member, | ||
@PathVariable(value = "commentId") UUID commentId, | ||
@Valid @RequestBody BoardCommentUpdateRequest request) { | ||
return BaseResponse.onSuccess(boardCommentService.updateBoardComment(member, commentId, request)); | ||
} | ||
|
||
|
||
@Operation(summary = "๋๊ธ ์ญ์ API", description = "๋๊ธ์ ์ญ์ ํ๋ API์ ๋๋ค.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "์ฑ๊ณต"), | ||
@ApiResponse(responseCode = "COMMENT001", description = "๋๊ธ์ ์ฐพ์ ์ ์์ ๊ฒฝ์ฐ ๋ฐ์"), | ||
@ApiResponse(responseCode = "COMMENT002", description = "๋๊ธ ์ญ์ ๊ถํ์ด ์์ ๊ฒฝ์ฐ ๋ฐ์") | ||
}) | ||
@DeleteMapping("/{commentId}") | ||
public BaseResponse<BoardCommentIdResponse> deleteBoardComment(@CurrentMember Member member, | ||
@PathVariable(value = "commentId") UUID commentId) { | ||
return BaseResponse.onSuccess(boardCommentService.deleteBoardComment(member, commentId)); | ||
} | ||
|
||
@Operation(summary = " ํน์ ๊ฒ์๊ธ ๋๊ธ ๋ชฉ๋ก ์กฐํ API", description = "ํน์ ๊ฒ์๊ธ์ ๋๊ธ ๋ชฉ๋ก์ ์กฐํํ๋ API์ ๋๋ค.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "์ฑ๊ณต"), | ||
@ApiResponse(responseCode = "BOARD002", description = "๊ฒ์๊ธ์ ์ฐพ์ ์ ์์ ๊ฒฝ์ฐ ๋ฐ์") | ||
}) | ||
@Parameters(value = { | ||
@Parameter(name = "page", description = " page ์์์ 0๋ฒ๋ถํฐ, ์ค๋ฆ์ฐจ์์ผ๋ก ์กฐํ๋ฉ๋๋ค.") | ||
}) | ||
@GetMapping(value = "/{boardId}") | ||
public BaseResponse<BoardCommentPagingResponse> showBoardComments(@CurrentMember Member member, | ||
@PathVariable(value = "boardId") UUID boardId, | ||
@PageableDefault(sort = "created_at", direction = Sort.Direction.ASC) | ||
@Parameter(hidden = true) Pageable pageable) { | ||
return BaseResponse.onSuccess(boardCommentService.showBoardComments(member, boardId, pageable)); | ||
} | ||
|
||
@Operation(summary = "[APP] ๋ด๊ฐ ๋๊ธ ์ด ๊ธ ์กฐํ/๊ฒ์ API", description = "APP์ฉ ๋ด๊ฐ ๋๊ธ ์ด ๊ธ์ ์กฐํ/๊ฒ์ํ๋ API์ ๋๋ค.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "์ฑ๊ณต"), | ||
}) | ||
@Parameters(value = { | ||
@Parameter(name = "keyword", description = "keyword๋ฅผ ์ฃผ์ง ์์ผ๋ฉด ๋ชจ๋ ๋ด๊ฐ ๋๊ธ ์ด ๊ธ์ด ์กฐํ๋ฉ๋๋ค. keyword๋ฅผ ์ฃผ๋ฉด ๊ฒ์์ด ๊ฐ๋ฅํฉ๋๋ค."), | ||
@Parameter(name = "page", description = "page ์์์ 0๋ฒ๋ถํฐ, ๋ด๋ฆผ์ฐจ์์ผ๋ก ์กฐํ๋ฉ๋๋ค.") | ||
}) | ||
@GetMapping(value = "/member/comments/app") | ||
public BaseResponse<MyBoardPagingResponse> showBoardsByMemberCommentsForApp(@CurrentMember Member member, | ||
@RequestParam(name = "keyword", required = false) String keyword, | ||
@PageableDefault(sort = "created_at", direction = Sort.Direction.DESC) | ||
@Parameter(hidden = true) Pageable pageable) { | ||
return BaseResponse.onSuccess(boardCommentService.showBoardsByMemberCommentForApp(member, keyword, pageable)); | ||
} | ||
|
||
@Operation(summary = "[WEB] ๋ด๊ฐ ๋๊ธ ์ด ๊ธ ์กฐํ/๊ฒ์ API", description = "WEB์ฉ ๋ด๊ฐ ๋๊ธ ์ด ๊ธ์ ์กฐํ/๊ฒ์ํ๋ API์ ๋๋ค. "+ | ||
"host: CENTER, BRANCH, CAMPUS ์ค ํ๋์ ๊ฐ์ ๋๋ฌธ์๋ก ์ฃผ์ธ์. " + | ||
"board: NOTICE, FREE, WORKBOOK, OB, QUESTION ์ค ํ๋์ ๊ฐ์ ๋๋ฌธ์๋ก ์ฃผ์ธ์.") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "์ฑ๊ณต"), | ||
}) | ||
@Parameters(value = { | ||
@Parameter(name = "keyword", description = "keyword๋ฅผ ์ฃผ์ง ์์ผ๋ฉด ๋ชจ๋ ๋ด๊ฐ ๋๊ธ ์ด ๊ธ์ด ์กฐํ๋ฉ๋๋ค. keyword๋ฅผ ์ฃผ๋ฉด ๊ฒ์์ด ๊ฐ๋ฅํฉ๋๋ค."), | ||
@Parameter(name = "page", description = "page ์์์ 0๋ฒ๋ถํฐ, ๋ด๋ฆผ์ฐจ์์ผ๋ก ์กฐํ๋ฉ๋๋ค.")}) | ||
@GetMapping(value = "/member/comments/web") | ||
public BaseResponse<MyBoardCommentPagingWebResponse> showBoardsByMemberCommentForWeb(@CurrentMember Member member, | ||
@RequestParam(name = "host") HostType hostType, | ||
@RequestParam(name = "board") BoardType boardType, | ||
@RequestParam(name = "keyword", required = false) String keyword, | ||
@PageableDefault(sort = "created_at", direction = Sort.Direction.DESC) | ||
@Parameter(hidden = true) Pageable pageable) { | ||
return BaseResponse.onSuccess(boardCommentService.showBoardsByMemberCommentForWeb(member, hostType, boardType,keyword, pageable)); | ||
} | ||
} |
Oops, something went wrong.