Skip to content

Commit

Permalink
#189 docs: 관심 목록 변경 및 조회 스웨거 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
chaerlo127 committed Nov 10, 2023
1 parent 1b704ec commit a21f69d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum class BaseResponseCode(status: HttpStatus, message: String) {
INVALID_USER_CATEGORY(HttpStatus.BAD_REQUEST, "올바르지 않은 사용자 카테고리입니다."),

// User - category
INVALID_USER_INTEREST_COUNT(HttpStatus.BAD_REQUEST, "사용자 관심 주제는 1개이상, 3개 이하여야하며, 중복된 값이 포함되어 있지 않아야 합니다"),
INVALID_USER_INTEREST_COUNT(HttpStatus.BAD_REQUEST, "사용자 관심 주제는 1개이상, 3개 이하여야하며, 중복된 값이 포함되어 있지 않아야 합니다."),

// CS - notices
NOT_FOUND_NOTICE(HttpStatus.NOT_FOUND, "해당 공지사항를 찾을 수 없습니다."),
Expand Down
15 changes: 15 additions & 0 deletions src/main/kotlin/com/psr/psr/user/controller/UserController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class UserController(
"사업자 정보를 입력해주세요.<br>" +
"관리자는 한 명만 가능합니다.<br>" +
"올바르지 않은 사용자 역할니다.<br>" +
"올바르지 않은 상품 카테고리입니다.<br>" +
"variable + 을(를) 입력해주세요.",
content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class)))
),
Expand Down Expand Up @@ -280,6 +281,16 @@ class UserController(
* 관심 목록 변경
*/
@Operation(summary = "관심 목록 변경 (장채은)", description = "관심 목록을 변경한다.")
@ApiResponses(
value = [
ApiResponse(responseCode = "200", description = "요청에 성공했습니다."),
ApiResponse(
responseCode = "400",
description = "사용자 관심 주제는 1개이상, 3개 이하여야하며, 중복된 값이 포함되어 있지 않아야 합니다<br>" +
"올바르지 않은 상품 카테고리입니다.<br>",
content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class)))
)]
)
@PatchMapping("/watchlist")
fun patchWatchLists(@AuthenticationPrincipal userAccount: UserAccount, @RequestBody @Validated userInterestListReq: UserInterestListDto) : BaseResponse<Any>{
userService.patchWatchLists(userAccount.getUser(), userInterestListReq)
Expand All @@ -290,6 +301,10 @@ class UserController(
* 관심 목록 조회
*/
@Operation(summary = "관심 목록 조회 (장채은)", description = "관심 목록을 조회한다.")
@ApiResponses(
value = [
ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")]
)
@GetMapping("/watchlist")
fun getWatchList(@AuthenticationPrincipal userAccount: UserAccount) : BaseResponse<UserInterestListDto>{
return BaseResponse(userService.getWatchList(userAccount.getUser()))
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/psr/psr/user/dto/UserInterestListDto.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.psr.psr.user.dto

import com.psr.psr.user.entity.UserInterest
import io.swagger.v3.oas.annotations.media.Schema

data class UserInterestListDto (
@Schema(type = "List", description = "관심 목록")
val interestList: List<UserInterestDto>?
){
companion object{
Expand Down

0 comments on commit a21f69d

Please sign in to comment.