From 00d23f4a81f28a1506cb6521c7da4cc42d0bf923 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 14:37:17 +0900 Subject: [PATCH 01/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EC=A1=B0=ED=9A=8C=20=EC=8A=A4=EC=9B=A8?= =?UTF-8?q?=EA=B1=B0=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/controller/ProductController.kt | 22 +++++++++++++++++-- .../product/dto/response/GetProductsRes.kt | 3 +++ .../dto/response/PopularProductDetail.kt | 9 ++++++++ .../psr/product/dto/response/ProductDetail.kt | 8 +++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 06c3e05..2718622 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -8,9 +8,16 @@ import com.psr.psr.product.dto.request.CreateproductReq import com.psr.psr.product.dto.request.ReportProductReq import com.psr.psr.product.dto.response.* import com.psr.psr.product.service.ProductService +import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.Parameter +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import io.swagger.v3.oas.annotations.responses.ApiResponses import io.swagger.v3.oas.annotations.security.SecurityRequirement import io.swagger.v3.oas.annotations.tags.Tag import jakarta.validation.Valid +import org.springdoc.core.annotations.ParameterObject import org.springframework.data.domain.Pageable import org.springframework.data.web.PageableDefault import org.springframework.security.core.annotation.AuthenticationPrincipal @@ -28,10 +35,21 @@ class ProductController( /** * 상품 메인 조회 */ + @Operation(summary = "상품 메인 조회(박소정)", description = "상품 메인 목록을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "올바르지 않은 사용자 카테고리입니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @GetMapping() fun getProducts(@AuthenticationPrincipal userAccount: UserAccount, - @RequestParam(required = false) category: String, - @PageableDefault(size = 8) pageable: Pageable): BaseResponse { + @Parameter(description = "(String) 카테고리(null = 관심목록)
" + + "방송가능 상품소싱
쇼호스트 구인
라이브커머스 대행
라이브커머스 교육
스마트스토어 런칭
영상편집
강사매칭
SNS 마케팅
홍보물 디자인",) @RequestParam(required = false) category: String, + @ParameterObject @PageableDefault(size = 8) pageable: Pageable): BaseResponse { return BaseResponse(productService.getProducts(userAccount.getUser(), category, pageable)); } diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsRes.kt b/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsRes.kt index f7cdb15..9b60235 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsRes.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsRes.kt @@ -1,8 +1,11 @@ package com.psr.psr.product.dto.response +import io.swagger.v3.oas.annotations.media.Schema import org.springframework.data.domain.Page data class GetProductsRes( + @Schema(description = "인기 목록") val popularList: List, + @Schema(description = "일반 목록") val productList: Page ) diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/PopularProductDetail.kt b/src/main/kotlin/com/psr/psr/product/dto/response/PopularProductDetail.kt index 4a3908d..907dd72 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/PopularProductDetail.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/PopularProductDetail.kt @@ -1,15 +1,24 @@ package com.psr.psr.product.dto.response import com.querydsl.core.annotations.QueryProjection +import io.swagger.v3.oas.annotations.media.Schema data class PopularProductDetail @QueryProjection constructor( + @Schema(description = "상품 id", example = "1") val productId: Long, + @Schema(description = "상품 이미지", example = "url") val imgUrl: String?, + @Schema(description = "상품 이름", example = "폴로 목도리") val name: String, + @Schema(description = "상품 가격", example = "35000") val price: Int, + @Schema(description = "상품 좋아요 수", example = "10") val numOfLike: Int, + @Schema(description = "상품 좋아요 유무", example = "true") val isLike: Boolean, + @Schema(description = "평균 별점", example = "4.5") val avgOfRating: Double, + @Schema(description = "리뷰 수", example = "5") val numOfReview: Int ) diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/ProductDetail.kt b/src/main/kotlin/com/psr/psr/product/dto/response/ProductDetail.kt index b954f57..460328b 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/ProductDetail.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/ProductDetail.kt @@ -1,13 +1,21 @@ package com.psr.psr.product.dto.response import com.querydsl.core.annotations.QueryProjection +import io.swagger.v3.oas.annotations.media.Schema data class ProductDetail @QueryProjection constructor( + @Schema(description = "상품 id", example = "1") val productId: Long, + @Schema(description = "상품 이미지", example = "url") val imgUrl: String?, + @Schema(description = "판매자 id", example = "2") val userId: Long, + @Schema(description = "판매자 닉네임", example = "소징") val nickname: String, + @Schema(description = "상품 이름", example = "초코나무숲") val name: String, + @Schema(description = "상품 가격", example = "35000") val price: Int, + @Schema(description = "상품 좋아요 유무", example = "true") val isLike: Boolean ) From 0c86ac9b1ec9eb65acd32d1a4abf6abfbf465aa9 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:03:05 +0900 Subject: [PATCH 02/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20-=20=EC=83=81?= =?UTF-8?q?=ED=92=88=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/psr/product/controller/ProductController.kt | 12 +++++++++++- .../psr/product/dto/response/GetProductDetailRes.kt | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 2718622..9ff63bd 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -56,9 +56,19 @@ class ProductController( /** * 상품 상세 조회 - 상품 */ + @Operation(summary = "상품 상세 조회 - 상품(박소정)", description = "상품 상세 조회의 상품을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "404", + description = "해당 상품을 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @GetMapping("/{productId}") fun getProductDetail(@AuthenticationPrincipal userAccount: UserAccount, - @PathVariable productId: Long): BaseResponse { + @Parameter(description = "(Long) 상품 id", example = "1") @PathVariable productId: Long): BaseResponse { return BaseResponse(productService.getProductDetail(userAccount.getUser(), productId)); } diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/GetProductDetailRes.kt b/src/main/kotlin/com/psr/psr/product/dto/response/GetProductDetailRes.kt index e4746b2..fa817f5 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/GetProductDetailRes.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/GetProductDetailRes.kt @@ -2,17 +2,28 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product import com.psr.psr.product.entity.ProductImg +import io.swagger.v3.oas.annotations.media.Schema data class GetProductDetailRes( + @Schema(description = "상품 좋아요 유무", example = "true") val isOwner: Boolean, + @Schema(description = "상품 카테고리", example = "방송가능 상품소싱", allowableValues = ["방송가능 상품소싱", "쇼호스트 구인", "라이브커머스 대행", "라이브커머스 교육", "스마트스토어 런칭", "영상편집", "강사매칭", "SNS 마케팅", "홍보물 디자인"]) val category: String, + @Schema(description = "상품 이미지 리스트", example = "{'url','url'}") val imgList: List, + @Schema(description = "판매자 id", example = "2") val userId: Long?, + @Schema(description = "판매자 닉네임", example = "소징") val nickname: String, + @Schema(description = "상품 좋아요 수", example = "10") val numOfLikes: Int, + @Schema(description = "상품 이름", example = "폴로 목도리") val name: String, + @Schema(description = "상품 가격", example = "35000") val price: Int, + @Schema(description = "상품 설명", example = "방송 가능 상품입니다.") val description: String, + @Schema(description = "좋아요 유무", example = "true") val isLike: Boolean ) { companion object { From 94e7a29ef997df2c9facd139c2434488bbd4233e Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:07:00 +0900 Subject: [PATCH 03/15] =?UTF-8?q?#190=20docs:=20=EB=A7=88=EC=9D=B4=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20?= =?UTF-8?q?=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/psr/psr/product/controller/ProductController.kt | 7 ++++++- .../com/psr/psr/product/dto/response/GetMyProductsRes.kt | 2 ++ .../kotlin/com/psr/psr/product/dto/response/MyProduct.kt | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 9ff63bd..09a3b11 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -75,9 +75,14 @@ class ProductController( /** * 마이 게시글 */ + @Operation(summary = "마이 게시글(박소정)", description = "나의 게시글을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/myproducts") fun getMyProducts(@AuthenticationPrincipal userAccount: UserAccount, - @PageableDefault(size = 10) pageable: Pageable): BaseResponse { + @ParameterObject @PageableDefault(size = 10) pageable: Pageable): BaseResponse { return BaseResponse(productService.getMyProducts(userAccount.getUser(), pageable)); } diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/GetMyProductsRes.kt b/src/main/kotlin/com/psr/psr/product/dto/response/GetMyProductsRes.kt index dc1fc41..27cad71 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/GetMyProductsRes.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/GetMyProductsRes.kt @@ -1,9 +1,11 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product +import io.swagger.v3.oas.annotations.media.Schema import org.springframework.data.domain.Page data class GetMyProductsRes( + @Schema(description = "상품 리스트") val productList: Page? ) { companion object { diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/MyProduct.kt b/src/main/kotlin/com/psr/psr/product/dto/response/MyProduct.kt index 599a04f..ae61784 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/MyProduct.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/MyProduct.kt @@ -1,12 +1,18 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product +import io.swagger.v3.oas.annotations.media.Schema data class MyProduct( + @Schema(description = "상품 id", example = "1") val productId: Long, + @Schema(description = "상품 이미지", example = "url") val imgUrl: String?, + @Schema(description = "상품 카테고리", example = "방송가능 상품소싱", allowableValues = ["방송가능 상품소싱", "쇼호스트 구인", "라이브커머스 대행", "라이브커머스 교육", "스마트스토어 런칭", "영상편집", "강사매칭", "SNS 마케팅", "홍보물 디자인"]) val category: String, + @Schema(description = "상품 이름", example = "폴로 목도리") val name: String, + @Schema(description = "상품 가격", example = "35000") val price: Int ) { companion object { From b410c3379bb340d55525b2929c1b560bab8b6806 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:10:51 +0900 Subject: [PATCH 04/15] =?UTF-8?q?#190=20docs:=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EC=83=81=ED=92=88=20=EB=AA=A9=EB=A1=9D=20=EC=8A=A4=EC=9B=A8?= =?UTF-8?q?=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/product/controller/ProductController.kt | 14 ++++++++++++-- .../product/dto/response/GetProductsByUserRes.kt | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 09a3b11..f0e5961 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -89,9 +89,19 @@ class ProductController( /** * 유저 상품 목록 */ + @Operation(summary = "유저 상품 목록(박소정)", description = "유저의 상품 목록을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "404", + description = "사용자를 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @GetMapping("/users/{userId}") - fun getProductsByUser(@PathVariable userId: Long, - @PageableDefault(size = 10) pageable: Pageable): BaseResponse { + fun getProductsByUser(@Parameter(description = "(Long) 유저 id", example = "1") @PathVariable userId: Long, + @ParameterObject @PageableDefault(size = 10) pageable: Pageable): BaseResponse { return BaseResponse(productService.getProductsByUser(userId, pageable)) } diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsByUserRes.kt b/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsByUserRes.kt index 681ac5a..8a2cefa 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsByUserRes.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/GetProductsByUserRes.kt @@ -2,12 +2,17 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product import com.psr.psr.user.entity.User +import io.swagger.v3.oas.annotations.media.Schema import org.springframework.data.domain.Page data class GetProductsByUserRes( + @Schema(description = "유저 프로필 이미지", example = "url") val imgUrl: String?, + @Schema(description = "유저 종류", example = "일반", allowableValues = ["일반", "사업자", "쇼호스트", "관리자"]) val type: String, + @Schema(description = "유저 닉네임", example = "소징") val nickname: String, + @Schema(description = "상품 리스트") val productList: Page? ) { companion object { From 56219f95d1746626650af24b74df6587c6deb751 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:12:40 +0900 Subject: [PATCH 05/15] =?UTF-8?q?#190=20docs:=20=EC=B0=9C=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/psr/psr/product/controller/ProductController.kt | 7 ++++++- .../com/psr/psr/product/dto/response/GetLikeProductsRes.kt | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index f0e5961..a843675 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -108,9 +108,14 @@ class ProductController( /** * 찜 목록 */ + @Operation(summary = "찜 목록(박소정)", description = "찜 목록을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/likes") fun getLikeProducts(@AuthenticationPrincipal userAccount: UserAccount, - @PageableDefault(size = 10) pageable: Pageable): BaseResponse { + @ParameterObject @PageableDefault(size = 10) pageable: Pageable): BaseResponse { return BaseResponse(productService.getLikeProducts(userAccount.getUser(), pageable)) } diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/GetLikeProductsRes.kt b/src/main/kotlin/com/psr/psr/product/dto/response/GetLikeProductsRes.kt index 0481387..cac2efa 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/GetLikeProductsRes.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/GetLikeProductsRes.kt @@ -1,9 +1,11 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product +import io.swagger.v3.oas.annotations.media.Schema import org.springframework.data.domain.Page data class GetLikeProductsRes( + @Schema(description = "상품 리스트") val productList: Page? ) { companion object { From 0731538ab79188be16a2d5f00fe071a2aa6c4154 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:15:33 +0900 Subject: [PATCH 06/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=8B=A0=EA=B3=A0=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/controller/ProductController.kt | 22 ++++++++++++++++++- .../product/dto/request/ReportProductReq.kt | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index a843675..976e2a6 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -122,9 +122,29 @@ class ProductController( /** * 상품 신고 */ + @Operation(summary = "상품 신고(박소정)", description = "상품을 신고한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "올바르지 않은 신고 카테고리입니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ), + ApiResponse( + responseCode = "404", + description = "해당 상품을 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ), + ApiResponse( + responseCode = "409", + description = "이미 신고 완료되었습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/{productId}/report") fun reportProduct(@AuthenticationPrincipal userAccount: UserAccount, - @PathVariable productId: Long, + @Parameter(description = "(Long) 상품 id", example = "1") @PathVariable productId: Long, @RequestBody @Valid request: ReportProductReq): BaseResponse { val category = ReportCategory.findByValue(request.category) return BaseResponse(productService.reportProduct(userAccount.getUser(), productId, category)) diff --git a/src/main/kotlin/com/psr/psr/product/dto/request/ReportProductReq.kt b/src/main/kotlin/com/psr/psr/product/dto/request/ReportProductReq.kt index 7b30cdc..63042c3 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/request/ReportProductReq.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/request/ReportProductReq.kt @@ -2,9 +2,11 @@ package com.psr.psr.product.dto.request import com.psr.psr.global.entity.ReportCategory import com.psr.psr.global.resolver.EnumValid +import io.swagger.v3.oas.annotations.media.Schema data class ReportProductReq( + @Schema(description = "상품 카테고리", example = "방송가능 상품소싱", allowableValues = ["방송가능 상품소싱", "쇼호스트 구인", "라이브커머스 대행", "라이브커머스 교육", "스마트스토어 런칭", "영상편집", "강사매칭", "SNS 마케팅", "홍보물 디자인"]) @EnumValid(enumClass = ReportCategory::class, message = "올바르지 않은 신고 카테고리입니다.") val category: String From 89caf2f8ec458066093f2045bb5ece21478e4afd Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:18:36 +0900 Subject: [PATCH 07/15] =?UTF-8?q?#190=20docs:=20=ED=99=88=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EC=A1=B0=ED=9A=8C=20-=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/psr/psr/product/controller/ProductController.kt | 5 +++++ .../com/psr/psr/product/dto/response/GetHomePageRes.kt | 4 ++++ .../kotlin/com/psr/psr/product/dto/response/MainProduct.kt | 4 ++++ .../com/psr/psr/product/dto/response/MainTopProduct.kt | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 976e2a6..1648207 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -153,6 +153,11 @@ class ProductController( /** * 홈 화면 조회 - 상품 */ + @Operation(summary = "홈 화면 조회 - 상품(박소정)", description = "홈 화면 - 상품을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/home") fun getHomePage(): BaseResponse { return BaseResponse(productService.getHomePage()) diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/GetHomePageRes.kt b/src/main/kotlin/com/psr/psr/product/dto/response/GetHomePageRes.kt index e64aa17..ff6258c 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/GetHomePageRes.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/GetHomePageRes.kt @@ -1,10 +1,14 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product +import io.swagger.v3.oas.annotations.media.Schema data class GetHomePageRes( + @Schema(description = "관심있는 패키지") val mainTopProductList: List?, + @Schema(description = "최신글 둘러보기") val recentProductList: List?, + @Schema(description = "인기 게시글") val popularProductList: List? ) { companion object { diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/MainProduct.kt b/src/main/kotlin/com/psr/psr/product/dto/response/MainProduct.kt index a186e2b..337fee5 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/MainProduct.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/MainProduct.kt @@ -1,10 +1,14 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product +import io.swagger.v3.oas.annotations.media.Schema data class MainProduct( + @Schema(description = "상품 id", example = "1") val id: Long, + @Schema(description = "상품 이미지", example = "url") val imgUrl: String?, + @Schema(description = "상품 이름", example = "초코나무숲") val name: String ) { companion object { diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/MainTopProduct.kt b/src/main/kotlin/com/psr/psr/product/dto/response/MainTopProduct.kt index c8accb3..d890760 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/MainTopProduct.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/MainTopProduct.kt @@ -1,11 +1,16 @@ package com.psr.psr.product.dto.response import com.psr.psr.product.entity.Product +import io.swagger.v3.oas.annotations.media.Schema data class MainTopProduct( + @Schema(description = "상품 id", example = "1") val id: Long, + @Schema(description = "상품 카테고리", example = "방송가능 상품소싱", allowableValues = ["방송가능 상품소싱", "쇼호스트 구인", "라이브커머스 대행", "라이브커머스 교육", "스마트스토어 런칭", "영상편집", "강사매칭", "SNS 마케팅", "홍보물 디자인"]) val category: String, + @Schema(description = "상품 이름", example = "폴로 목도리") val name: String, + @Schema(description = "상품 설명", example = "방송 가능 상품입니다.") val description: String ) { companion object { From 8e576831b00909d7476a7f4d778eb28822550c9b Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:22:49 +0900 Subject: [PATCH 08/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/psr/product/controller/ProductController.kt | 10 ++++++++++ .../psr/psr/product/dto/request/CreateproductReq.kt | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 1648207..33860c0 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -167,6 +167,16 @@ class ProductController( /** * 상품 등록 */ + @Operation(summary = "상품 등록(박소정)", description = "상품을 등록한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "상품 카테고리을 선택해주세요.
상품명을 입력해주세요.
상품 가격은 양수이어야 합니다.
상품 설명을 입력해주세요.
imgUrl은 null 또는 1~5개이어야 합니다.
올바르지 않은 상품 카테고리입니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("") fun createProduct(@AuthenticationPrincipal userAccount: UserAccount, @RequestBody @Valid request: CreateproductReq): BaseResponse { diff --git a/src/main/kotlin/com/psr/psr/product/dto/request/CreateproductReq.kt b/src/main/kotlin/com/psr/psr/product/dto/request/CreateproductReq.kt index 496fda3..660f662 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/request/CreateproductReq.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/request/CreateproductReq.kt @@ -2,25 +2,31 @@ package com.psr.psr.product.dto.request import com.psr.psr.global.resolver.EnumValid import com.psr.psr.user.entity.Category +import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.PositiveOrZero import jakarta.validation.constraints.Size data class CreateproductReq( + @Schema(description = "상품 카테고리", example = "방송가능 상품소싱", allowableValues = ["방송가능 상품소싱", "쇼호스트 구인", "라이브커머스 대행", "라이브커머스 교육", "스마트스토어 런칭", "영상편집", "강사매칭", "SNS 마케팅", "홍보물 디자인"]) @field:NotBlank(message = "상품 카테고리을 선택해주세요.") @EnumValid(enumClass = Category::class, message = "올바르지 않은 상품 카테고리입니다.") val category: String, + @Schema(description = "상품 이름", example = "폴로 목도리") @field:NotBlank(message = "상품명을 입력해주세요.") val name: String, + @Schema(description = "상품 가격", example = "35000") @field:PositiveOrZero(message = "상품 가격은 양수이어야 합니다.") val price: Int, + @Schema(description = "상품 설명", example = "방송 가능 상품입니다.") @field:NotBlank(message = "상품 설명을 입력해주세요.") val description: String, + @Schema(description = "상품 이미지 리스트", example = "{'url','url'}") @field:Size(min = 1, max = 5, message = "imgUrl은 null 또는 1~5개이어야 합니다.") val imgList: List? ) From f8be91a27335b4b65a2c6f342dc5b0c5f39fd3fd Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:23:58 +0900 Subject: [PATCH 09/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=B0=9C=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/psr/product/controller/ProductController.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 33860c0..58088e2 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -186,6 +186,16 @@ class ProductController( /** * 상품 찜 */ + @Operation(summary = "상품 찜(박소정)", description = "상품을 찜한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "404", + description = "해당 상품을 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/{productId}/likes") fun likeProduct(@AuthenticationPrincipal userAccount: UserAccount, @PathVariable productId: Long): BaseResponse { From cad4aa14b218442f2a912a0f2d4179e06ff00f85 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:25:24 +0900 Subject: [PATCH 10/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/product/controller/ProductController.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 58088e2..c9d49a3 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -205,6 +205,21 @@ class ProductController( /** * 상품 삭제 */ + @Operation(summary = "상품 삭제(박소정)", description = "상품을 삭제한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "해당 상품을 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ), + ApiResponse( + responseCode = "404", + description = "해당 글 작성자가 아닙니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @DeleteMapping("/{productId}") fun deleteProduct(@AuthenticationPrincipal userAccount: UserAccount, @PathVariable productId: Long): BaseResponse { From d4dea9740785b1229c7985028a12aadf8a38b0c5 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:26:37 +0900 Subject: [PATCH 11/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=B0=9C=EA=B3=BC=20=EC=83=81=ED=92=88=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?pathvariable=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/psr/psr/product/controller/ProductController.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index c9d49a3..a037a42 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -198,7 +198,7 @@ class ProductController( ) @PostMapping("/{productId}/likes") fun likeProduct(@AuthenticationPrincipal userAccount: UserAccount, - @PathVariable productId: Long): BaseResponse { + @Parameter(description = "(Long) 상품 id", example = "1") @PathVariable productId: Long): BaseResponse { return BaseResponse(productService.likeProduct(userAccount.getUser(), productId)) } @@ -222,7 +222,7 @@ class ProductController( ) @DeleteMapping("/{productId}") fun deleteProduct(@AuthenticationPrincipal userAccount: UserAccount, - @PathVariable productId: Long): BaseResponse { + @Parameter(description = "(Long) 상품 id", example = "1") @PathVariable productId: Long): BaseResponse { return BaseResponse(productService.deleteProduct(userAccount.getUser(), productId)) } From 94a5e6e52a482934d2e69a42c8473d24ebd2a9b6 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:30:01 +0900 Subject: [PATCH 12/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/psr/product/controller/ProductController.kt | 11 ++++++++--- .../psr/psr/product/dto/response/GetSearchProducts.kt | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index a037a42..104d9f0 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -229,11 +229,16 @@ class ProductController( /** * 상품 검색 */ + @Operation(summary = "상품 검색(박소정)", description = "상품을 검색한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/search") fun searchProducts(@AuthenticationPrincipal userAccount: UserAccount, - @RequestParam(required = true) keyword: String, - @RequestParam(required = false, defaultValue = RECENT) sortType: String, - @PageableDefault(size = 10) pageable: Pageable): BaseResponse { + @Parameter(description = "(Long) 검색어", example = "목도리") @RequestParam(required = true) keyword: String, + @Parameter(description = "(Long) 상품 정렬 (최신순
인기순)", example = "최신순") @RequestParam(required = false, defaultValue = RECENT) sortType: String, + @ParameterObject @PageableDefault(size = 10) pageable: Pageable): BaseResponse { return BaseResponse(productService.searchProducts(userAccount.getUser(), keyword, sortType, pageable)) } diff --git a/src/main/kotlin/com/psr/psr/product/dto/response/GetSearchProducts.kt b/src/main/kotlin/com/psr/psr/product/dto/response/GetSearchProducts.kt index 0a37a28..e724782 100644 --- a/src/main/kotlin/com/psr/psr/product/dto/response/GetSearchProducts.kt +++ b/src/main/kotlin/com/psr/psr/product/dto/response/GetSearchProducts.kt @@ -1,8 +1,10 @@ package com.psr.psr.product.dto.response +import io.swagger.v3.oas.annotations.media.Schema import org.springframework.data.domain.Page data class GetSearchProducts( + @Schema(description = "상품 목록") val productList: Page ) { companion object { From 39f6abfe452c53ffd2092b70e9877db49ca310d4 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:32:04 +0900 Subject: [PATCH 13/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/product/controller/ProductController.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt index 104d9f0..14238ce 100644 --- a/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt +++ b/src/main/kotlin/com/psr/psr/product/controller/ProductController.kt @@ -245,9 +245,24 @@ class ProductController( /** * 상품 수정 */ + @Operation(summary = "상품 수정(박소정)", description = "상품을 수정한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "해당 상품을 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ), + ApiResponse( + responseCode = "404", + description = "해당 글 작성자가 아닙니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PatchMapping("/{productId}") fun modifyProduct(@AuthenticationPrincipal userAccount: UserAccount, - @PathVariable productId: Long, + @Parameter(description = "(Long) 상품 id", example = "1") @PathVariable productId: Long, @RequestBody @Valid request: CreateproductReq): BaseResponse { return BaseResponse(productService.modifyProduct(userAccount.getUser(), productId, request)) } From 8478db6c4a7e71b201192ed2a5b7a309b7903823 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:35:48 +0900 Subject: [PATCH 14/15] =?UTF-8?q?#190=20docs:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20-=20=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psr/review/controller/ReviewController.kt | 18 +++++++++++++++++- .../psr/psr/review/dto/GetProductDetailRes.kt | 4 ++++ .../com/psr/psr/review/dto/ReviewDetailTop.kt | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/psr/psr/review/controller/ReviewController.kt b/src/main/kotlin/com/psr/psr/review/controller/ReviewController.kt index 51d6f7d..d82b10f 100644 --- a/src/main/kotlin/com/psr/psr/review/controller/ReviewController.kt +++ b/src/main/kotlin/com/psr/psr/review/controller/ReviewController.kt @@ -9,6 +9,12 @@ import com.psr.psr.review.dto.ReviewListRes import com.psr.psr.review.dto.ReviewReq import com.psr.psr.review.dto.ReviewRes import com.psr.psr.review.service.ReviewService +import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.Parameter +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import io.swagger.v3.oas.annotations.responses.ApiResponses import io.swagger.v3.oas.annotations.security.SecurityRequirement import io.swagger.v3.oas.annotations.tags.Tag import jakarta.validation.Valid @@ -88,9 +94,19 @@ class ReviewController( /** * 상품 상세 조회 - 리뷰 */ + @Operation(summary = "상품 상세 조회 - 리뷰(박소정)", description = "상품 상세의 리뷰를 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "404", + description = "해당 상품을 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @GetMapping("products/{productId}/reviews/top") fun getProductDetail(@AuthenticationPrincipal userAccount: UserAccount, - @PathVariable productId: Long): BaseResponse { + @Parameter(description = "(Long) 상품 id", example = "1") @PathVariable productId: Long): BaseResponse { return BaseResponse(reviewService.getProductDetail(userAccount.getUser(), productId)); } } \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/review/dto/GetProductDetailRes.kt b/src/main/kotlin/com/psr/psr/review/dto/GetProductDetailRes.kt index be9547d..d38baf2 100644 --- a/src/main/kotlin/com/psr/psr/review/dto/GetProductDetailRes.kt +++ b/src/main/kotlin/com/psr/psr/review/dto/GetProductDetailRes.kt @@ -1,10 +1,14 @@ package com.psr.psr.review.dto import com.psr.psr.review.entity.Review +import io.swagger.v3.oas.annotations.media.Schema data class GetProductDetailRes( + @Schema(description = "리뷰 수", example = "5") val numOfReviews: Int, + @Schema(description = "평균 별점", example = "4.5") val avgOfRating: Double, + @Schema(description = "리뷰 리스트(최대 5개)") val reviewList: List? ) { companion object { diff --git a/src/main/kotlin/com/psr/psr/review/dto/ReviewDetailTop.kt b/src/main/kotlin/com/psr/psr/review/dto/ReviewDetailTop.kt index d6896e2..74ae3a3 100644 --- a/src/main/kotlin/com/psr/psr/review/dto/ReviewDetailTop.kt +++ b/src/main/kotlin/com/psr/psr/review/dto/ReviewDetailTop.kt @@ -1,10 +1,14 @@ package com.psr.psr.review.dto import com.psr.psr.review.entity.Review +import io.swagger.v3.oas.annotations.media.Schema data class ReviewDetailTop( + @Schema(description = "리뷰 이미지", example = "url") val imgUrl: String?, + @Schema(description = "리뷰 별점", example = "4.5") val rating: Int, + @Schema(description = "리뷰 내용", example = "최고야- 그거야-") val content: String ) { companion object { From 23580d69f3efc95385adeb7f64ec38ae9ec26b60 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Fri, 10 Nov 2023 15:38:19 +0900 Subject: [PATCH 15/15] =?UTF-8?q?#190=20docs:=20=ED=99=88=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EC=A1=B0=ED=9A=8C=20-=20=EA=B3=B5=EC=A7=80?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/com/psr/psr/cs/controller/CsController.kt | 8 ++++++++ .../kotlin/com/psr/psr/cs/dto/response/NoticeListRes.kt | 2 ++ src/main/kotlin/com/psr/psr/cs/dto/response/NoticeRes.kt | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt b/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt index 56a615f..0b7ea6b 100644 --- a/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt +++ b/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt @@ -6,6 +6,9 @@ import com.psr.psr.cs.dto.response.NoticeListRes import com.psr.psr.cs.dto.response.NoticeRes import com.psr.psr.cs.service.CsService import com.psr.psr.global.dto.BaseResponse +import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.responses.ApiResponse +import io.swagger.v3.oas.annotations.responses.ApiResponses import io.swagger.v3.oas.annotations.security.SecurityRequirement import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.web.bind.annotation.* @@ -52,6 +55,11 @@ class CsController( /** * 홈 화면 조회 - 공지사항 */ + @Operation(summary = "홈 화면 조회 - 공지사항(박소정)", description = "홈 화면의 공지사항을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/notices/home") fun getHomePage(): BaseResponse { return BaseResponse(csService.getHomePage()) diff --git a/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeListRes.kt b/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeListRes.kt index 97a960d..768a5d7 100644 --- a/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeListRes.kt +++ b/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeListRes.kt @@ -2,9 +2,11 @@ package com.psr.psr.cs.dto.response import com.psr.psr.cs.dto.response.NoticeRes.Companion.toNoticeResHome import com.psr.psr.cs.entity.Notice +import io.swagger.v3.oas.annotations.media.Schema import java.util.stream.Collectors data class NoticeListRes ( + @Schema(description = "공지사항 리스트") val noticeLists: List? ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeRes.kt b/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeRes.kt index d935628..2e4ad53 100644 --- a/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeRes.kt +++ b/src/main/kotlin/com/psr/psr/cs/dto/response/NoticeRes.kt @@ -3,10 +3,13 @@ package com.psr.psr.cs.dto.response import com.fasterxml.jackson.annotation.JsonFormat import com.fasterxml.jackson.annotation.JsonInclude import com.psr.psr.cs.entity.Notice +import io.swagger.v3.oas.annotations.media.Schema import java.time.LocalDateTime data class NoticeRes ( + @Schema(description = "공지사항 id", example = "1") val noticeId: Long, + @Schema(description = "상품 제목", example = "2024 새해 복 많이 받으세요 ^_^") val title: String, @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @JsonInclude(JsonInclude.Include.NON_NULL)