From 3d0d17a0f45fa0ed1637141654fe0fd33ed02e71 Mon Sep 17 00:00:00 2001 From: wugawuga Date: Mon, 4 Sep 2023 14:29:29 +0900 Subject: [PATCH 1/6] =?UTF-8?q?refactor:=20image=20url=EB=A7=8C=20?= =?UTF-8?q?=EB=B0=9B=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/application/MemberService.java | 14 ++-- .../com/funeat/member/dto/MemberRequest.java | 10 ++- .../presentation/MemberApiController.java | 11 ++- .../member/presentation/MemberController.java | 6 +- .../recipe/application/RecipeService.java | 17 ++--- .../recipe/dto/RecipeCreateRequest.java | 10 ++- .../presentation/RecipeApiController.java | 16 ++--- .../recipe/presentation/RecipeController.java | 6 +- .../review/application/ReviewService.java | 15 ++-- .../presentation/ReviewApiController.java | 16 ++--- .../review/presentation/ReviewController.java | 4 +- .../presentation/dto/ReviewCreateRequest.java | 10 ++- .../member/MemberAcceptanceTest.java | 25 +++---- .../funeat/acceptance/member/MemberSteps.java | 21 +++--- .../product/ProductAcceptanceTest.java | 17 ++--- .../recipe/RecipeAcceptanceTest.java | 68 ++++++++----------- .../funeat/acceptance/recipe/RecipeSteps.java | 22 ++---- .../review/ReviewAcceptanceTest.java | 48 +++++-------- .../funeat/acceptance/review/ReviewSteps.java | 19 ++---- .../com/funeat/fixture/RecipeFixture.java | 5 +- .../com/funeat/fixture/ReviewFixture.java | 4 +- .../member/application/MemberServiceTest.java | 34 ++++------ .../recipe/application/RecipeServiceTest.java | 37 ++++------ .../review/application/ReviewServiceTest.java | 30 +++----- 24 files changed, 181 insertions(+), 284 deletions(-) diff --git a/backend/src/main/java/com/funeat/member/application/MemberService.java b/backend/src/main/java/com/funeat/member/application/MemberService.java index b7c6412df..5eee409d7 100644 --- a/backend/src/main/java/com/funeat/member/application/MemberService.java +++ b/backend/src/main/java/com/funeat/member/application/MemberService.java @@ -5,7 +5,6 @@ import com.funeat.auth.dto.SignUserDto; import com.funeat.auth.dto.UserInfoDto; -import com.funeat.common.ImageService; import com.funeat.member.domain.Member; import com.funeat.member.dto.MemberProfileResponse; import com.funeat.member.dto.MemberRequest; @@ -15,18 +14,15 @@ import java.util.Objects; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; @Service @Transactional(readOnly = true) public class MemberService { private final MemberRepository memberRepository; - private final ImageService imageService; - public MemberService(final MemberRepository memberRepository, final ImageService imageService) { + public MemberService(final MemberRepository memberRepository) { this.memberRepository = memberRepository; - this.imageService = imageService; } @Transactional(propagation = REQUIRES_NEW) @@ -53,20 +49,18 @@ public MemberProfileResponse getMemberProfile(final Long memberId) { } @Transactional - public void modify(final Long memberId, final MultipartFile image, final MemberRequest request) { + public void modify(final Long memberId, final MemberRequest request) { final Member findMember = memberRepository.findById(memberId) .orElseThrow(() -> new MemberNotFoundException(MemberErrorCode.MEMBER_NOT_FOUND, memberId)); final String nickname = request.getNickname(); - if (Objects.isNull(image)) { + if (Objects.isNull(request.getImage())) { findMember.modifyName(nickname); return; } - final String newImageName = imageService.getRandomImageName(image); - findMember.modifyProfile(nickname, newImageName); - imageService.upload(image, newImageName); + findMember.modifyProfile(nickname, request.getImage()); } public String findPlatformId(final Long memberId) { diff --git a/backend/src/main/java/com/funeat/member/dto/MemberRequest.java b/backend/src/main/java/com/funeat/member/dto/MemberRequest.java index c8a2f9726..34b578900 100644 --- a/backend/src/main/java/com/funeat/member/dto/MemberRequest.java +++ b/backend/src/main/java/com/funeat/member/dto/MemberRequest.java @@ -1,6 +1,5 @@ package com.funeat.member.dto; -import com.fasterxml.jackson.annotation.JsonProperty; import javax.validation.constraints.NotBlank; public class MemberRequest { @@ -8,11 +7,18 @@ public class MemberRequest { @NotBlank(message = "닉네임을 확인해주세요") private final String nickname; - public MemberRequest(@JsonProperty("nickname") final String nickname) { + private final String image; + + public MemberRequest(final String nickname, final String image) { this.nickname = nickname; + this.image = image; } public String getNickname() { return nickname; } + + public String getImage() { + return image; + } } diff --git a/backend/src/main/java/com/funeat/member/presentation/MemberApiController.java b/backend/src/main/java/com/funeat/member/presentation/MemberApiController.java index b92740596..ac5e5ed16 100644 --- a/backend/src/main/java/com/funeat/member/presentation/MemberApiController.java +++ b/backend/src/main/java/com/funeat/member/presentation/MemberApiController.java @@ -12,14 +12,12 @@ import javax.validation.Valid; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; @RestController @RequestMapping("/api/members") @@ -46,13 +44,12 @@ public ResponseEntity getMemberProfile( return ResponseEntity.ok(response); } - @PutMapping(consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE}) + @PutMapping public ResponseEntity putMemberProfile(@AuthenticationPrincipal final LoginInfo loginInfo, - @RequestPart(required = false) final MultipartFile image, - @RequestPart @Valid final MemberRequest memberRequest) { + @RequestBody @Valid final MemberRequest memberRequest) { final Long memberId = loginInfo.getId(); - memberService.modify(memberId, image, memberRequest); + memberService.modify(memberId, memberRequest); return ResponseEntity.ok().build(); } diff --git a/backend/src/main/java/com/funeat/member/presentation/MemberController.java b/backend/src/main/java/com/funeat/member/presentation/MemberController.java index 304a1a5e4..b0e0ef1e4 100644 --- a/backend/src/main/java/com/funeat/member/presentation/MemberController.java +++ b/backend/src/main/java/com/funeat/member/presentation/MemberController.java @@ -14,8 +14,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.bind.annotation.RequestBody; @Tag(name = "05.Member", description = "사용자 기능") public interface MemberController { @@ -35,8 +34,7 @@ public interface MemberController { ) @PutMapping public ResponseEntity putMemberProfile(@AuthenticationPrincipal final LoginInfo loginInfo, - @RequestPart final MultipartFile image, - @RequestPart final MemberRequest request); + @RequestBody final MemberRequest request); @Operation(summary = "사용자 리뷰 조회", description = "사용자가 작성한 리뷰를 조회한다.") @ApiResponse( diff --git a/backend/src/main/java/com/funeat/recipe/application/RecipeService.java b/backend/src/main/java/com/funeat/recipe/application/RecipeService.java index 181fbf237..bd24ce5d0 100644 --- a/backend/src/main/java/com/funeat/recipe/application/RecipeService.java +++ b/backend/src/main/java/com/funeat/recipe/application/RecipeService.java @@ -5,7 +5,6 @@ import static com.funeat.product.exception.ProductErrorCode.PRODUCT_NOT_FOUND; import static com.funeat.recipe.exception.RecipeErrorCode.RECIPE_NOT_FOUND; -import com.funeat.common.ImageService; import com.funeat.common.dto.PageDto; import com.funeat.member.domain.Member; import com.funeat.member.domain.favorite.RecipeFavorite; @@ -45,7 +44,6 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; @Service @Transactional(readOnly = true) @@ -60,24 +58,21 @@ public class RecipeService { private final RecipeRepository recipeRepository; private final RecipeImageRepository recipeImageRepository; private final RecipeFavoriteRepository recipeFavoriteRepository; - private final ImageService imageService; public RecipeService(final MemberRepository memberRepository, final ProductRepository productRepository, final ProductRecipeRepository productRecipeRepository, final RecipeRepository recipeRepository, final RecipeImageRepository recipeImageRepository, - final RecipeFavoriteRepository recipeFavoriteRepository, - final ImageService imageService) { + final RecipeFavoriteRepository recipeFavoriteRepository) { this.memberRepository = memberRepository; this.productRepository = productRepository; this.productRecipeRepository = productRecipeRepository; this.recipeRepository = recipeRepository; this.recipeImageRepository = recipeImageRepository; this.recipeFavoriteRepository = recipeFavoriteRepository; - this.imageService = imageService; } @Transactional - public Long create(final Long memberId, final List images, final RecipeCreateRequest request) { + public Long create(final Long memberId, final RecipeCreateRequest request) { final Member member = memberRepository.findById(memberId) .orElseThrow(() -> new MemberNotFoundException(MEMBER_NOT_FOUND, memberId)); @@ -88,12 +83,8 @@ public Long create(final Long memberId, final List images, final .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, it))) .forEach(it -> productRecipeRepository.save(new ProductRecipe(it, savedRecipe))); - if (Objects.nonNull(images)) { - images.forEach(it -> { - final String newFileName = imageService.getRandomImageName(it); - recipeImageRepository.save(new RecipeImage(newFileName, savedRecipe)); - imageService.upload(it, newFileName); - }); + if (Objects.nonNull(request.getImages())) { + request.getImages().forEach(it -> recipeImageRepository.save(new RecipeImage(it, savedRecipe))); } return savedRecipe.getId(); diff --git a/backend/src/main/java/com/funeat/recipe/dto/RecipeCreateRequest.java b/backend/src/main/java/com/funeat/recipe/dto/RecipeCreateRequest.java index 201c28cf0..b49f09fdb 100644 --- a/backend/src/main/java/com/funeat/recipe/dto/RecipeCreateRequest.java +++ b/backend/src/main/java/com/funeat/recipe/dto/RecipeCreateRequest.java @@ -18,10 +18,14 @@ public class RecipeCreateRequest { @Size(max = 500, message = "꿀조합 내용은 최대 500자까지 입력 가능합니다") private final String content; - public RecipeCreateRequest(final String title, final List productIds, final String content) { + private final List images; + + public RecipeCreateRequest(final String title, final List productIds, final String content, + final List images) { this.title = title; this.productIds = productIds; this.content = content; + this.images = images; } public String getTitle() { @@ -35,4 +39,8 @@ public List getProductIds() { public String getContent() { return content; } + + public List getImages() { + return images; + } } diff --git a/backend/src/main/java/com/funeat/recipe/presentation/RecipeApiController.java b/backend/src/main/java/com/funeat/recipe/presentation/RecipeApiController.java index 445acbd08..8f782d69c 100644 --- a/backend/src/main/java/com/funeat/recipe/presentation/RecipeApiController.java +++ b/backend/src/main/java/com/funeat/recipe/presentation/RecipeApiController.java @@ -7,15 +7,13 @@ import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeDetailResponse; import com.funeat.recipe.dto.RecipeFavoriteRequest; -import com.funeat.recipe.dto.SortingRecipesResponse; import com.funeat.recipe.dto.SearchRecipeResultsResponse; +import com.funeat.recipe.dto.SortingRecipesResponse; import java.net.URI; -import java.util.List; import javax.validation.Valid; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; @@ -23,9 +21,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; @RestController public class RecipeApiController implements RecipeController { @@ -36,12 +32,10 @@ public RecipeApiController(final RecipeService recipeService) { this.recipeService = recipeService; } - @PostMapping(value = "/api/recipes", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, - MediaType.APPLICATION_JSON_VALUE}) + @PostMapping("/api/recipes") public ResponseEntity writeRecipe(@AuthenticationPrincipal final LoginInfo loginInfo, - @RequestPart(required = false) final List images, - @RequestPart @Valid final RecipeCreateRequest recipeRequest) { - final Long recipeId = recipeService.create(loginInfo.getId(), images, recipeRequest); + @RequestBody @Valid final RecipeCreateRequest recipeRequest) { + final Long recipeId = recipeService.create(loginInfo.getId(), recipeRequest); return ResponseEntity.created(URI.create("/api/recipes/" + recipeId)).build(); } @@ -73,7 +67,7 @@ public ResponseEntity likeRecipe(@AuthenticationPrincipal final LoginInfo @GetMapping("/api/ranks/recipes") public ResponseEntity getRankingRecipes() { final RankingRecipesResponse response = recipeService.getTop3Recipes(); - + return ResponseEntity.ok(response); } diff --git a/backend/src/main/java/com/funeat/recipe/presentation/RecipeController.java b/backend/src/main/java/com/funeat/recipe/presentation/RecipeController.java index a7494fded..8e74e5484 100644 --- a/backend/src/main/java/com/funeat/recipe/presentation/RecipeController.java +++ b/backend/src/main/java/com/funeat/recipe/presentation/RecipeController.java @@ -11,7 +11,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; -import java.util.List; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.http.ResponseEntity; @@ -21,8 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; @Tag(name = "07. Recipe", description = "꿀조합 관련 API 입니다.") public interface RecipeController { @@ -34,8 +31,7 @@ public interface RecipeController { ) @PostMapping ResponseEntity writeRecipe(@AuthenticationPrincipal LoginInfo loginInfo, - @RequestPart List images, - @RequestPart RecipeCreateRequest recipeRequest); + @RequestBody RecipeCreateRequest recipeRequest); @Operation(summary = "꿀조합 상세 조회", description = "꿀조합의 상세 정보를 조회한다.") @ApiResponse( diff --git a/backend/src/main/java/com/funeat/review/application/ReviewService.java b/backend/src/main/java/com/funeat/review/application/ReviewService.java index 5c10072c1..f6e33b07b 100644 --- a/backend/src/main/java/com/funeat/review/application/ReviewService.java +++ b/backend/src/main/java/com/funeat/review/application/ReviewService.java @@ -5,7 +5,6 @@ import static com.funeat.product.exception.ProductErrorCode.PRODUCT_NOT_FOUND; import static com.funeat.review.exception.ReviewErrorCode.REVIEW_NOT_FOUND; -import com.funeat.common.ImageService; import com.funeat.common.dto.PageDto; import com.funeat.member.domain.Member; import com.funeat.member.domain.favorite.ReviewFavorite; @@ -40,7 +39,6 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; @Service @Transactional(readOnly = true) @@ -55,40 +53,35 @@ public class ReviewService { private final MemberRepository memberRepository; private final ProductRepository productRepository; private final ReviewFavoriteRepository reviewFavoriteRepository; - private final ImageService imageService; public ReviewService(final ReviewRepository reviewRepository, final TagRepository tagRepository, final ReviewTagRepository reviewTagRepository, final MemberRepository memberRepository, final ProductRepository productRepository, - final ReviewFavoriteRepository reviewFavoriteRepository, final ImageService imageService) { + final ReviewFavoriteRepository reviewFavoriteRepository) { this.reviewRepository = reviewRepository; this.tagRepository = tagRepository; this.reviewTagRepository = reviewTagRepository; this.memberRepository = memberRepository; this.productRepository = productRepository; this.reviewFavoriteRepository = reviewFavoriteRepository; - this.imageService = imageService; } @Transactional - public void create(final Long productId, final Long memberId, final MultipartFile image, - final ReviewCreateRequest reviewRequest) { + public void create(final Long productId, final Long memberId, final ReviewCreateRequest reviewRequest) { final Member findMember = memberRepository.findById(memberId) .orElseThrow(() -> new MemberNotFoundException(MEMBER_NOT_FOUND, memberId)); final Product findProduct = productRepository.findById(productId) .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, productId)); final Review savedReview; - if (Objects.isNull(image)) { + if (Objects.isNull(reviewRequest.getImage())) { savedReview = reviewRepository.save( new Review(findMember, findProduct, reviewRequest.getRating(), reviewRequest.getContent(), reviewRequest.getRebuy())); } else { - final String newImageName = imageService.getRandomImageName(image); savedReview = reviewRepository.save( - new Review(findMember, findProduct, newImageName, reviewRequest.getRating(), + new Review(findMember, findProduct, reviewRequest.getImage(), reviewRequest.getRating(), reviewRequest.getContent(), reviewRequest.getRebuy())); - imageService.upload(image, newImageName); } final List findTags = tagRepository.findTagsByIdIn(reviewRequest.getTagIds()); diff --git a/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java b/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java index 3867b795c..96b201916 100644 --- a/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java +++ b/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java @@ -2,7 +2,6 @@ import com.funeat.auth.dto.LoginInfo; import com.funeat.auth.util.AuthenticationPrincipal; -import com.funeat.product.application.ProductService; import com.funeat.review.application.ReviewService; import com.funeat.review.presentation.dto.RankingReviewsResponse; import com.funeat.review.presentation.dto.ReviewCreateRequest; @@ -12,35 +11,28 @@ import javax.validation.Valid; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; @RestController public class ReviewApiController implements ReviewController { private final ReviewService reviewService; - private final ProductService productService; - public ReviewApiController(final ReviewService reviewService, final ProductService productService) { + public ReviewApiController(final ReviewService reviewService) { this.reviewService = reviewService; - this.productService = productService; } - @PostMapping(value = "/api/products/{productId}/reviews", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, - MediaType.APPLICATION_JSON_VALUE}) + @PostMapping("/api/products/{productId}/reviews") public ResponseEntity writeReview(@PathVariable final Long productId, @AuthenticationPrincipal final LoginInfo loginInfo, - @RequestPart(required = false) final MultipartFile image, - @RequestPart @Valid final ReviewCreateRequest reviewRequest) { - reviewService.create(productId, loginInfo.getId(), image, reviewRequest); + @RequestBody @Valid final ReviewCreateRequest reviewRequest) { + reviewService.create(productId, loginInfo.getId(), reviewRequest); return ResponseEntity.created(URI.create("/api/products/" + productId)).build(); } diff --git a/backend/src/main/java/com/funeat/review/presentation/ReviewController.java b/backend/src/main/java/com/funeat/review/presentation/ReviewController.java index dce29686e..b5ce0fa51 100644 --- a/backend/src/main/java/com/funeat/review/presentation/ReviewController.java +++ b/backend/src/main/java/com/funeat/review/presentation/ReviewController.java @@ -17,8 +17,6 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; @Tag(name = "03.Review", description = "리뷰관련 API 입니다.") public interface ReviewController { @@ -30,7 +28,7 @@ public interface ReviewController { ) @PostMapping ResponseEntity writeReview(@PathVariable Long productId, @AuthenticationPrincipal LoginInfo loginInfo, - @RequestPart MultipartFile image, @RequestPart ReviewCreateRequest reviewRequest); + @RequestBody ReviewCreateRequest reviewRequest); @Operation(summary = "리뷰 좋아요", description = "리뷰에 좋아요 또는 취소를 한다.") @ApiResponse( diff --git a/backend/src/main/java/com/funeat/review/presentation/dto/ReviewCreateRequest.java b/backend/src/main/java/com/funeat/review/presentation/dto/ReviewCreateRequest.java index aeda36555..a12521107 100644 --- a/backend/src/main/java/com/funeat/review/presentation/dto/ReviewCreateRequest.java +++ b/backend/src/main/java/com/funeat/review/presentation/dto/ReviewCreateRequest.java @@ -21,11 +21,15 @@ public class ReviewCreateRequest { @NotNull(message = "재구매 여부를 입력해주세요") private final Boolean rebuy; - public ReviewCreateRequest(final Long rating, final List tagIds, final String content, final Boolean rebuy) { + private final String image; + + public ReviewCreateRequest(final Long rating, final List tagIds, final String content, final Boolean rebuy, + final String image) { this.rating = rating; this.tagIds = tagIds; this.content = content; this.rebuy = rebuy; + this.image = image; } public Long getRating() { @@ -43,4 +47,8 @@ public Boolean getRebuy() { public List getTagIds() { return tagIds; } + + public String getImage() { + return image; + } } diff --git a/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java index 90a01078a..41e0a7964 100644 --- a/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java @@ -2,7 +2,6 @@ import static com.funeat.acceptance.auth.LoginSteps.로그인_쿠키를_얻는다; import static com.funeat.acceptance.common.CommonSteps.STATUS_CODE를_검증한다; -import static com.funeat.acceptance.common.CommonSteps.사진_명세_요청; import static com.funeat.acceptance.common.CommonSteps.인증되지_않음; import static com.funeat.acceptance.common.CommonSteps.잘못된_요청; import static com.funeat.acceptance.common.CommonSteps.정상_처리; @@ -93,11 +92,10 @@ class putMemberProfile_성공_테스트 { 단일_멤버_저장(member); final var loginCookie = 로그인_쿠키를_얻는다(); - final var image = 사진_명세_요청(); - final var request = new MemberRequest("after"); + final var request = new MemberRequest("after", "test.png"); // when - final var response = 사용자_정보_수정_요청(loginCookie, image, request); + final var response = 사용자_정보_수정_요청(loginCookie, request); // then STATUS_CODE를_검증한다(response, 정상_처리); @@ -110,11 +108,10 @@ class putMemberProfile_성공_테스트 { 단일_멤버_저장(member); final var loginCookie = 로그인_쿠키를_얻는다(); - final var image = 사진_명세_요청(); - final var request = new MemberRequest(member.getNickname()); + final var request = new MemberRequest(member.getNickname(), "test.png"); // when - final var response = 사용자_정보_수정_요청(loginCookie, image, request); + final var response = 사용자_정보_수정_요청(loginCookie, request); // then STATUS_CODE를_검증한다(response, 정상_처리); @@ -127,10 +124,10 @@ class putMemberProfile_성공_테스트 { 단일_멤버_저장(member); final var loginCookie = 로그인_쿠키를_얻는다(); - final var request = new MemberRequest("after"); + final var request = new MemberRequest("after", "test.png"); // when - final var response = 사용자_정보_수정_요청(loginCookie, null, request); + final var response = 사용자_정보_수정_요청(loginCookie, request); // then STATUS_CODE를_검증한다(response, 정상_처리); @@ -144,11 +141,10 @@ class putMemberProfile_실패_테스트 { @NullAndEmptySource void 로그인_하지않은_사용자가_사용자_정보_수정시_예외가_발생한다(final String cookie) { // given - final var image = 사진_명세_요청(); - final var request = new MemberRequest("after"); + final var request = new MemberRequest("after", "test.png"); // when - final var response = 사용자_정보_수정_요청(cookie, image, request); + final var response = 사용자_정보_수정_요청(cookie, request); // then STATUS_CODE를_검증한다(response, 인증되지_않음); @@ -163,11 +159,10 @@ class putMemberProfile_실패_테스트 { 단일_멤버_저장(member); final var loginCookie = 로그인_쿠키를_얻는다(); - final var image = 사진_명세_요청(); - final var request = new MemberRequest(nickname); + final var request = new MemberRequest(nickname, "test.png"); // when - final var response = 사용자_정보_수정_요청(loginCookie, image, request); + final var response = 사용자_정보_수정_요청(loginCookie, request); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); diff --git a/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java b/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java index a239e35ee..3c6d9de0c 100644 --- a/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java @@ -3,9 +3,9 @@ import static io.restassured.RestAssured.given; import com.funeat.member.dto.MemberRequest; +import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; -import io.restassured.specification.MultiPartSpecification; @SuppressWarnings("NonAsciiCharacters") public class MemberSteps { @@ -20,21 +20,16 @@ public class MemberSteps { } public static ExtractableResponse 사용자_정보_수정_요청(final String loginCookie, - final MultiPartSpecification image, - final MemberRequest request) { - final var requestSpec = given() - .cookie("FUNEAT", loginCookie); - - if (image != null) { - requestSpec.multiPart(image); - } - - return requestSpec - .multiPart("memberRequest", request, "application/json") - .body(request) + final MemberRequest memberRequest) { + return given() + .cookie("FUNEAT", loginCookie) + .contentType(ContentType.JSON) + .body(memberRequest) + .log().all() .when() .put("/api/members") .then() + .log().all() .extract(); } diff --git a/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java index 2dd1418d1..0270dc074 100644 --- a/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java @@ -2,7 +2,6 @@ import static com.funeat.acceptance.auth.LoginSteps.로그인_쿠키를_얻는다; import static com.funeat.acceptance.common.CommonSteps.STATUS_CODE를_검증한다; -import static com.funeat.acceptance.common.CommonSteps.사진_명세_요청; import static com.funeat.acceptance.common.CommonSteps.정상_처리; import static com.funeat.acceptance.common.CommonSteps.찾을수_없음; import static com.funeat.acceptance.product.ProductSteps.상품_검색_결과_조회_요청; @@ -490,17 +489,15 @@ class getProductDetail_성공_테스트 { final var tag3 = 태그_간식_ETC_생성(); 복수_태그_저장(tag1, tag2, tag3); - final var image = 사진_명세_요청(); - final var request1 = 리뷰추가요청_재구매X_생성(4L, 태그_아이디_변환(tag1, tag2, tag3)); final var request2 = 리뷰추가요청_재구매X_생성(4L, 태그_아이디_변환(tag2, tag3)); final var request3 = 리뷰추가요청_재구매X_생성(3L, 태그_아이디_변환(tag2)); final var loginCookie = 로그인_쿠키를_얻는다(); - 단일_리뷰_요청(productId, image, request1, loginCookie); - 단일_리뷰_요청(productId, image, request2, loginCookie); - 단일_리뷰_요청(productId, image, request3, loginCookie); + 단일_리뷰_요청(productId, request1, loginCookie); + 단일_리뷰_요청(productId, request2, loginCookie); + 단일_리뷰_요청(productId, request3, loginCookie); final var expectedReviewCount = 3L; final var expectedTags = List.of(tag2, tag3, tag1); @@ -697,17 +694,15 @@ class getSearchResults_성공_테스트 { final var tag2 = 태그_간식_ETC_생성(); 복수_태그_저장(tag1, tag2); - final var image = 사진_명세_요청(); - final var request1 = 리뷰추가요청_재구매X_생성(5L, 태그_아이디_변환(tag1, tag2)); final var request2 = 리뷰추가요청_재구매X_생성(5L, 태그_아이디_변환(tag1)); final var request3 = 리뷰추가요청_재구매X_생성(4L, 태그_아이디_변환(tag2)); final var loginCookie = 로그인_쿠키를_얻는다(); - 단일_리뷰_요청(product1.getId(), image, request1, loginCookie); - 단일_리뷰_요청(product1.getId(), image, request2, loginCookie); - 단일_리뷰_요청(product2.getId(), image, request3, loginCookie); + 단일_리뷰_요청(product1.getId(), request1, loginCookie); + 단일_리뷰_요청(product1.getId(), request2, loginCookie); + 단일_리뷰_요청(product2.getId(), request3, loginCookie); final var pageDto = new PageDto(2L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); diff --git a/backend/src/test/java/com/funeat/acceptance/recipe/RecipeAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/recipe/RecipeAcceptanceTest.java index 12ac70045..8a83edbdd 100644 --- a/backend/src/test/java/com/funeat/acceptance/recipe/RecipeAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/recipe/RecipeAcceptanceTest.java @@ -59,8 +59,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.NullAndEmptySource; -import org.junit.jupiter.params.provider.NullSource; -import org.junit.jupiter.params.provider.ValueSource; @SuppressWarnings("NonAsciiCharacters") public class RecipeAcceptanceTest extends AcceptanceTest { @@ -85,12 +83,10 @@ class writeRecipe_성공_테스트 { final var productIds = 상품_아이디_변환(product1, product2, product3); final var request = 레시피추가요청_생성(productIds); - final var images = 여러_사진_요청(3); - final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 레시피_생성_요청(request, images, loginCookie); + final var response = 레시피_생성_요청(request, loginCookie); // then STATUS_CODE를_검증한다(response, 정상_생성); @@ -113,7 +109,7 @@ class writeRecipe_성공_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 레시피_생성_요청(request, null, loginCookie); + final var response = 레시피_생성_요청(request, loginCookie); // then STATUS_CODE를_검증한다(response, 정상_생성); @@ -141,7 +137,7 @@ class writeRecipe_실패_테스트 { final var images = 여러_사진_요청(3); // when - final var response = 레시피_생성_요청(request, images, cookie); + final var response = 레시피_생성_요청(request, cookie); // then final var expectedCode = LOGIN_MEMBER_NOT_FOUND.getCode(); @@ -164,14 +160,13 @@ class writeRecipe_실패_테스트 { 복수_상품_저장(product1, product2, product3); final var productIds = 상품_아이디_변환(product1, product2, product3); - final var request = new RecipeCreateRequest(title, productIds, "밥 추가, 밥 추가, 밥 추가.. 끝!!"); - - final var images = 여러_사진_요청(3); + final var request = new RecipeCreateRequest(title, productIds, "밥 추가, 밥 추가, 밥 추가.. 끝!!", + List.of("test1.png", "test2.png")); final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 레시피_생성_요청(request, images, loginCookie); + final var response = 레시피_생성_요청(request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -184,14 +179,15 @@ class writeRecipe_실패_테스트 { @Test void 사용자가_레시피_작성할때_상품들이_NULL일시_예외가_발생한다() { // given - final var request = new RecipeCreateRequest("title", null, "밥 추가, 밥 추가, 밥 추가.. 끝!!"); + final var request = new RecipeCreateRequest("title", null, "밥 추가, 밥 추가, 밥 추가.. 끝!!", + List.of("test1.png", "test2.png")); final var images = 여러_사진_요청(3); final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 레시피_생성_요청(request, images, loginCookie); + final var response = 레시피_생성_요청(request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -204,14 +200,15 @@ class writeRecipe_실패_테스트 { @Test void 사용자가_레시피_작성할때_상품들이_비어있을시_예외가_발생한다() { // given - final var request = new RecipeCreateRequest("title", Collections.emptyList(), "밥 추가, 밥 추가, 밥 추가.. 끝!!"); + final var request = new RecipeCreateRequest("title", Collections.emptyList(), "밥 추가, 밥 추가, 밥 추가.. 끝!!", + List.of("test1.png", "test2.png")); final var images = 여러_사진_요청(3); final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 레시피_생성_요청(request, images, loginCookie); + final var response = 레시피_생성_요청(request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -235,14 +232,12 @@ class writeRecipe_실패_테스트 { final var productIds = 상품_아이디_변환(product1, product2, product3); - final var request = new RecipeCreateRequest("title", productIds, content); - - final var images = 여러_사진_요청(3); + final var request = new RecipeCreateRequest("title", productIds, content, List.of("test.png")); final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 레시피_생성_요청(request, images, loginCookie); + final var response = 레시피_생성_요청(request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -271,8 +266,8 @@ class writeRecipe_실패_테스트 { // when final var maxContent = "tests".repeat(100) + "a"; - final var request = new RecipeCreateRequest("title", productIds, maxContent); - final var response = 레시피_생성_요청(request, images, loginCookie); + final var request = new RecipeCreateRequest("title", productIds, maxContent, List.of("test.png")); + final var response = 레시피_생성_요청(request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -303,8 +298,7 @@ class getRecipeDetail_성공_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); final var createRequest = 레시피추가요청_생성(productIds); - final var images = 여러_사진_요청(3); - final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, images, loginCookie); + final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, loginCookie); final var recipe = recipeRepository.findById(recipeId).get(); final var findImages = recipeImageRepository.findByRecipe(recipe); @@ -340,8 +334,7 @@ class getRecipeDetail_실패_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); final var createRequest = 레시피추가요청_생성(productIds); - final var images = 여러_사진_요청(3); - final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, images, loginCookie); + final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, loginCookie); // when final var response = 레시피_상세_정보_요청(cookie, recipeId); @@ -390,8 +383,7 @@ class likeRecipe_성공_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); final var createRequest = 레시피추가요청_생성(productIds); - final var images = 여러_사진_요청(3); - final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, images, loginCookie); + final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, loginCookie); final var favoriteRequest = 레시피좋아요요청_생성(true); @@ -421,8 +413,7 @@ class likeRecipe_성공_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); final var createRequest = 레시피추가요청_생성(productIds); - final var images = 여러_사진_요청(3); - final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, images, loginCookie); + final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, loginCookie); final var favoriteRequest = 레시피좋아요요청_생성(true); 레시피_좋아요_요청(loginCookie, recipeId, favoriteRequest); @@ -459,8 +450,7 @@ class likeRecipe_실패_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); final var createRequest = 레시피추가요청_생성(productIds); - final var images = 여러_사진_요청(3); - final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, images, loginCookie); + final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, loginCookie); final var favoriteRequest = 레시피좋아요요청_생성(true); @@ -493,8 +483,7 @@ class likeRecipe_실패_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); final var createRequest = 레시피추가요청_생성(productIds); - final var images = 여러_사진_요청(3); - final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, images, loginCookie); + final var recipeId = 레시피_추가_요청하고_id_반환(createRequest, loginCookie); final var favoriteRequest = 레시피좋아요요청_생성(null); @@ -549,9 +538,8 @@ class getSearchResults_성공_테스트 { final var createRequest1 = 레시피추가요청_생성(productIds1); final var createRequest2 = 레시피추가요청_생성(productIds2); - final var images = 여러_사진_요청(3); - final var recipeId1 = 레시피_추가_요청하고_id_반환(createRequest1, images, loginCookie); - final var recipeId2 = 레시피_추가_요청하고_id_반환(createRequest2, images, loginCookie); + final var recipeId1 = 레시피_추가_요청하고_id_반환(createRequest1, loginCookie); + final var recipeId2 = 레시피_추가_요청하고_id_반환(createRequest2, loginCookie); final var pageDto = new PageDto(2L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); @@ -583,8 +571,7 @@ class getSearchResults_성공_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); final var createRequest1 = 레시피추가요청_생성(productIds1); - final var images = 여러_사진_요청(3); - final var recipeId1 = 레시피_추가_요청하고_id_반환(createRequest1, images, loginCookie); + final var recipeId1 = 레시피_추가_요청하고_id_반환(createRequest1, loginCookie); final var pageDto = new PageDto(1L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); @@ -617,10 +604,9 @@ class getSearchResults_성공_테스트 { final var createRequest1 = 레시피추가요청_생성(productIds1); final var createRequest2 = 레시피추가요청_생성(productIds2); - final var images = 여러_사진_요청(3); - 레시피_생성_요청(createRequest1, images, loginCookie); - 레시피_생성_요청(createRequest2, images, loginCookie); + 레시피_생성_요청(createRequest1, loginCookie); + 레시피_생성_요청(createRequest2, loginCookie); final var pageDto = new PageDto(0L, 0L, true, true, FIRST_PAGE, PAGE_SIZE); final var expected = Collections.emptyList(); diff --git a/backend/src/test/java/com/funeat/acceptance/recipe/RecipeSteps.java b/backend/src/test/java/com/funeat/acceptance/recipe/RecipeSteps.java index fd4c437ba..9cd266a16 100644 --- a/backend/src/test/java/com/funeat/acceptance/recipe/RecipeSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/recipe/RecipeSteps.java @@ -5,11 +5,11 @@ import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeFavoriteRequest; import io.restassured.builder.MultiPartSpecBuilder; +import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; import io.restassured.specification.MultiPartSpecification; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -17,27 +17,19 @@ public class RecipeSteps { public static ExtractableResponse 레시피_생성_요청(final RecipeCreateRequest recipeRequest, - final List images, final String loginCookie) { - final var requestSpec = given() - .cookie("FUNEAT", loginCookie); - - if (Objects.nonNull(images) && !images.isEmpty()) { - images.forEach(requestSpec::multiPart); - } - - return requestSpec - .multiPart("recipeRequest", recipeRequest, "application/json") + return given() + .cookie("FUNEAT", loginCookie) + .body(recipeRequest) + .contentType(ContentType.JSON) .when() .post("/api/recipes") .then() .extract(); } - public static Long 레시피_추가_요청하고_id_반환(final RecipeCreateRequest recipeRequest, - final List imageList, - final String loginCookie) { - final var response = 레시피_생성_요청(recipeRequest, imageList, loginCookie); + public static Long 레시피_추가_요청하고_id_반환(final RecipeCreateRequest recipeRequest, final String loginCookie) { + final var response = 레시피_생성_요청(recipeRequest, loginCookie); return Long.parseLong(response.header("Location").split("/")[3]); } diff --git a/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java index cba717909..2a2c134aa 100644 --- a/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java @@ -80,12 +80,11 @@ class writeReview_성공_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var request = 리뷰추가요청_재구매O_생성(4L, tagIds); final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 단일_리뷰_요청(productId, image, request, loginCookie); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then STATUS_CODE를_검증한다(response, 정상_생성); @@ -110,7 +109,7 @@ class writeReview_성공_테스트 { final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var response = 단일_리뷰_요청(productId, null, request, loginCookie); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then STATUS_CODE를_검증한다(response, 정상_생성); @@ -140,7 +139,7 @@ class writeReview_실패_테스트 { final var request = 리뷰추가요청_재구매O_생성(4L, tagIds); // when - final var response = 단일_리뷰_요청(productId, image, request, cookie); + final var response = 단일_리뷰_요청(productId, request, cookie); // then final var expectedCode = LOGIN_MEMBER_NOT_FOUND.getCode(); @@ -159,12 +158,11 @@ class writeReview_실패_테스트 { final var product = 상품_삼각김밥_가격1000원_평점3점_생성(category); final var productId = 단일_상품_저장(product); - final var image = 사진_명세_요청(); final var loginCookie = 로그인_쿠키를_얻는다(); // when final var request = 리뷰추가요청_재구매O_생성(4L, null); - final var response = 단일_리뷰_요청(productId, image, request, loginCookie); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -183,12 +181,11 @@ class writeReview_실패_테스트 { final var product = 상품_삼각김밥_가격1000원_평점3점_생성(category); final var productId = 단일_상품_저장(product); - final var image = 사진_명세_요청(); final var loginCookie = 로그인_쿠키를_얻는다(); // when final var request = 리뷰추가요청_재구매O_생성(4L, Collections.emptyList()); - final var response = 단일_리뷰_요청(productId, image, request, loginCookie); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -213,12 +210,11 @@ class writeReview_실패_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var loginCookie = 로그인_쿠키를_얻는다(); // when final var request = 리뷰추가요청_재구매O_생성(null, tagIds); - final var response = 단일_리뷰_요청(productId, image, request, loginCookie); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -244,12 +240,11 @@ class writeReview_실패_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var request = new ReviewCreateRequest(1L, tagIds, content, true); - final var response = 단일_리뷰_요청(productId, image, request, loginCookie); + final var request = new ReviewCreateRequest(1L, tagIds, content, true, "test.png"); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -274,12 +269,11 @@ class writeReview_실패_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var loginCookie = 로그인_쿠키를_얻는다(); // when - final var request = new ReviewCreateRequest(1L, tagIds, "content", null); - final var response = 단일_리뷰_요청(productId, image, request, loginCookie); + final var request = new ReviewCreateRequest(1L, tagIds, "content", null, "test.png"); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -304,13 +298,12 @@ class writeReview_실패_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var loginCookie = 로그인_쿠키를_얻는다(); // when final var maxContent = "test".repeat(50) + "a"; - final var request = new ReviewCreateRequest(1L, tagIds, maxContent, true); - final var response = 단일_리뷰_요청(productId, image, request, loginCookie); + final var request = new ReviewCreateRequest(1L, tagIds, maxContent, true, "test.png"); + final var response = 단일_리뷰_요청(productId, request, loginCookie); // then final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); @@ -342,10 +335,9 @@ class toggleLikeReview_성공_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var reviewRequest = 리뷰추가요청_재구매O_생성(4L, tagIds); final var loginCookie = 로그인_쿠키를_얻는다(); - 단일_리뷰_요청(productId, image, reviewRequest, loginCookie); + 단일_리뷰_요청(productId, reviewRequest, loginCookie); final var reviewId = reviewRepository.findAll().get(0).getId(); final var favoriteRequest = 리뷰좋아요요청_true_생성(); @@ -377,11 +369,10 @@ class toggleLikeReview_성공_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var reviewRequest = 리뷰추가요청_재구매O_생성(4L, tagIds); final var loginCookie = 로그인_쿠키를_얻는다(); - 단일_리뷰_요청(productId, image, reviewRequest, loginCookie); + 단일_리뷰_요청(productId, reviewRequest, loginCookie); final var reviewId = reviewRepository.findAll().get(0).getId(); @@ -417,12 +408,11 @@ class toggleLikeReview_성공_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청("first"); final var reviewRequest = 리뷰추가요청_재구매O_생성(4L, tagIds); final var loginCookie = 로그인_쿠키를_얻는다(); - 단일_리뷰_요청(productId, image, reviewRequest, loginCookie); - 단일_리뷰_요청(productId, null, reviewRequest, loginCookie); + 단일_리뷰_요청(productId, reviewRequest, loginCookie); + 단일_리뷰_요청(productId, reviewRequest, loginCookie); final var firstReview = reviewRepository.findById(1L).get(); final var firstReviewId = firstReview.getId(); @@ -468,10 +458,9 @@ class toggleLikeReview_실패_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var reviewRequest = 리뷰추가요청_재구매O_생성(4L, tagIds); final var loginCookie = 로그인_쿠키를_얻는다(); - 단일_리뷰_요청(productId, image, reviewRequest, loginCookie); + 단일_리뷰_요청(productId, reviewRequest, loginCookie); final var reviewId = reviewRepository.findAll().get(0).getId(); final var favoriteRequest = 리뷰좋아요요청_true_생성(); @@ -505,10 +494,9 @@ class toggleLikeReview_실패_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 사진_명세_요청(); final var reviewRequest = 리뷰추가요청_재구매O_생성(4L, tagIds); final var loginCookie = 로그인_쿠키를_얻는다(); - 단일_리뷰_요청(productId, image, reviewRequest, loginCookie); + 단일_리뷰_요청(productId, reviewRequest, loginCookie); final var reviewId = reviewRepository.findAll().get(0).getId(); diff --git a/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java b/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java index 42018f394..1101bb519 100644 --- a/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java @@ -4,24 +4,19 @@ import com.funeat.review.presentation.dto.ReviewCreateRequest; import com.funeat.review.presentation.dto.ReviewFavoriteRequest; +import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; -import io.restassured.specification.MultiPartSpecification; @SuppressWarnings("NonAsciiCharacters") public class ReviewSteps { - public static ExtractableResponse 단일_리뷰_요청(final Long productId, final MultiPartSpecification image, - final ReviewCreateRequest request, final String loginCookie) { - final var requestSpec = given() - .cookie("FUNEAT", loginCookie); - - if (image != null) { - requestSpec.multiPart(image); - } - - return requestSpec - .multiPart("reviewRequest", request, "application/json") + public static ExtractableResponse 단일_리뷰_요청(final Long productId, final ReviewCreateRequest request, + final String loginCookie) { + return given() + .cookie("FUNEAT", loginCookie) + .body(request) + .contentType(ContentType.JSON) .when() .post("/api/products/{productId}/reviews", productId) .then() diff --git a/backend/src/test/java/com/funeat/fixture/RecipeFixture.java b/backend/src/test/java/com/funeat/fixture/RecipeFixture.java index 438d863bb..b584f8a10 100644 --- a/backend/src/test/java/com/funeat/fixture/RecipeFixture.java +++ b/backend/src/test/java/com/funeat/fixture/RecipeFixture.java @@ -18,13 +18,14 @@ public class RecipeFixture { public static Recipe 레시피_생성(final Member member, final Long favoriteCount) { return new Recipe("제일로 맛있는 레시피", "밥 추가, 밥 추가, 밥 추가.. 끝!!", member, favoriteCount); } - + public static RecipeFavorite 레시피_좋아요_생성(final Member member, final Recipe recipe, final Boolean favorite) { return new RecipeFavorite(member, recipe, favorite); } public static RecipeCreateRequest 레시피추가요청_생성(final List productIds) { - return new RecipeCreateRequest("제일로 맛있는 레시피", productIds, "밥 추가, 밥 추가, 밥 추가.. 끝!!"); + return new RecipeCreateRequest("제일로 맛있는 레시피", productIds, "밥 추가, 밥 추가, 밥 추가.. 끝!!", + List.of("test1.png", "test2.png")); } public static RecipeFavoriteRequest 레시피좋아요요청_생성(final Boolean favorite) { diff --git a/backend/src/test/java/com/funeat/fixture/ReviewFixture.java b/backend/src/test/java/com/funeat/fixture/ReviewFixture.java index 0b6346411..c3e85e08c 100644 --- a/backend/src/test/java/com/funeat/fixture/ReviewFixture.java +++ b/backend/src/test/java/com/funeat/fixture/ReviewFixture.java @@ -55,11 +55,11 @@ public class ReviewFixture { } public static ReviewCreateRequest 리뷰추가요청_재구매O_생성(final Long rating, final List tagIds) { - return new ReviewCreateRequest(rating, tagIds, "test", true); + return new ReviewCreateRequest(rating, tagIds, "test", true, "test.png"); } public static ReviewCreateRequest 리뷰추가요청_재구매X_생성(final Long rating, final List tagIds) { - return new ReviewCreateRequest(rating, tagIds, "test", false); + return new ReviewCreateRequest(rating, tagIds, "test", false, "test.png"); } public static ReviewFavoriteRequest 리뷰좋아요요청_true_생성() { diff --git a/backend/src/test/java/com/funeat/member/application/MemberServiceTest.java b/backend/src/test/java/com/funeat/member/application/MemberServiceTest.java index 4d4a03e17..4271f3866 100644 --- a/backend/src/test/java/com/funeat/member/application/MemberServiceTest.java +++ b/backend/src/test/java/com/funeat/member/application/MemberServiceTest.java @@ -1,6 +1,5 @@ package com.funeat.member.application; -import static com.funeat.fixture.ImageFixture.이미지_생성; import static com.funeat.fixture.MemberFixture.멤버_멤버1_생성; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -14,7 +13,6 @@ import com.funeat.member.exception.MemberException.MemberUpdateException; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.springframework.mock.web.MockMultipartFile; @SuppressWarnings("NonAsciiCharacters") class MemberServiceTest extends ServiceTest { @@ -123,8 +121,7 @@ class modify_성공_테스트 { void 닉네임과_프로필_사진이_그대로면_사용자_정보는_바뀌지_않는다() { // given final var nickname = "member1"; - final var image = new MockMultipartFile("image", "www.member1.com", "image/jpeg", new byte[]{1, 2, 3}); - final var request = new MemberRequest(nickname); + final var request = new MemberRequest(nickname, "www.member1.com"); final var member = 멤버_멤버1_생성(); final var memberId = 단일_멤버_저장(member); @@ -134,7 +131,7 @@ class modify_성공_테스트 { final var expectedProfileImage = expected.getProfileImage(); // when - memberService.modify(memberId, image, request); + memberService.modify(memberId, request); final var actual = memberRepository.findById(memberId).get(); final var actualNickname = actual.getNickname(); final var actualProfileImage = actual.getProfileImage(); @@ -151,10 +148,8 @@ class modify_성공_테스트 { @Test void 닉네임만_바뀌고_프로필_사진은_그대로면_닉네임만_바뀐다() { // given - final var profileImage = new MockMultipartFile("image", "www.member1.com", "image/jpeg", - new byte[]{1, 2, 3}); final var afterNickname = "after"; - final var request = new MemberRequest(afterNickname); + final var request = new MemberRequest(afterNickname, "www.member1.com"); final var member = 멤버_멤버1_생성(); final var memberId = 단일_멤버_저장(member); @@ -164,7 +159,7 @@ class modify_성공_테스트 { final var expectedProfileImage = expected.getProfileImage(); // when - memberService.modify(memberId, profileImage, request); + memberService.modify(memberId, request); final var actual = memberRepository.findById(memberId).get(); final var actualNickname = actual.getNickname(); final var actualProfileImage = actual.getProfileImage(); @@ -182,8 +177,8 @@ class modify_성공_테스트 { void 닉네임은_그대로이고_프로필_사진이_바뀌면_프로필_사진만_바뀐다() { // given final var nickname = "member1"; - final var afterProfileImage = 이미지_생성(); - final var request = new MemberRequest(nickname); + final var afterProfileImage = "after.png"; + final var request = new MemberRequest(nickname, afterProfileImage); final var member = 멤버_멤버1_생성(); final var memberId = 단일_멤버_저장(member); @@ -193,7 +188,7 @@ class modify_성공_테스트 { final var expectedProfileImage = expected.getProfileImage(); // when - memberService.modify(memberId, afterProfileImage, request); + memberService.modify(memberId, request); final var actual = memberRepository.findById(memberId).get(); final var actualNickname = actual.getNickname(); final var actualProfileImage = actual.getProfileImage(); @@ -211,9 +206,8 @@ class modify_성공_테스트 { void 닉네임과_프로필_사진_모두_바뀌면_모두_바뀐다() { // given final var afterNickname = "after"; - final var afterProfileImage = 이미지_생성(); - final var request = new MemberRequest(afterNickname); + final var request = new MemberRequest(afterNickname, "after.png"); final var member = 멤버_멤버1_생성(); final var memberId = 단일_멤버_저장(member); @@ -223,7 +217,7 @@ class modify_성공_테스트 { final var expectedProfileImage = expected.getProfileImage(); // when - memberService.modify(memberId, afterProfileImage, request); + memberService.modify(memberId, request); final var actual = memberRepository.findById(memberId).get(); final var actualNickname = actual.getNickname(); final var actualProfileImage = actual.getProfileImage(); @@ -245,15 +239,14 @@ class modify_실패_테스트 { void 존재하지않는_멤버를_수정하면_예외가_발생한다() { // given final var afterNickname = "after"; - final var afterProfileImage = 이미지_생성(); final var member = 멤버_멤버1_생성(); final var wrongMemberId = 단일_멤버_저장(member) + 1L; - final var request = new MemberRequest(afterNickname); + final var request = new MemberRequest(afterNickname, "test.png"); // when - assertThatThrownBy(() -> memberService.modify(wrongMemberId, afterProfileImage, request)) + assertThatThrownBy(() -> memberService.modify(wrongMemberId, request)) .isInstanceOf(MemberNotFoundException.class); } @@ -263,11 +256,10 @@ class modify_실패_테스트 { final var member = 멤버_멤버1_생성(); final var memberId = 단일_멤버_저장(member); - final var request = new MemberRequest(null); - final var image = 이미지_생성(); + final var request = new MemberRequest(null, "test.png"); // when & then - assertThatThrownBy(() -> memberService.modify(memberId, image, request)) + assertThatThrownBy(() -> memberService.modify(memberId, request)) .isInstanceOf(MemberUpdateException.class); } } diff --git a/backend/src/test/java/com/funeat/recipe/application/RecipeServiceTest.java b/backend/src/test/java/com/funeat/recipe/application/RecipeServiceTest.java index 046932495..cfe26bd17 100644 --- a/backend/src/test/java/com/funeat/recipe/application/RecipeServiceTest.java +++ b/backend/src/test/java/com/funeat/recipe/application/RecipeServiceTest.java @@ -74,7 +74,7 @@ class create_성공_테스트 { final var expected = 레시피_생성(member); // when - final var recipeId = recipeService.create(memberId, images, request); + final var recipeId = recipeService.create(memberId, request); final var actual = recipeRepository.findById(recipeId).get(); // then @@ -98,13 +98,11 @@ class create_성공_테스트 { 단일_멤버_저장(author); final var authorId = author.getId(); - final var images = 여러_이미지_생성(3); - final var productIds = List.of(product1.getId(), product2.getId(), product3.getId()); final var request = new RecipeCreateRequest("제일로 맛있는 레시피", productIds, - "우선 밥을 넣어요. 그리고 밥을 또 넣어요. 그리고 밥을 또 넣으면.. 끝!!"); + "우선 밥을 넣어요. 그리고 밥을 또 넣어요. 그리고 밥을 또 넣으면.. 끝!!", List.of("test.png")); - final var recipeId = recipeService.create(authorId, images, request); + final var recipeId = recipeService.create(authorId, request); // when final var actual = recipeService.getRecipeDetail(authorId, recipeId); @@ -137,12 +135,10 @@ class create_실패_테스트 { final var member = 멤버_멤버1_생성(); final var wrongMemberId = 단일_멤버_저장(member) + 1L; - final var images = 여러_이미지_생성(3); - final var request = 레시피추가요청_생성(productIds); // when & then - assertThatThrownBy(() -> recipeService.create(wrongMemberId, images, request)) + assertThatThrownBy(() -> recipeService.create(wrongMemberId, request)) .isInstanceOf(MemberNotFoundException.class); } @@ -162,12 +158,10 @@ class create_실패_테스트 { final var member = 멤버_멤버1_생성(); final var memberId = 단일_멤버_저장(member); - final var images = 여러_이미지_생성(3); - final var request = 레시피추가요청_생성(wrongProductIds); // when & then - assertThatThrownBy(() -> recipeService.create(memberId, images, request)) + assertThatThrownBy(() -> recipeService.create(memberId, request)) .isInstanceOf(ProductNotFoundException.class); } } @@ -354,7 +348,8 @@ class getSortingRecipes_성공_테스트 { final var actual = recipeService.getSortingRecipes(page).getRecipes(); final var expected = List.of( RecipeDto.toDto(recipe1_3, List.of(), List.of()), - RecipeDto.toDto(recipe1_2, List.of(recipeImage1_2_1, recipeImage1_2_2), List.of(product1, product3)), + RecipeDto.toDto(recipe1_2, List.of(recipeImage1_2_1, recipeImage1_2_2), + List.of(product1, product3)), RecipeDto.toDto(recipe1_1, List.of(recipeImage1_1_1), List.of(product1, product2, product3))); // then @@ -403,7 +398,8 @@ class getSortingRecipes_성공_테스트 { final var actual = recipeService.getSortingRecipes(page).getRecipes(); final var expected = List.of( RecipeDto.toDto(recipe1_1, List.of(recipeImage1_1_1), List.of(product1, product2, product3)), - RecipeDto.toDto(recipe1_2, List.of(recipeImage1_2_1, recipeImage1_2_2), List.of(product1, product3)), + RecipeDto.toDto(recipe1_2, List.of(recipeImage1_2_1, recipeImage1_2_2), + List.of(product1, product3)), RecipeDto.toDto(recipe1_3, List.of(), List.of())); // then @@ -412,7 +408,8 @@ class getSortingRecipes_성공_테스트 { .isEqualTo(expected); } } - + + @Nested class likeRecipe_성공_테스트 { @Test @@ -432,10 +429,8 @@ class likeRecipe_성공_테스트 { final var member = 멤버_멤버2_생성(); final var memberId = 단일_멤버_저장(member); - final var images = 여러_이미지_생성(3); - final var createRequest = 레시피추가요청_생성(productIds); - final var recipeId = recipeService.create(authorId, images, createRequest); + final var recipeId = recipeService.create(authorId, createRequest); // when final var favoriteRequest = 레시피좋아요요청_생성(true); @@ -470,10 +465,8 @@ class likeRecipe_성공_테스트 { final var member = 멤버_멤버2_생성(); final var memberId = 단일_멤버_저장(member); - final var images = 여러_이미지_생성(3); - final var createRequest = 레시피추가요청_생성(productIds); - final var recipeId = recipeService.create(authorId, images, createRequest); + final var recipeId = recipeService.create(authorId, createRequest); final var favoriteRequest = 레시피좋아요요청_생성(true); recipeService.likeRecipe(memberId, recipeId, favoriteRequest); @@ -514,10 +507,8 @@ class likeRecipe_실패_테스트 { final var authorId = 단일_멤버_저장(author); final var wrongMemberId = authorId + 1L; - final var images = 여러_이미지_생성(3); - final var createRequest = 레시피추가요청_생성(productIds); - final var recipeId = recipeService.create(authorId, images, createRequest); + final var recipeId = recipeService.create(authorId, createRequest); // when & then final var favoriteRequest = 레시피좋아요요청_생성(true); diff --git a/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java b/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java index e97b5c345..852f1b84e 100644 --- a/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java +++ b/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java @@ -1,7 +1,6 @@ package com.funeat.review.application; import static com.funeat.fixture.CategoryFixture.카테고리_즉석조리_생성; -import static com.funeat.fixture.ImageFixture.이미지_생성; import static com.funeat.fixture.MemberFixture.멤버_멤버1_생성; import static com.funeat.fixture.MemberFixture.멤버_멤버2_생성; import static com.funeat.fixture.MemberFixture.멤버_멤버3_생성; @@ -39,6 +38,7 @@ import com.funeat.product.exception.ProductException.ProductNotFoundException; import com.funeat.review.domain.Review; import com.funeat.review.exception.ReviewException.ReviewNotFoundException; +import com.funeat.review.presentation.dto.ReviewCreateRequest; import com.funeat.review.presentation.dto.SortingReviewDto; import com.funeat.tag.domain.Tag; import java.util.List; @@ -70,15 +70,13 @@ class create_성공_테스트 { 복수_태그_저장(tag1, tag2); final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 이미지_생성(); - final var imageFileName = image.getOriginalFilename(); final var request = 리뷰추가요청_재구매O_생성(4L, tagIds); - final var expected = new Review(member, product, imageFileName, 4L, "test", true); + final var expected = new Review(member, product, "test.png", 4L, "test", true); // when - reviewService.create(productId, memberId, image, request); + reviewService.create(productId, memberId, request); final var actual = reviewRepository.findAll().get(0); // then @@ -105,12 +103,12 @@ class create_성공_테스트 { final var tagIds = 태그_아이디_변환(tag1, tag2); - final var request = 리뷰추가요청_재구매O_생성(4L, tagIds); + final var request = new ReviewCreateRequest(4L, tagIds, "test", true, null); final var expected = new Review(member, product, null, 4L, "test", true); // when - reviewService.create(productId, memberId, null, request); + reviewService.create(productId, memberId, request); final var actual = reviewRepository.findAll().get(0); // then @@ -140,12 +138,11 @@ class create_실패_테스트 { 복수_태그_저장(tag1, tag2); final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 이미지_생성(); final var request = 리뷰추가요청_재구매O_생성(4L, tagIds); // when & then - assertThatThrownBy(() -> reviewService.create(productId, wrongMemberId, image, request)) + assertThatThrownBy(() -> reviewService.create(productId, wrongMemberId, request)) .isInstanceOf(MemberNotFoundException.class); } @@ -166,12 +163,11 @@ class create_실패_테스트 { 복수_태그_저장(tag1, tag2); final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 이미지_생성(); final var request = 리뷰추가요청_재구매O_생성(4L, tagIds); // when & then - assertThatThrownBy(() -> reviewService.create(wrongProductId, memberId, image, request)) + assertThatThrownBy(() -> reviewService.create(wrongProductId, memberId, request)) .isInstanceOf(ProductNotFoundException.class); } } @@ -196,9 +192,8 @@ class likeReview_성공_테스트 { 복수_태그_저장(tag1, tag2); final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 이미지_생성(); final var reviewCreaterequest = 리뷰추가요청_재구매O_생성(4L, tagIds); - reviewService.create(productId, memberId, image, reviewCreaterequest); + reviewService.create(productId, memberId, reviewCreaterequest); final var review = reviewRepository.findAll().get(0); final var reviewId = review.getId(); @@ -237,9 +232,8 @@ class likeReview_성공_테스트 { 복수_태그_저장(tag1, tag2); final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 이미지_생성(); final var reviewCreaterequest = 리뷰추가요청_재구매O_생성(4L, tagIds); - reviewService.create(productId, memberId, image, reviewCreaterequest); + reviewService.create(productId, memberId, reviewCreaterequest); final var review = reviewRepository.findAll().get(0); final var reviewId = review.getId(); @@ -285,9 +279,8 @@ class likeReview_실패_테스트 { 복수_태그_저장(tag1, tag2); final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 이미지_생성(); final var reviewCreaterequest = 리뷰추가요청_재구매O_생성(4L, tagIds); - reviewService.create(productId, memberId, image, reviewCreaterequest); + reviewService.create(productId, memberId, reviewCreaterequest); final var review = reviewRepository.findAll().get(0); final var reviewId = review.getId(); @@ -316,9 +309,8 @@ class likeReview_실패_테스트 { 복수_태그_저장(tag1, tag2); final var tagIds = 태그_아이디_변환(tag1, tag2); - final var image = 이미지_생성(); final var reviewCreaterequest = 리뷰추가요청_재구매O_생성(4L, tagIds); - reviewService.create(productId, memberId, image, reviewCreaterequest); + reviewService.create(productId, memberId, reviewCreaterequest); final var review = reviewRepository.findAll().get(0); final var reviewId = review.getId(); From e2e8851b2eb4f3fe8c3ffead7b26ffa2861580fc Mon Sep 17 00:00:00 2001 From: wugawuga Date: Mon, 4 Sep 2023 14:34:30 +0900 Subject: [PATCH 2/6] =?UTF-8?q?remove:=20image=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/funeat/common/ImageService.java | 10 ---- .../java/com/funeat/common/ImageUploader.java | 34 -------------- .../java/com/funeat/common/ServiceTest.java | 3 -- .../com/funeat/common/TestImageUploader.java | 46 ------------------- .../member/application/TestMemberService.java | 5 +- 5 files changed, 2 insertions(+), 96 deletions(-) delete mode 100644 backend/src/main/java/com/funeat/common/ImageService.java delete mode 100644 backend/src/main/java/com/funeat/common/ImageUploader.java delete mode 100644 backend/src/test/java/com/funeat/common/TestImageUploader.java diff --git a/backend/src/main/java/com/funeat/common/ImageService.java b/backend/src/main/java/com/funeat/common/ImageService.java deleted file mode 100644 index 99121cd52..000000000 --- a/backend/src/main/java/com/funeat/common/ImageService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.funeat.common; - -import org.springframework.web.multipart.MultipartFile; - -public interface ImageService { - - void upload(final MultipartFile image, final String newFileName); - - String getRandomImageName(MultipartFile image); -} diff --git a/backend/src/main/java/com/funeat/common/ImageUploader.java b/backend/src/main/java/com/funeat/common/ImageUploader.java deleted file mode 100644 index 46cc2e3e2..000000000 --- a/backend/src/main/java/com/funeat/common/ImageUploader.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.funeat.common; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.UUID; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; - -@Component -@Profile("!test") -public class ImageUploader implements ImageService { - - @Value("${image.path}") - private String imagePath; - - @Override - public void upload(final MultipartFile image, final String newFileName) { - final Path path = Paths.get(imagePath + newFileName); - try { - Files.write(path, image.getBytes()); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public String getRandomImageName(final MultipartFile image) { - return UUID.randomUUID() + image.getOriginalFilename(); - } -} diff --git a/backend/src/test/java/com/funeat/common/ServiceTest.java b/backend/src/test/java/com/funeat/common/ServiceTest.java index 8b9a24acb..f8b58e5a2 100644 --- a/backend/src/test/java/com/funeat/common/ServiceTest.java +++ b/backend/src/test/java/com/funeat/common/ServiceTest.java @@ -99,9 +99,6 @@ public abstract class ServiceTest { @Autowired protected ProductService productService; - @Autowired - protected ImageService imageService; - @Autowired protected ReviewService reviewService; diff --git a/backend/src/test/java/com/funeat/common/TestImageUploader.java b/backend/src/test/java/com/funeat/common/TestImageUploader.java deleted file mode 100644 index bde764294..000000000 --- a/backend/src/test/java/com/funeat/common/TestImageUploader.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.funeat.common; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Comparator; -import java.util.stream.Stream; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; - -@Component -@Profile("test") -public class TestImageUploader implements ImageService { - - @Override - public void upload(final MultipartFile image, final String newImageName) { - // 실제로 IO 작업을 수행하는 대신, 임시 디렉토리로 복사하도록 수정 - try { - final String temporaryPath = String.valueOf(System.currentTimeMillis()); - final Path tempDirectoryPath = Files.createTempDirectory(temporaryPath); - final Path filePath = tempDirectoryPath.resolve(image.getOriginalFilename()); - Files.copy(image.getInputStream(), filePath); - - deleteDirectory(tempDirectoryPath); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public String getRandomImageName(final MultipartFile image) { - return image.getOriginalFilename(); - } - - private void deleteDirectory(Path directory) throws IOException { - // 디렉토리 내부 파일 및 디렉토리 삭제 - try (Stream pathStream = Files.walk(directory)) { - pathStream.sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - Files.deleteIfExists(directory); - } -} diff --git a/backend/src/test/java/com/funeat/member/application/TestMemberService.java b/backend/src/test/java/com/funeat/member/application/TestMemberService.java index 3ac2f4623..705b5258d 100644 --- a/backend/src/test/java/com/funeat/member/application/TestMemberService.java +++ b/backend/src/test/java/com/funeat/member/application/TestMemberService.java @@ -2,7 +2,6 @@ import com.funeat.auth.dto.SignUserDto; import com.funeat.auth.dto.UserInfoDto; -import com.funeat.common.ImageService; import com.funeat.member.persistence.MemberRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -10,8 +9,8 @@ @Service public class TestMemberService extends MemberService { - public TestMemberService(final MemberRepository memberRepository, final ImageService imageService) { - super(memberRepository, imageService); + public TestMemberService(final MemberRepository memberRepository) { + super(memberRepository); } @Override From a6c626b0f855906b6e08b216fa24199352b29584 Mon Sep 17 00:00:00 2001 From: wugawuga Date: Mon, 4 Sep 2023 14:35:31 +0900 Subject: [PATCH 3/6] =?UTF-8?q?remove:=20yml=20image=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/application-dev.yml | 3 --- backend/src/main/resources/application-local.yml | 3 --- backend/src/main/resources/application-prod.yml | 3 --- 3 files changed, 9 deletions(-) diff --git a/backend/src/main/resources/application-dev.yml b/backend/src/main/resources/application-dev.yml index bf17cf129..026ad9f63 100644 --- a/backend/src/main/resources/application-dev.yml +++ b/backend/src/main/resources/application-dev.yml @@ -13,9 +13,6 @@ spring: format_sql: true show_sql: true -image: - path: { DEV_IMAGE_PATH } - kakao: rest-api-key: { DEV_REST_API_KEY } redirect-uri: { DEV_REDIRECT_URI } diff --git a/backend/src/main/resources/application-local.yml b/backend/src/main/resources/application-local.yml index 034072422..2f71c6e2a 100644 --- a/backend/src/main/resources/application-local.yml +++ b/backend/src/main/resources/application-local.yml @@ -17,9 +17,6 @@ logging: level: org.hibernate.type.descriptor.sql: trace -image: - path: - kakao: rest-api-key: { LOCAL_REST_API_KEY } redirect-uri: { LOCAL_REDIRECT_URI } diff --git a/backend/src/main/resources/application-prod.yml b/backend/src/main/resources/application-prod.yml index e1e01ec3b..d2c0a9790 100644 --- a/backend/src/main/resources/application-prod.yml +++ b/backend/src/main/resources/application-prod.yml @@ -12,9 +12,6 @@ spring: hibernate: show_sql: true -image: - path: { PROD_IMAGE_PATH } - kakao: rest-api-key: { PROD_REST_API_KEY } redirect-uri: { PROD_REDIRECT_URI } From 687475e4417b8f3d958368bb2d4a0c969a2082ec Mon Sep 17 00:00:00 2001 From: wugawuga Date: Tue, 5 Sep 2023 17:44:57 +0900 Subject: [PATCH 4/6] =?UTF-8?q?refactor:=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/application/MemberService.java | 10 +-------- .../com/funeat/member/dto/MemberRequest.java | 1 + .../recipe/application/RecipeService.java | 8 +++---- .../member/MemberAcceptanceTest.java | 21 +++++++++++++++++++ .../funeat/acceptance/member/MemberSteps.java | 2 -- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/com/funeat/member/application/MemberService.java b/backend/src/main/java/com/funeat/member/application/MemberService.java index 5eee409d7..09c83dc7e 100644 --- a/backend/src/main/java/com/funeat/member/application/MemberService.java +++ b/backend/src/main/java/com/funeat/member/application/MemberService.java @@ -11,7 +11,6 @@ import com.funeat.member.exception.MemberErrorCode; import com.funeat.member.exception.MemberException.MemberNotFoundException; import com.funeat.member.persistence.MemberRepository; -import java.util.Objects; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -53,14 +52,7 @@ public void modify(final Long memberId, final MemberRequest request) { final Member findMember = memberRepository.findById(memberId) .orElseThrow(() -> new MemberNotFoundException(MemberErrorCode.MEMBER_NOT_FOUND, memberId)); - final String nickname = request.getNickname(); - - if (Objects.isNull(request.getImage())) { - findMember.modifyName(nickname); - return; - } - - findMember.modifyProfile(nickname, request.getImage()); + findMember.modifyProfile(request.getNickname(), request.getImage()); } public String findPlatformId(final Long memberId) { diff --git a/backend/src/main/java/com/funeat/member/dto/MemberRequest.java b/backend/src/main/java/com/funeat/member/dto/MemberRequest.java index 34b578900..aafc727a2 100644 --- a/backend/src/main/java/com/funeat/member/dto/MemberRequest.java +++ b/backend/src/main/java/com/funeat/member/dto/MemberRequest.java @@ -7,6 +7,7 @@ public class MemberRequest { @NotBlank(message = "닉네임을 확인해주세요") private final String nickname; + @NotBlank(message = "이미지를 확인해주세요") private final String image; public MemberRequest(final String nickname, final String image) { diff --git a/backend/src/main/java/com/funeat/recipe/application/RecipeService.java b/backend/src/main/java/com/funeat/recipe/application/RecipeService.java index bd24ce5d0..e28806e6f 100644 --- a/backend/src/main/java/com/funeat/recipe/application/RecipeService.java +++ b/backend/src/main/java/com/funeat/recipe/application/RecipeService.java @@ -79,12 +79,12 @@ public Long create(final Long memberId, final RecipeCreateRequest request) { final Recipe savedRecipe = recipeRepository.save(new Recipe(request.getTitle(), request.getContent(), member)); request.getProductIds() .stream() - .map(it -> productRepository.findById(it) - .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, it))) - .forEach(it -> productRecipeRepository.save(new ProductRecipe(it, savedRecipe))); + .map(productId -> productRepository.findById(productId) + .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, productId))) + .forEach(product -> productRecipeRepository.save(new ProductRecipe(product, savedRecipe))); if (Objects.nonNull(request.getImages())) { - request.getImages().forEach(it -> recipeImageRepository.save(new RecipeImage(it, savedRecipe))); + request.getImages().forEach(image -> recipeImageRepository.save(new RecipeImage(image, savedRecipe))); } return savedRecipe.getId(); diff --git a/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java index 41e0a7964..2bba879fb 100644 --- a/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java @@ -171,6 +171,27 @@ class putMemberProfile_실패_테스트 { STATUS_CODE를_검증한다(response, 잘못된_요청); RESPONSE_CODE와_MESSAGE를_검증한다(response, expectedCode, expectedMessage); } + + @ParameterizedTest + @NullAndEmptySource + void 사용자가_사용자_정보_수정할때_이미지_미기입시_예외가_발생한다(final String image) { + // given + final var member = 멤버_멤버1_생성(); + 단일_멤버_저장(member); + + final var loginCookie = 로그인_쿠키를_얻는다(); + final var request = new MemberRequest("test", image); + + // when + final var response = 사용자_정보_수정_요청(loginCookie, request); + + // then + final var expectedCode = REQUEST_VALID_ERROR_CODE.getCode(); + final var expectedMessage = "이미지를 확인해주세요. " + REQUEST_VALID_ERROR_CODE.getMessage(); + + STATUS_CODE를_검증한다(response, 잘못된_요청); + RESPONSE_CODE와_MESSAGE를_검증한다(response, expectedCode, expectedMessage); + } } @Nested diff --git a/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java b/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java index 3c6d9de0c..dac149f52 100644 --- a/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java @@ -25,11 +25,9 @@ public class MemberSteps { .cookie("FUNEAT", loginCookie) .contentType(ContentType.JSON) .body(memberRequest) - .log().all() .when() .put("/api/members") .then() - .log().all() .extract(); } From 173f3ec4970ad868f0e5eaa0e4f9e7f933bc9651 Mon Sep 17 00:00:00 2001 From: wugawuga Date: Tue, 5 Sep 2023 17:45:15 +0900 Subject: [PATCH 5/6] =?UTF-8?q?refactor:=20review=20dto=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/funeat/review/application/ReviewService.java | 12 ++++++------ .../{presentation => }/dto/RankingReviewDto.java | 2 +- .../dto/RankingReviewsResponse.java | 2 +- .../{presentation => }/dto/ReviewCreateRequest.java | 2 +- .../dto/ReviewFavoriteRequest.java | 2 +- .../{presentation => }/dto/SortingReviewDto.java | 2 +- .../dto/SortingReviewsResponse.java | 2 +- .../review/presentation/ReviewApiController.java | 8 ++++---- .../funeat/review/presentation/ReviewController.java | 8 ++++---- .../acceptance/review/ReviewAcceptanceTest.java | 8 ++++---- .../com/funeat/acceptance/review/ReviewSteps.java | 4 ++-- .../test/java/com/funeat/fixture/ReviewFixture.java | 4 ++-- .../funeat/review/application/ReviewServiceTest.java | 4 ++-- 13 files changed, 30 insertions(+), 30 deletions(-) rename backend/src/main/java/com/funeat/review/{presentation => }/dto/RankingReviewDto.java (97%) rename backend/src/main/java/com/funeat/review/{presentation => }/dto/RankingReviewsResponse.java (91%) rename backend/src/main/java/com/funeat/review/{presentation => }/dto/ReviewCreateRequest.java (97%) rename backend/src/main/java/com/funeat/review/{presentation => }/dto/ReviewFavoriteRequest.java (91%) rename backend/src/main/java/com/funeat/review/{presentation => }/dto/SortingReviewDto.java (98%) rename backend/src/main/java/com/funeat/review/{presentation => }/dto/SortingReviewsResponse.java (93%) diff --git a/backend/src/main/java/com/funeat/review/application/ReviewService.java b/backend/src/main/java/com/funeat/review/application/ReviewService.java index f6e33b07b..b22b75386 100644 --- a/backend/src/main/java/com/funeat/review/application/ReviewService.java +++ b/backend/src/main/java/com/funeat/review/application/ReviewService.java @@ -19,15 +19,15 @@ import com.funeat.product.persistence.ProductRepository; import com.funeat.review.domain.Review; import com.funeat.review.domain.ReviewTag; +import com.funeat.review.dto.RankingReviewDto; +import com.funeat.review.dto.RankingReviewsResponse; +import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.SortingReviewDto; +import com.funeat.review.dto.SortingReviewsResponse; import com.funeat.review.exception.ReviewException.ReviewNotFoundException; import com.funeat.review.persistence.ReviewRepository; import com.funeat.review.persistence.ReviewTagRepository; -import com.funeat.review.presentation.dto.RankingReviewDto; -import com.funeat.review.presentation.dto.RankingReviewsResponse; -import com.funeat.review.presentation.dto.ReviewCreateRequest; -import com.funeat.review.presentation.dto.ReviewFavoriteRequest; -import com.funeat.review.presentation.dto.SortingReviewDto; -import com.funeat.review.presentation.dto.SortingReviewsResponse; import com.funeat.tag.domain.Tag; import com.funeat.tag.persistence.TagRepository; import java.util.List; diff --git a/backend/src/main/java/com/funeat/review/presentation/dto/RankingReviewDto.java b/backend/src/main/java/com/funeat/review/dto/RankingReviewDto.java similarity index 97% rename from backend/src/main/java/com/funeat/review/presentation/dto/RankingReviewDto.java rename to backend/src/main/java/com/funeat/review/dto/RankingReviewDto.java index 14057f8df..f862e8c3e 100644 --- a/backend/src/main/java/com/funeat/review/presentation/dto/RankingReviewDto.java +++ b/backend/src/main/java/com/funeat/review/dto/RankingReviewDto.java @@ -1,4 +1,4 @@ -package com.funeat.review.presentation.dto; +package com.funeat.review.dto; import com.funeat.review.domain.Review; diff --git a/backend/src/main/java/com/funeat/review/presentation/dto/RankingReviewsResponse.java b/backend/src/main/java/com/funeat/review/dto/RankingReviewsResponse.java similarity index 91% rename from backend/src/main/java/com/funeat/review/presentation/dto/RankingReviewsResponse.java rename to backend/src/main/java/com/funeat/review/dto/RankingReviewsResponse.java index c5971de0e..fd2befb0a 100644 --- a/backend/src/main/java/com/funeat/review/presentation/dto/RankingReviewsResponse.java +++ b/backend/src/main/java/com/funeat/review/dto/RankingReviewsResponse.java @@ -1,4 +1,4 @@ -package com.funeat.review.presentation.dto; +package com.funeat.review.dto; import java.util.List; diff --git a/backend/src/main/java/com/funeat/review/presentation/dto/ReviewCreateRequest.java b/backend/src/main/java/com/funeat/review/dto/ReviewCreateRequest.java similarity index 97% rename from backend/src/main/java/com/funeat/review/presentation/dto/ReviewCreateRequest.java rename to backend/src/main/java/com/funeat/review/dto/ReviewCreateRequest.java index a12521107..4499e98cd 100644 --- a/backend/src/main/java/com/funeat/review/presentation/dto/ReviewCreateRequest.java +++ b/backend/src/main/java/com/funeat/review/dto/ReviewCreateRequest.java @@ -1,4 +1,4 @@ -package com.funeat.review.presentation.dto; +package com.funeat.review.dto; import java.util.List; import javax.validation.constraints.NotBlank; diff --git a/backend/src/main/java/com/funeat/review/presentation/dto/ReviewFavoriteRequest.java b/backend/src/main/java/com/funeat/review/dto/ReviewFavoriteRequest.java similarity index 91% rename from backend/src/main/java/com/funeat/review/presentation/dto/ReviewFavoriteRequest.java rename to backend/src/main/java/com/funeat/review/dto/ReviewFavoriteRequest.java index 973462d64..ea3017304 100644 --- a/backend/src/main/java/com/funeat/review/presentation/dto/ReviewFavoriteRequest.java +++ b/backend/src/main/java/com/funeat/review/dto/ReviewFavoriteRequest.java @@ -1,4 +1,4 @@ -package com.funeat.review.presentation.dto; +package com.funeat.review.dto; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/backend/src/main/java/com/funeat/review/presentation/dto/SortingReviewDto.java b/backend/src/main/java/com/funeat/review/dto/SortingReviewDto.java similarity index 98% rename from backend/src/main/java/com/funeat/review/presentation/dto/SortingReviewDto.java rename to backend/src/main/java/com/funeat/review/dto/SortingReviewDto.java index 60e06c41b..7254dd6c1 100644 --- a/backend/src/main/java/com/funeat/review/presentation/dto/SortingReviewDto.java +++ b/backend/src/main/java/com/funeat/review/dto/SortingReviewDto.java @@ -1,4 +1,4 @@ -package com.funeat.review.presentation.dto; +package com.funeat.review.dto; import com.funeat.member.domain.Member; import com.funeat.member.domain.favorite.ReviewFavorite; diff --git a/backend/src/main/java/com/funeat/review/presentation/dto/SortingReviewsResponse.java b/backend/src/main/java/com/funeat/review/dto/SortingReviewsResponse.java similarity index 93% rename from backend/src/main/java/com/funeat/review/presentation/dto/SortingReviewsResponse.java rename to backend/src/main/java/com/funeat/review/dto/SortingReviewsResponse.java index f6bc38118..caf1ea155 100644 --- a/backend/src/main/java/com/funeat/review/presentation/dto/SortingReviewsResponse.java +++ b/backend/src/main/java/com/funeat/review/dto/SortingReviewsResponse.java @@ -1,4 +1,4 @@ -package com.funeat.review.presentation.dto; +package com.funeat.review.dto; import com.funeat.common.dto.PageDto; import java.util.List; diff --git a/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java b/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java index 96b201916..f98d5e43e 100644 --- a/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java +++ b/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java @@ -3,10 +3,10 @@ import com.funeat.auth.dto.LoginInfo; import com.funeat.auth.util.AuthenticationPrincipal; import com.funeat.review.application.ReviewService; -import com.funeat.review.presentation.dto.RankingReviewsResponse; -import com.funeat.review.presentation.dto.ReviewCreateRequest; -import com.funeat.review.presentation.dto.ReviewFavoriteRequest; -import com.funeat.review.presentation.dto.SortingReviewsResponse; +import com.funeat.review.dto.RankingReviewsResponse; +import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.SortingReviewsResponse; import java.net.URI; import javax.validation.Valid; import org.springframework.data.domain.Pageable; diff --git a/backend/src/main/java/com/funeat/review/presentation/ReviewController.java b/backend/src/main/java/com/funeat/review/presentation/ReviewController.java index b5ce0fa51..5abf69ac8 100644 --- a/backend/src/main/java/com/funeat/review/presentation/ReviewController.java +++ b/backend/src/main/java/com/funeat/review/presentation/ReviewController.java @@ -2,10 +2,10 @@ import com.funeat.auth.dto.LoginInfo; import com.funeat.auth.util.AuthenticationPrincipal; -import com.funeat.review.presentation.dto.RankingReviewsResponse; -import com.funeat.review.presentation.dto.ReviewCreateRequest; -import com.funeat.review.presentation.dto.ReviewFavoriteRequest; -import com.funeat.review.presentation.dto.SortingReviewsResponse; +import com.funeat.review.dto.RankingReviewsResponse; +import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.SortingReviewsResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java index 2a2c134aa..93994f40b 100644 --- a/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java @@ -43,10 +43,10 @@ import com.funeat.member.domain.favorite.ReviewFavorite; import com.funeat.product.domain.Product; import com.funeat.review.domain.Review; -import com.funeat.review.presentation.dto.RankingReviewDto; -import com.funeat.review.presentation.dto.ReviewCreateRequest; -import com.funeat.review.presentation.dto.ReviewFavoriteRequest; -import com.funeat.review.presentation.dto.SortingReviewDto; +import com.funeat.review.dto.RankingReviewDto; +import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.SortingReviewDto; import com.funeat.tag.domain.Tag; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java b/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java index 1101bb519..755f07bb3 100644 --- a/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java @@ -2,8 +2,8 @@ import static io.restassured.RestAssured.given; -import com.funeat.review.presentation.dto.ReviewCreateRequest; -import com.funeat.review.presentation.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewFavoriteRequest; import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/backend/src/test/java/com/funeat/fixture/ReviewFixture.java b/backend/src/test/java/com/funeat/fixture/ReviewFixture.java index c3e85e08c..7322a5ac8 100644 --- a/backend/src/test/java/com/funeat/fixture/ReviewFixture.java +++ b/backend/src/test/java/com/funeat/fixture/ReviewFixture.java @@ -3,8 +3,8 @@ import com.funeat.member.domain.Member; import com.funeat.product.domain.Product; import com.funeat.review.domain.Review; -import com.funeat.review.presentation.dto.ReviewCreateRequest; -import com.funeat.review.presentation.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewFavoriteRequest; import java.util.List; @SuppressWarnings("NonAsciiCharacters") diff --git a/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java b/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java index 852f1b84e..bdb785ea2 100644 --- a/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java +++ b/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java @@ -37,9 +37,9 @@ import com.funeat.member.exception.MemberException.MemberNotFoundException; import com.funeat.product.exception.ProductException.ProductNotFoundException; import com.funeat.review.domain.Review; +import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.SortingReviewDto; import com.funeat.review.exception.ReviewException.ReviewNotFoundException; -import com.funeat.review.presentation.dto.ReviewCreateRequest; -import com.funeat.review.presentation.dto.SortingReviewDto; import com.funeat.tag.domain.Tag; import java.util.List; import java.util.stream.Collectors; From 79faa901559849aaca71ec2dbc62313ca60dc6de Mon Sep 17 00:00:00 2001 From: wugawuga Date: Tue, 5 Sep 2023 20:35:25 +0900 Subject: [PATCH 6/6] =?UTF-8?q?remove:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=EA=B4=80=EB=A0=A8=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/build.gradle b/backend/build.gradle index 3fa3ef4b5..2eae6dabc 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -25,8 +25,6 @@ dependencies { testRuntimeOnly 'com.h2database:h2' implementation 'org.springdoc:springdoc-openapi-ui:1.7.0' - implementation 'commons-fileupload:commons-fileupload:1.5' - implementation 'commons-io:commons-io:2.11.0' implementation 'com.github.maricn:logback-slack-appender:1.4.0' implementation 'org.springframework.boot:spring-boot-starter-actuator'