From aecee4713d237304c39305b4d0d747566bc00714 Mon Sep 17 00:00:00 2001 From: Hanvp Date: Fri, 8 Sep 2023 13:10:08 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Feature/111=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=A1=B0=ED=9A=8C,=20?= =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/converter/RecipeConverter.java | 34 +- .../server/domain/recipe/BlockedComment.java | 33 ++ .../server/domain/recipe/BlockedRecipe.java | 33 ++ .../BlockedCommentRepository.java | 11 + .../BlockedRecipeRepository.java | 7 + .../recipeRepositories/CommentRepository.java | 20 ++ .../server/service/RecipeService.java | 5 + .../serviceImpl/RecipeServiceImpl.java | 85 +++-- .../web/controller/RecipeRestController.java | 308 +++++++++++------- .../web/dto/requestDto/RecipeRequestDto.java | 5 + .../dto/responseDto/RecipeResponseDto.java | 17 +- 11 files changed, 412 insertions(+), 146 deletions(-) create mode 100644 src/main/java/zipdabang/server/domain/recipe/BlockedComment.java create mode 100644 src/main/java/zipdabang/server/domain/recipe/BlockedRecipe.java create mode 100644 src/main/java/zipdabang/server/repository/recipeRepositories/BlockedCommentRepository.java create mode 100644 src/main/java/zipdabang/server/repository/recipeRepositories/BlockedRecipeRepository.java create mode 100644 src/main/java/zipdabang/server/repository/recipeRepositories/CommentRepository.java diff --git a/src/main/java/zipdabang/server/converter/RecipeConverter.java b/src/main/java/zipdabang/server/converter/RecipeConverter.java index a8719fd..bbf313b 100644 --- a/src/main/java/zipdabang/server/converter/RecipeConverter.java +++ b/src/main/java/zipdabang/server/converter/RecipeConverter.java @@ -35,6 +35,7 @@ public class RecipeConverter { // private final CategoryRepository categoryRepository; private final RecipeCategoryRepository recipeCategoryRepository; private final RecipeBannerRepository recipeBannerRepository; + private final CommentRepository commentRepository; private final AmazonS3Manager amazonS3Manager; private static RecipeRepository staticRecipeRepository; @@ -46,10 +47,10 @@ public class RecipeConverter { // private static CategoryRepository staticCategoryRepository; private static RecipeCategoryRepository staticRecipeCategoryRepository; private static RecipeBannerRepository staticRecipeBannerRepository; + private static CommentRepository staticCommentRepository; private static AmazonS3Manager staticAmazonS3Manager; - @PostConstruct public void init() { this.staticRecipeRepository = this.recipeRepository; @@ -344,4 +345,35 @@ public static String toKeyName(String imageUrl) { return extractedString; } + + public static Comment toComment(String content, Recipe findRecipe, Member member) { + return Comment.builder() + .content(content) + .recipe(findRecipe) + .member(member) + .build(); + } + + public static RecipeResponseDto.CommentDto toCommentDto(Comment createdComment, Member member) { + return RecipeResponseDto.CommentDto.builder() + .content(createdComment.getContent()) + .ownerNickname(createdComment.getMember().getNickname()) + .ownerImage(createdComment.getMember().getProfileUrl()) + .isOwner(createdComment.getMember() == member) + .createdAt(createdComment.getCreatedAt().toLocalDate()) + .build(); + } + + public static RecipeResponseDto.CommentPageListDto toPagingCommentDtoList(Page comments, Member member) { + return RecipeResponseDto.CommentPageListDto.builder() + .CommentList(comments.stream() + .map(comment -> toCommentDto(comment,member)) + .collect(Collectors.toList())) + .totalElements(comments.getTotalElements()) + .currentPageElements(comments.getNumberOfElements()) + .totalPage(comments.getTotalPages()) + .isFirst(comments.isFirst()) + .isLast(comments.isLast()) + .build(); + } } diff --git a/src/main/java/zipdabang/server/domain/recipe/BlockedComment.java b/src/main/java/zipdabang/server/domain/recipe/BlockedComment.java new file mode 100644 index 0000000..6d8014c --- /dev/null +++ b/src/main/java/zipdabang/server/domain/recipe/BlockedComment.java @@ -0,0 +1,33 @@ +package zipdabang.server.domain.recipe; + +import lombok.*; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; +import zipdabang.server.domain.member.Member; + +import javax.persistence.*; + +@Getter +@Builder +@AllArgsConstructor(access = AccessLevel.PROTECTED) +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@DynamicInsert +@DynamicUpdate +@Entity +public class BlockedComment { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "owner_id") + private Member owner; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "blocked_id") + private Comment blocked; + + public Comment getBlocked(){ + return this.blocked; + } +} diff --git a/src/main/java/zipdabang/server/domain/recipe/BlockedRecipe.java b/src/main/java/zipdabang/server/domain/recipe/BlockedRecipe.java new file mode 100644 index 0000000..bb7a4bb --- /dev/null +++ b/src/main/java/zipdabang/server/domain/recipe/BlockedRecipe.java @@ -0,0 +1,33 @@ +package zipdabang.server.domain.recipe; + +import lombok.*; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; +import zipdabang.server.domain.member.Member; + +import javax.persistence.*; + +@Getter +@Builder +@AllArgsConstructor(access = AccessLevel.PROTECTED) +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@DynamicInsert +@DynamicUpdate +@Entity +public class BlockedRecipe { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "owner_id") + private Member owner; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "blocked_id") + private Recipe blocked; + + public Recipe getBlocked(){ + return this.blocked; + } +} diff --git a/src/main/java/zipdabang/server/repository/recipeRepositories/BlockedCommentRepository.java b/src/main/java/zipdabang/server/repository/recipeRepositories/BlockedCommentRepository.java new file mode 100644 index 0000000..3dadfd7 --- /dev/null +++ b/src/main/java/zipdabang/server/repository/recipeRepositories/BlockedCommentRepository.java @@ -0,0 +1,11 @@ +package zipdabang.server.repository.recipeRepositories; + +import org.springframework.data.jpa.repository.JpaRepository; +import zipdabang.server.domain.member.Member; +import zipdabang.server.domain.recipe.BlockedComment; + +import java.util.List; + +public interface BlockedCommentRepository extends JpaRepository { + List findByOwner(Member member); +} diff --git a/src/main/java/zipdabang/server/repository/recipeRepositories/BlockedRecipeRepository.java b/src/main/java/zipdabang/server/repository/recipeRepositories/BlockedRecipeRepository.java new file mode 100644 index 0000000..63fe831 --- /dev/null +++ b/src/main/java/zipdabang/server/repository/recipeRepositories/BlockedRecipeRepository.java @@ -0,0 +1,7 @@ +package zipdabang.server.repository.recipeRepositories; + +import org.springframework.data.jpa.repository.JpaRepository; +import zipdabang.server.domain.recipe.BlockedComment; + +public interface BlockedRecipeRepository extends JpaRepository { +} diff --git a/src/main/java/zipdabang/server/repository/recipeRepositories/CommentRepository.java b/src/main/java/zipdabang/server/repository/recipeRepositories/CommentRepository.java new file mode 100644 index 0000000..d3402be --- /dev/null +++ b/src/main/java/zipdabang/server/repository/recipeRepositories/CommentRepository.java @@ -0,0 +1,20 @@ +package zipdabang.server.repository.recipeRepositories; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; +import zipdabang.server.domain.member.Member; +import zipdabang.server.domain.recipe.Comment; +import zipdabang.server.domain.recipe.Recipe; + +import java.util.List; + +public interface CommentRepository extends JpaRepository { + + Page findByMemberNotIn(List blockedMember, PageRequest createdAt); + + Page findByIdNotIn(List blockedComment, PageRequest createdAt); + + Page findByIdNotInAndMemberNotIn(List blockedComment, List blockedMember, PageRequest createdAt); +} diff --git a/src/main/java/zipdabang/server/service/RecipeService.java b/src/main/java/zipdabang/server/service/RecipeService.java index 3d98159..8e0ecd7 100644 --- a/src/main/java/zipdabang/server/service/RecipeService.java +++ b/src/main/java/zipdabang/server/service/RecipeService.java @@ -3,6 +3,7 @@ import org.springframework.data.domain.Page; import org.springframework.web.multipart.MultipartFile; import zipdabang.server.domain.member.Member; +import zipdabang.server.domain.recipe.Comment; import zipdabang.server.domain.recipe.Recipe; import zipdabang.server.domain.recipe.RecipeBanner; import zipdabang.server.domain.recipe.RecipeCategory; @@ -43,4 +44,8 @@ public interface RecipeService { boolean checkRecipeCategoryExist(Long categoryId); Boolean deleteRecipe(Long recipeId, Member member); + + Comment createComment(String content, Long recipeId, Member member); + + Page commentList(Integer pageIndex, Long recipeId, Member member); } diff --git a/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java b/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java index bc28be8..c679a51 100644 --- a/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java +++ b/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java @@ -44,9 +44,10 @@ public class RecipeServiceImpl implements RecipeService { private final LikesRepository likesRepository; private final ScrapRepository scrapRepository; private final AmazonS3Manager amazonS3Manager; - private final AmazonConfig amazonConfig; private final BlockedMemberRepository blockedMemberRepository; + private final CommentRepository commentRepository; + private final BlockedCommentRepository blockedCommentRepository; @Value("${paging.size}") Integer pageSize; @@ -120,9 +121,7 @@ public Boolean getScrap(Recipe recipe, Member member) { @Override public Page searchRecipe(Long categoryId, String keyword, Integer pageIndex, Member member) { - List blockedMember= blockedMemberRepository.findByOwner(member).stream() - .map(blockedInfo -> blockedInfo.getBlocked()) - .collect(Collectors.toList()); + List blockedMember = getBlockedMembers(member); List recipeCategory = recipeCategoryRepository.findAllById(categoryId); @@ -146,9 +145,7 @@ public Page searchRecipe(Long categoryId, String keyword, Integer pageIn public List getWrittenByRecipePreview(String writtenby, Member member) { List recipeList = new ArrayList<>(); - List blockedMember= blockedMemberRepository.findByOwner(member).stream() - .map(blockedInfo -> blockedInfo.getBlocked()) - .collect(Collectors.toList()); + List blockedMember = getBlockedMembers(member); if (!blockedMember.isEmpty()) { if (writtenby.equals("all")) { @@ -226,18 +223,25 @@ public List getAllRecipeCategories() { @Override public Page recipeListByCategory(Long categoryId, Integer pageIndex, Member member, String order) { - List blockedMember= blockedMemberRepository.findByOwner(member).stream() - .map(blockedInfo -> blockedInfo.getBlocked()) - .collect(Collectors.toList()); + List blockedMember = getBlockedMembers(member); - List recipeCategory = recipeCategoryRepository.findAllById(categoryId); + List recipeIdList = new ArrayList<>(); - if(recipeCategory.isEmpty()) - throw new RecipeException(Code.RECIPE_NOT_FOUND); + if (categoryId == 0){ + recipeIdList = recipeRepository.findAll().stream() + .map(recipe -> recipe.getId()) + .collect(Collectors.toList()); + } + else{ + List recipeCategory = recipeCategoryRepository.findAllById(categoryId); - List recipeIdList = recipeCategoryMappingRepository.findByCategoryIn(recipeCategory).stream() - .map(categoryMapping -> categoryMapping.getRecipe().getId()) - .collect(Collectors.toList()); + if(recipeCategory.isEmpty()) + throw new RecipeException(Code.RECIPE_NOT_FOUND); + + recipeIdList = recipeCategoryMappingRepository.findByCategoryIn(recipeCategory).stream() + .map(categoryMapping -> categoryMapping.getRecipe().getId()) + .collect(Collectors.toList()); + } String orderBy = null; @@ -268,11 +272,9 @@ public boolean checkRecipeCategoryExist(Long categoryId) { @Override public List> searchRecipePreview(String keyword, Member member) { - Long recipeCategorySize = recipeCategoryRepository.count(); + Long recipeCategorySize = recipeCategoryRepository.count()-1; - List blockedMember = blockedMemberRepository.findByOwner(member).stream() - .map(blockedInfo -> blockedInfo.getBlocked()) - .collect(Collectors.toList()); + List blockedMember = getBlockedMembers(member); List> recipeList = new ArrayList<>(); @@ -292,6 +294,13 @@ public List> searchRecipePreview(String keyword, Member member) { return recipeList; } + private List getBlockedMembers(Member member) { + List blockedMember = blockedMemberRepository.findByOwner(member).stream() + .map(blockedInfo -> blockedInfo.getBlocked()) + .collect(Collectors.toList()); + return blockedMember; + } + public List getRecipeBannerList() { return recipeBannerRepository.findAll(); } @@ -312,4 +321,40 @@ public Boolean deleteRecipe(Long recipeId, Member member) { return recipeRepository.existsById(recipeId) == false; } + + @Transactional(readOnly = false) + @Override + public Comment createComment(String content, Long recipeId, Member member) { + Recipe findRecipe = recipeRepository.findById(recipeId).orElseThrow(() -> new RecipeException(Code.NO_RECIPE_EXIST)); + + Comment buildComment = RecipeConverter.toComment(content, findRecipe, member); + return commentRepository.save(buildComment); + } + + @Override + public Page commentList(Integer pageIndex, Long recipeId, Member member) { + recipeRepository.findById(recipeId).orElseThrow(() -> new RecipeException(Code.NO_RECIPE_EXIST)); + + List blockedMember = getBlockedMembers(member); + List blockedComment = getBlockedComment(member); + + if(blockedMember.isEmpty() && blockedComment.isEmpty()) + return commentRepository.findAll( + PageRequest.of(pageIndex, pageSize, Sort.by(Sort.Direction.DESC, "createdAt"))); + else if(!blockedMember.isEmpty() && blockedComment.isEmpty()) + return commentRepository.findByMemberNotIn(blockedMember, PageRequest.of(pageIndex, pageSize, Sort.by(Sort.Direction.DESC, "createdAt"))); + else if(blockedMember.isEmpty() && !blockedComment.isEmpty()) + return commentRepository.findByIdNotIn(blockedComment, PageRequest.of(pageIndex, pageSize, Sort.by(Sort.Direction.DESC, "createdAt"))); + else + return commentRepository.findByIdNotInAndMemberNotIn(blockedComment, blockedMember, PageRequest.of(pageIndex, pageSize, Sort.by(Sort.Direction.DESC, "createdAt"))); + } + + private List getBlockedComment(Member member) { + + List blockedCommentIdList = blockedCommentRepository.findByOwner(member).stream() + .map(blockedInfo -> blockedInfo.getBlocked().getId()) + .collect(Collectors.toList()); + + return blockedCommentIdList; + } } diff --git a/src/main/java/zipdabang/server/web/controller/RecipeRestController.java b/src/main/java/zipdabang/server/web/controller/RecipeRestController.java index 3b38f37..d6d8c6f 100644 --- a/src/main/java/zipdabang/server/web/controller/RecipeRestController.java +++ b/src/main/java/zipdabang/server/web/controller/RecipeRestController.java @@ -20,6 +20,7 @@ import zipdabang.server.base.exception.handler.RecipeException; import zipdabang.server.converter.RecipeConverter; import zipdabang.server.domain.member.Member; +import zipdabang.server.domain.recipe.Comment; import zipdabang.server.domain.recipe.Recipe; import zipdabang.server.domain.recipe.RecipeBanner; import zipdabang.server.domain.recipe.RecipeCategory; @@ -44,12 +45,12 @@ @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ ์ž‘์„ฑํ•˜๊ธฐ1, ๋ ˆ์‹œํ”ผ ๋“ฑ๋ก API ๐Ÿ”‘ โœ”", description = "๋ ˆ์‹œํ”ผ (์ž‘์„ฑ)๋“ฑ๋ก ํ™”๋ฉด API์ž…๋‹ˆ๋‹ค. ์ž„์‹œ์ €์žฅ api๋Š” ๋ณ„๋„๋กœ ์žˆ์Œ. step์ด๋ž‘ ingredient ๋ช‡๊ฐœ ๋“ค์–ด์˜ค๋Š”์ง€ ๊ฐCount์— ์ ์–ด์ฃผ์„ธ์š”") @ApiResponses({ @ApiResponse(responseCode = "2000"), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), @ApiResponse(responseCode = "4100", description = "๋ ˆ์‹œํ”ผ ์ž‘์„ฑ์‹œ ๋ˆ„๋ฝ๋œ ๋‚ด์šฉ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฏธ์™„๋ฃŒ๋Š” ์ž„์‹œ์ €์žฅ์œผ๋กœ ๊ฐ€์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), @@ -59,7 +60,7 @@ public ResponseDto createRecipe( @RequestPart(value = "content") RecipeRequestDto.CreateRecipeDto request, @RequestPart(value = "thumbnail") MultipartFile thumbnail, @RequestPart(value = "stepImages") List stepImages, - @AuthMember Member member) throws IOException { + @CheckTempMember @AuthMember Member member) throws IOException { log.info("์‚ฌ์šฉ์ž๊ฐ€ ์ค€ ์ •๋ณด : {}", request.toString()); @@ -70,13 +71,13 @@ public ResponseDto createRecipe( @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ ์ƒ์„ธํŽ˜์ด์ง€, ๋ ˆ์‹œํ”ผ ์ƒ์„ธ ์ •๋ณด ์กฐํšŒ API ๐Ÿ”‘ โœ”", description = "๋ ˆ์‹œํ”ผ ์กฐํšŒ ํ™”๋ฉด API์ž…๋‹ˆ๋‹ค. ๋Œ“๊ธ€์€ ์ฒ˜์Œ 10๊ฐœ๋งŒ ๊ฐ€์ ธ์˜ค๊ณ  ๋‚˜๋จธ์ง€๋Š” ๋Œ“๊ธ€ page api ๋“œ๋ฆผ") @ApiResponses({ @ApiResponse(responseCode = "2000"), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4101",description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4102",description = "BAD_REQUEST, ์ฐจ๋‹จํ•œ ์‚ฌ์šฉ์ž์˜ recipe ์ž…๋‹ˆ๋‹ค. ์ ‘๊ทผํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4101", description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4102", description = "BAD_REQUEST, ์ฐจ๋‹จํ•œ ์‚ฌ์šฉ์ž์˜ recipe ์ž…๋‹ˆ๋‹ค. ์ ‘๊ทผํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), @@ -95,36 +96,36 @@ public ResponseDto recipeDetail(@PathVariable(n @Operation(summary = "๐Ÿนfigma ๋‚˜์˜ ๋ ˆ์‹œํ”ผ ์‚ญ์ œ_์•Œ๋Ÿฟ, ๋ ˆ์‹œํ”ผ ์‚ญ์ œ API ๐Ÿ”‘ โœ”", description = "๋ ˆ์‹œํ”ผ ์‚ญ์ œ API์ž…๋‹ˆ๋‹ค.") @ApiResponses({ @ApiResponse(responseCode = "2000", description = "OK, ์‚ญ์ œ์ฒ˜๋ฆฌ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4101",description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4106",description = "BAD_REQUEST, ๋ณธ์ธ์ด ์ž‘์„ฑํ•œ ๋ ˆ์‹œํ”ผ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์‚ญ์ œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4101", description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4106", description = "BAD_REQUEST, ๋ณธ์ธ์ด ์ž‘์„ฑํ•œ ๋ ˆ์‹œํ”ผ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์‚ญ์ œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), }) @DeleteMapping("/members/recipes/{recipeId}") - public ResponseDto deleteRecipe(@PathVariable(name = "recipeId") Long recipeId, @AuthMember Member member){ + public ResponseDto deleteRecipe(@PathVariable(name = "recipeId") Long recipeId, @CheckTempMember @AuthMember Member member) { Boolean reicpeDeleteBoolean = recipeService.deleteRecipe(recipeId, member); if (reicpeDeleteBoolean) - return ResponseDto.of(recipeId+" ๋ ˆ์‹œํ”ผ ์‚ญ์ œ ์™„๋ฃŒ"); + return ResponseDto.of(recipeId + " ๋ ˆ์‹œํ”ผ ์‚ญ์ œ ์™„๋ฃŒ"); else - throw new RecipeException(Code.INTERNAL_ERROR); + throw new RecipeException(Code.INTERNAL_ERROR); } @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ2, ๋ ˆ์‹œํ”ผ ๊ฒ€์ƒ‰ ์นดํ…Œ๊ณ ๋ฆฌ ๋ณ„ preview ํ™”๋ฉด API ๐Ÿ”‘ โœ”", description = "๊ฒ€์ƒ‰ํ•œ ๋ ˆ์‹œํ”ผ ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„ ์กฐํšŒ ํ™”๋ฉด API์ž…๋‹ˆ๋‹ค.") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), - @ApiResponse(responseCode = "2100",description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), + @ApiResponse(responseCode = "2100", description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), @@ -140,18 +141,19 @@ public ResponseDto searchRecipePre return ResponseDto.of(RecipeConverter.toSearchRecipePreviewListDto(recipeLists, member)); } - @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ2, ๋ ˆ์‹œํ”ผ ๊ฒ€์ƒ‰ ๋ชฉ๋ก์กฐํšŒ ํ™”๋ฉด API ๐Ÿ”‘ โœ”", description = "๊ฒ€์ƒ‰ํ•œ ๋ ˆ์‹œํ”ผ ์กฐํšŒ ํ™”๋ฉด API์ž…๋‹ˆ๋‹ค. pageIndex๋กœ ํŽ˜์ด์ง•") + + @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ2, ๋ ˆ์‹œํ”ผ ๊ฒ€์ƒ‰ ๋ชฉ๋ก์กฐํšŒ ํ™”๋ฉด API ๐Ÿ”‘ โœ”", description = "๊ฒ€์ƒ‰ํ•œ ๋ ˆ์‹œํ”ผ ์กฐํšŒ ํ™”๋ฉด API์ž…๋‹ˆ๋‹ค. pageIndex๋กœ ํŽ˜์ด์ง•") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), - @ApiResponse(responseCode = "2100",description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4054",description = "BAD_REQUEST, ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. 1 ์ด์ƒ์œผ๋กœ ์ฃผ์„ธ์š”.",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4055",description = "BAD_REQUEST, ํŽ˜์ด์ง€ ์ธ๋ฑ์Šค ๋ฒ”์œ„ ์ดˆ๊ณผํ•จ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4105",description = "BAD_REQUEST, ํ•ด๋‹น id๋ฅผ ๊ฐ€์ง„ ๋ ˆ์‹œํ”ผ ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ž˜๋ชป ๋ณด๋‚ด์คฌ์–ด์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), + @ApiResponse(responseCode = "2100", description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4054", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. 1 ์ด์ƒ์œผ๋กœ ์ฃผ์„ธ์š”.", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4055", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ์ธ๋ฑ์Šค ๋ฒ”์œ„ ์ดˆ๊ณผํ•จ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4105", description = "BAD_REQUEST, ํ•ด๋‹น id๋ฅผ ๊ฐ€์ง„ ๋ ˆ์‹œํ”ผ ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ž˜๋ชป ๋ณด๋‚ด์คฌ์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), @@ -159,98 +161,98 @@ public ResponseDto searchRecipePre @Parameter(name = "keyword", description = "query string ๊ฒ€์ƒ‰ํ•  ๋‹จ์–ด") }) @GetMapping(value = "/members/recipes/search/{categoryId}") - public ResponseDto searchRecipe(@PathVariable Long categoryId, @RequestParam(name = "keyword", required = false) String keyword, @RequestParam(name = "pageIndex", required = false) Integer pageIndex, @AuthMember Member member){ + public ResponseDto searchRecipe(@PathVariable Long categoryId, @RequestParam(name = "keyword", required = false) String keyword, @RequestParam(name = "pageIndex", required = false) Integer pageIndex, @AuthMember Member member) { if (recipeService.checkRecipeCategoryExist(categoryId) == false) throw new RecipeException(Code.NO_RECIPE_CATEGORY_EXIST); - if(pageIndex == null) - pageIndex =1; + if (pageIndex == null) + pageIndex = 1; else if (pageIndex < 1) throw new RecipeException(Code.UNDER_PAGE_INDEX_ERROR); pageIndex -= 1; - Page recipes= recipeService.searchRecipe(categoryId, keyword,pageIndex,member); + Page recipes = recipeService.searchRecipe(categoryId, keyword, pageIndex, member); log.info(recipes.toString()); - if(recipes.getTotalElements() == 0) + if (recipes.getTotalElements() == 0) throw new RecipeException(Code.RECIPE_NOT_FOUND); - if(pageIndex >= recipes.getTotalPages()) - throw new RecipeException(Code.OVER_PAGE_INDEX_ERROR); + if (pageIndex >= recipes.getTotalPages()) + throw new RecipeException(Code.OVER_PAGE_INDEX_ERROR); return ResponseDto.of(RecipeConverter.toPagingRecipeDtoList(recipes, member)); } @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ2, ์นดํ…Œ๊ณ ๋ฆฌ ๋ณ„ ๋ ˆ์‹œํ”ผ ๋ชฉ๋ก ์กฐํšŒ API ๐Ÿ”‘ โœ”", description = "์นดํ…Œ๊ณ ๋ฆฌ ๋ณ„ ๋ ˆ์‹œํ”ผ ๋ชฉ๋ก ์กฐํšŒ ํ™”๋ฉด API์ž…๋‹ˆ๋‹ค. pageIndex๋กœ ํŽ˜์ด์ง•") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), - @ApiResponse(responseCode = "2100",description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4053",description = "BAD_REQUEST, ๋„˜๊ฒจ๋ฐ›์€ categoryId์™€ ์ผ์น˜ํ•˜๋Š” ์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ. 1~6 ์‚ฌ์ด๋กœ ๋ณด๋‚ด์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4054",description = "BAD_REQUEST, ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. 1 ์ด์ƒ์œผ๋กœ ์ฃผ์„ธ์š”.",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4055",description = "BAD_REQUEST, ํŽ˜์ด์ง€ ์ธ๋ฑ์Šค ๋ฒ”์œ„ ์ดˆ๊ณผํ•จ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4104",description = "BAD_REQUEST, ์กฐํšŒ ๋ฐฉ์‹ ํƒ€์ž…์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค. likes, views, lastest์ค‘ ํ•˜๋‚˜๋กœ ๋ณด๋‚ด์ฃผ์„ธ์š”.",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4105",description = "BAD_REQUEST, ํ•ด๋‹น id๋ฅผ ๊ฐ€์ง„ ๋ ˆ์‹œํ”ผ ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ž˜๋ชป ๋ณด๋‚ด์คฌ์–ด์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), + @ApiResponse(responseCode = "2100", description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4053", description = "BAD_REQUEST, ๋„˜๊ฒจ๋ฐ›์€ categoryId์™€ ์ผ์น˜ํ•˜๋Š” ์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ. 1~6 ์‚ฌ์ด๋กœ ๋ณด๋‚ด์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4054", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. 1 ์ด์ƒ์œผ๋กœ ์ฃผ์„ธ์š”.", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4055", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ์ธ๋ฑ์Šค ๋ฒ”์œ„ ์ดˆ๊ณผํ•จ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4104", description = "BAD_REQUEST, ์กฐํšŒ ๋ฐฉ์‹ ํƒ€์ž…์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค. likes, views, lastest์ค‘ ํ•˜๋‚˜๋กœ ๋ณด๋‚ด์ฃผ์„ธ์š”.", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4105", description = "BAD_REQUEST, ํ•ด๋‹น id๋ฅผ ๊ฐ€์ง„ ๋ ˆ์‹œํ”ผ ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ž˜๋ชป ๋ณด๋‚ด์คฌ์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), - @Parameter(name = "pageIndex", description = "query string ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ, ์•ˆ์ฃผ๋ฉด 0์œผ๋กœ(์ตœ์ดˆ ํŽ˜์ด์ง€) ์„ค์ •ํ•จ, -1 ์ด๋Ÿฐ๊ฑฐ ์ฃผ๋ฉด ์—๋Ÿฌ ๋ฑ‰์Œ"), + @Parameter(name = "pageIndex", description = "query string ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ, ์•ˆ์ฃผ๋ฉด 1์œผ๋กœ(์ตœ์ดˆ ํŽ˜์ด์ง€) ์„ค์ •ํ•จ, 0 ์ด๋Ÿฐ๊ฑฐ ์ฃผ๋ฉด ์—๋Ÿฌ ๋ฑ‰์Œ"), @Parameter(name = "order", description = "query string ์กฐํšŒ ๋ฐฉ์‹. ์ธ๊ธฐ์ˆœ: likes, ์กฐํšŒ์ˆœ: views, ์ตœ์‹ ์ˆœ: latest๋กœ ๋„˜๊ฒจ์ฃผ์„ธ์š”, ๊ธฐ๋ณธ๊ฐ’ latest") }) @GetMapping(value = "/members/recipes/categories/{categoryId}") - public ResponseDto recipeListByCategory(@PathVariable Long categoryId, @RequestParam(name = "order", required = false) String order, @RequestParam(name = "pageIndex", required = false) Integer pageIndex, @AuthMember Member member){ + public ResponseDto recipeListByCategory(@PathVariable Long categoryId, @RequestParam(name = "order", required = false) String order, @RequestParam(name = "pageIndex", required = false) Integer pageIndex, @AuthMember Member member) { if (recipeService.checkRecipeCategoryExist(categoryId) == false) throw new RecipeException(Code.NO_RECIPE_CATEGORY_EXIST); - if(pageIndex == null) - pageIndex =1; + if (pageIndex == null) + pageIndex = 1; else if (pageIndex < 1) throw new RecipeException(Code.UNDER_PAGE_INDEX_ERROR); pageIndex -= 1; - Page recipes = recipeService.recipeListByCategory(categoryId,pageIndex,member,order); + Page recipes = recipeService.recipeListByCategory(categoryId, pageIndex, member, order); log.info(recipes.toString()); - if(recipes.getTotalElements() == 0) + if (recipes.getTotalElements() == 0) throw new RecipeException(Code.RECIPE_NOT_FOUND); - if(pageIndex >= recipes.getTotalPages()) - throw new RecipeException(Code.OVER_PAGE_INDEX_ERROR); + if (pageIndex >= recipes.getTotalPages()) + throw new RecipeException(Code.OVER_PAGE_INDEX_ERROR); return ResponseDto.of(RecipeConverter.toPagingRecipeDtoList(recipes, member)); } @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ1, ๋ชจ๋“ ์‚ฌ๋žŒ/์ธํ”Œ๋ฃจ์–ธ์„œ/์šฐ๋ฆฌ๋“ค์˜ ๋ ˆ์‹œํ”ผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ API ๐Ÿ”‘ โœ”", description = "5๊ฐœ์”ฉ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋กœ ๊ฐ€์ ธ์˜ค๋Š” API์ž…๋‹ˆ๋‹ค.") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), - @ApiResponse(responseCode = "2100",description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4103",description = "BAD_REQUEST, ๋ ˆ์‹œํ”ผ ์ž‘์„ฑ์ž ํƒ€์ž…์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค. all, influencer, common์ค‘ ํ•˜๋‚˜๋กœ ๋ณด๋‚ด์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), + @ApiResponse(responseCode = "2100", description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4103", description = "BAD_REQUEST, ๋ ˆ์‹œํ”ผ ์ž‘์„ฑ์ž ํƒ€์ž…์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค. all, influencer, common์ค‘ ํ•˜๋‚˜๋กœ ๋ณด๋‚ด์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), @Parameter(name = "writtenby", description = "query string ๋ˆ„๊ฐ€ ์“ด ๋ ˆ์‹œํ”ผ ์ข…๋ฅ˜์ธ์ง€. ๋ชจ๋“  ์‚ฌ๋žŒ: all, ์ธํ”Œ๋ฃจ์–ธ์„œ: influencer, ์šฐ๋ฆฌ๋“ค: common์œผ๋กœ ๋„˜๊ฒจ์ฃผ์„ธ์š”") }) @GetMapping(value = "/members/recipes/types/preview") - public ResponseDto recipeListPreviewWrittenBy(@RequestParam(name = "writtenby") String writtenby, @AuthMember Member member){ + public ResponseDto recipeListPreviewWrittenBy(@RequestParam(name = "writtenby") String writtenby, @AuthMember Member member) { List recipes = recipeService.getWrittenByRecipePreview(writtenby, member); log.info(recipes.toString()); - if(recipes.size() == 0) + if (recipes.size() == 0) throw new RecipeException(Code.RECIPE_NOT_FOUND); return ResponseDto.of(RecipeConverter.toPreviewRecipeDtoList(recipes, member)); @@ -258,16 +260,16 @@ public ResponseDto recipeListPreviewWrittenBy(@ @Operation(summary = "๐Ÿนfigma ๋ ˆ์‹œํ”ผ2, ๋ชจ๋“ ์‚ฌ๋žŒ/์ธํ”Œ๋ฃจ์–ธ์„œ/์šฐ๋ฆฌ๋“ค์˜ ๋ ˆ์‹œํ”ผ ๋ชฉ๋ก API ๐Ÿ”‘", description = "๋ ˆ์‹œํ”ผ ๋ชฉ๋ก ํ™”๋ฉด API์ž…๋‹ˆ๋‹ค. pageIndex๋กœ ํŽ˜์ด์ง•") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), - @ApiResponse(responseCode = "2100",description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4053",description = "BAD_REQUEST, ๋„˜๊ฒจ๋ฐ›์€ categoryId์™€ ์ผ์น˜ํ•˜๋Š” ์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ. 1~6 ์‚ฌ์ด๋กœ ๋ณด๋‚ด์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4054",description = "BAD_REQUEST, ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. 1 ์ด์ƒ์œผ๋กœ ์ฃผ์„ธ์š”.",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4055",description = "BAD_REQUEST, ํŽ˜์ด์ง€ ์ธ๋ฑ์Šค ๋ฒ”์œ„ ์ดˆ๊ณผํ•จ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), + @ApiResponse(responseCode = "2100", description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4053", description = "BAD_REQUEST, ๋„˜๊ฒจ๋ฐ›์€ categoryId์™€ ์ผ์น˜ํ•˜๋Š” ์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ. 1~6 ์‚ฌ์ด๋กœ ๋ณด๋‚ด์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4054", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. 1 ์ด์ƒ์œผ๋กœ ์ฃผ์„ธ์š”.", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4055", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ์ธ๋ฑ์Šค ๋ฒ”์œ„ ์ดˆ๊ณผํ•จ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), @@ -276,43 +278,43 @@ public ResponseDto recipeListPreviewWrittenBy(@ @Parameter(name = "order", description = "query string ์กฐํšŒ ๋ฐฉ์‹. ์ธ๊ธฐ์ˆœ: likes, ์กฐํšŒ์ˆœ: views, ์ตœ์‹ ์ˆœ: latest๋กœ ๋„˜๊ฒจ์ฃผ์„ธ์š”") }) @GetMapping(value = "/members/recipes/types") - public ResponseDto recipeListWrittenBy(@RequestParam(name = "writtenby") String writtenby, @RequestParam(name = "order") String order, @RequestParam(name = "pageIndex", required = false) Integer pageIndex, @AuthMember Member member){ + public ResponseDto recipeListWrittenBy(@RequestParam(name = "writtenby") String writtenby, @RequestParam(name = "order") String order, @RequestParam(name = "pageIndex", required = false) Integer pageIndex, @AuthMember Member member) { return null; } @Operation(summary = "๐Ÿ figma ํ™ˆ1, ์ฃผ๊ฐ„ ๋ฒ ์ŠคํŠธ ๋ ˆ์‹œํ”ผ API ๐Ÿ”‘", description = "์ด๋ฒˆ ์ฃผ ๋ฒ ์ŠคํŠธ ๋ ˆ์‹œํ”ผ API์ž…๋‹ˆ๋‹ค.") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), - @ApiResponse(responseCode = "2100",description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), + @ApiResponse(responseCode = "2100", description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ, result = null", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), }) @GetMapping(value = "/members/recipes/week-best") - public ResponseDto recipeWeekBest(@AuthMember Member member){ + public ResponseDto recipeWeekBest(@AuthMember Member member) { return null; } @Operation(summary = "๋ ˆ์‹œํ”ผ ์Šคํฌ๋žฉ/์ทจ์†Œ API ๐Ÿ”‘ โœ”", description = "๋ ˆ์‹œํ”ผ ์Šคํฌ๋žฉ/์ทจ์†Œ API์ž…๋‹ˆ๋‹ค.") @ApiResponses({ @ApiResponse(responseCode = "2000"), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4101",description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4101", description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), }) @PostMapping(value = "/members/recipes/{recipeId}/scrap") - public ResponseDto recipeScrapOrCancel(@PathVariable Long recipeId, @AuthMember Member member){ + public ResponseDto recipeScrapOrCancel(@PathVariable Long recipeId, @CheckTempMember @AuthMember Member member) { Recipe recipe = recipeService.updateScrapOnRecipe(recipeId, member); return ResponseDto.of(RecipeConverter.toRecipeStatusDto(recipe)); @@ -321,18 +323,18 @@ public ResponseDto recipeScrapOrCancel(@PathV @Operation(summary = "๋ ˆ์‹œํ”ผ ์ข‹์•„์š”/์ทจ์†Œ API ๐Ÿ”‘ โœ”", description = "๋ ˆ์‹œํ”ผ ์ข‹์•„์š”/์ทจ์†Œ API์ž…๋‹ˆ๋‹ค.") @ApiResponses({ @ApiResponse(responseCode = "2000"), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4101",description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4101", description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @Parameters({ @Parameter(name = "member", hidden = true), }) @PostMapping(value = "/members/recipes/{recipeId}/likes") - public ResponseDto recipeLikeOrCancel(@PathVariable Long recipeId, @CheckTempMember @AuthMember Member member){ + public ResponseDto recipeLikeOrCancel(@PathVariable Long recipeId, @CheckTempMember @AuthMember Member member) { Recipe recipe = recipeService.updateLikeOnRecipe(recipeId, member); @@ -341,12 +343,12 @@ public ResponseDto recipeLikeOrCancel(@PathVa @Operation(summary = "๋ ˆ์‹œํ”ผ ๋ฐฐ๋„ˆ ์ด๋ฏธ์ง€ API ๐Ÿ”‘ โœ”", description = "๋ ˆ์‹œํ”ผ ํ™”๋ฉด์˜ ๋ฐฐ๋„ˆ ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. order๋Š” ๋ฐฐ๋„ˆ ์ˆœ์„œ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK ์„ฑ๊ณต"), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK ์„ฑ๊ณต"), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @GetMapping("/members/recipes/banners") public ResponseDto showBanners() { @@ -356,16 +358,74 @@ public ResponseDto showBanners() { @Operation(summary = "๋ ˆ์‹œํ”ผ ์นดํ…Œ๊ณ ๋ฆฌ ์กฐํšŒ API ๐Ÿ”‘ โœ”๏ธ", description = "๋ ˆ์‹œํ”ผ ์นดํ…Œ๊ณ ๋ฆฌ ์กฐํšŒ API์ž…๋‹ˆ๋‹ค.") @ApiResponses({ - @ApiResponse(responseCode = "2000",description = "OK ์„ฑ๊ณต"), - @ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4005",description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4008",description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "4052",description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ",content = @Content(schema = @Schema(implementation = ResponseDto.class))), - @ApiResponse(responseCode = "5000",description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”",content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "2000", description = "OK ์„ฑ๊ณต"), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), }) @GetMapping("/members/recipes/categories") - public ResponseDto showCategoryList(){ + public ResponseDto showCategoryList() { List allCategories = recipeService.getAllRecipeCategories(); return ResponseDto.of(RecipeConverter.RecipeCategoryListDto(allCategories)); } + + @Operation(summary = "๋Œ“๊ธ€ ๋“ฑ๋ก API ๐Ÿ”‘ โœ”", description = "๋ ˆ์‹œํ”ผ (์ž‘์„ฑ)๋“ฑ๋ก API์ž…๋‹ˆ๋‹ค.") + @ApiResponses({ + @ApiResponse(responseCode = "2000"), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4101", description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + }) + @Parameters({ + @Parameter(name = "member", hidden = true), + }) + @PostMapping(value = "/members/recipes/{recipeId}/comments") + public ResponseDto createComment(@RequestBody RecipeRequestDto.createCommentDto request, @PathVariable Long recipeId, @CheckTempMember @AuthMember Member member) { + Comment createdComment = recipeService.createComment(request.getComment(), recipeId, member); + + return ResponseDto.of(RecipeConverter.toCommentDto(createdComment, member)); + } + + @Operation(summary = "๋Œ“๊ธ€ ๋ชฉ๋ก ํ™”๋ฉด API ๐Ÿ”‘ โœ”", description = "๋Œ“๊ธ€ API์ž…๋‹ˆ๋‹ค. pageIndex๋กœ ํŽ˜์ด์ง•") + @ApiResponses({ + @ApiResponse(responseCode = "2000", description = "OK, ๋ชฉ๋ก์ด ์žˆ์„ ๋• ์ด ์‘๋‹ต์ž„"), + @ApiResponse(responseCode = "2100", description = "OK, ๋ชฉ๋ก์ด ์—†์„ ๊ฒฝ์šฐ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4003", description = "UNAUTHORIZED, ํ† ํฐ ๋ชจ์–‘์ด ์ด์ƒํ•จ, ํ† ํฐ ์ œ๋Œ€๋กœ ์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4005", description = "UNAUTHORIZED, ์—‘์„ธ์Šค ํ† ํฐ ๋งŒ๋ฃŒ, ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์‚ฌ์šฉ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4008", description = "UNAUTHORIZED, ํ† ํฐ ์—†์Œ, ํ† ํฐ ์ค˜์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4052", description = "BAD_REQUEST, ์‚ฌ์šฉ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด api์—์„œ ์ด๊ฑฐ ์ƒ๊ธฐ๋ฉด ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ํ˜ธ์ถœ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4054", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. 1 ์ด์ƒ์œผ๋กœ ์ฃผ์„ธ์š”.", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4055", description = "BAD_REQUEST, ํŽ˜์ด์ง€ ์ธ๋ฑ์Šค ๋ฒ”์œ„ ์ดˆ๊ณผํ•จ", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "4101", description = "BAD_REQUEST, ํ•ด๋‹น recipeId๋ฅผ ๊ฐ€์ง„ recipe๊ฐ€ ์—†์–ด์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + @ApiResponse(responseCode = "5000", description = "SERVER ERROR, ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ์„ธ์š”", content = @Content(schema = @Schema(implementation = ResponseDto.class))), + }) + @Parameters({ + @Parameter(name = "member", hidden = true), + @Parameter(name = "pageIndex", description = "query string ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ, ์•ˆ์ฃผ๋ฉด 1์œผ๋กœ(์ตœ์ดˆ ํŽ˜์ด์ง€) ์„ค์ •ํ•จ, 0 ์ด๋Ÿฐ๊ฑฐ ์ฃผ๋ฉด ์—๋Ÿฌ ๋ฑ‰์Œ"), + }) + @GetMapping(value = "/members/recipes/{recipeId}/comments") + public ResponseDto searchRecipe(@PathVariable Long recipeId, @RequestParam(name = "pageIndex", required = false) Integer pageIndex, @AuthMember Member member) { + + if (pageIndex == null) + pageIndex = 1; + else if (pageIndex < 1) + throw new RecipeException(Code.UNDER_PAGE_INDEX_ERROR); + + pageIndex -= 1; + + Page comments = recipeService.commentList(pageIndex, recipeId, member); + + + log.info(comments.toString()); + + if (pageIndex >= comments.getTotalPages()) + throw new RecipeException(Code.OVER_PAGE_INDEX_ERROR); + + return ResponseDto.of(RecipeConverter.toPagingCommentDtoList(comments, member)); + } } diff --git a/src/main/java/zipdabang/server/web/dto/requestDto/RecipeRequestDto.java b/src/main/java/zipdabang/server/web/dto/requestDto/RecipeRequestDto.java index 65a5947..26c7700 100644 --- a/src/main/java/zipdabang/server/web/dto/requestDto/RecipeRequestDto.java +++ b/src/main/java/zipdabang/server/web/dto/requestDto/RecipeRequestDto.java @@ -35,4 +35,9 @@ public static class StepDto{ private Integer stepNum; private String description; } + + @Getter + public static class createCommentDto { + private String comment; + } } diff --git a/src/main/java/zipdabang/server/web/dto/responseDto/RecipeResponseDto.java b/src/main/java/zipdabang/server/web/dto/responseDto/RecipeResponseDto.java index f3149fa..1bb8ab4 100644 --- a/src/main/java/zipdabang/server/web/dto/responseDto/RecipeResponseDto.java +++ b/src/main/java/zipdabang/server/web/dto/responseDto/RecipeResponseDto.java @@ -135,7 +135,9 @@ public static class StepDto{ @AllArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED) public static class CommentDto{ - private String owner; + private String ownerNickname; + private String ownerImage; + private Boolean isOwner; private String content; private LocalDate createdAt; } @@ -177,4 +179,17 @@ public static class RecipeCategoryListDto{ List beverageCategoryList; Integer size; } + + @Builder + @Getter + @AllArgsConstructor(access = AccessLevel.PROTECTED) + @NoArgsConstructor(access = AccessLevel.PROTECTED) + public static class CommentPageListDto { + private List CommentList; + Long totalElements; + Integer currentPageElements; + Integer totalPage; + Boolean isFirst; + Boolean isLast; + } }