diff --git a/README.md b/README.md index ffd189097..a3819192f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,107 @@ -# 2023-fun-eat +
-## ํŒ€์› ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ +
-| Frontend | Frontend | Frontend | -|:-------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------:| -| ํƒ€๋ฏธ | ํ•ด์˜จ | ํ™ฉํŽญ | -| [ํƒ€๋ฏธ](https://github.com/xodms0309) | [ํ•ด์˜จ](https://github.com/hae-on) | [ํ™ฉํŽญ](https://github.com/Leejin-Yang) | + -| Backend | Backend | Backend | Backend | -|:--------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------:| -| ๋กœ๊ฑด | ๋ง๊ณ  | ์˜ค์ž‰ | ์šฐ๊ฐ€ | -| [๋กœ๊ฑด](https://github.com/70825) | [๋ง๊ณ ](https://github.com/Go-Jaecheol) | [์˜ค์ž‰](https://github.com/hanueleee) | [์šฐ๊ฐ€](https://github.com/wugawuga) | +
+
-


+๊ถ๊ธˆํ•ด? ๋ง›์žˆ์„๊ฑธ? ๋จน์–ด๋ด!
+๐Ÿ™ ํŽธ์˜์  ์Œ์‹ ๋ฆฌ๋ทฐ & ๊ฟ€์กฐํ•ฉ ๊ณต์œ  ์„œ๋น„์Šค ๐Ÿ™
+ +
+ +[![Application](http://img.shields.io/badge/funeat.site-D8EAFF?style=for-the-badge&logo=aHR0cHM6Ly9naXRodWIuY29tL3dvb3dhY291cnNlLXRlYW1zLzIwMjMtZnVuLWVhdC9hc3NldHMvODA0NjQ5NjEvOWI1OWY3NzktY2M5MS00MTJhLWE3NDUtZGQ3M2IzY2UxZGNk&logoColor=black&link=https://funeat.site/)](https://funeat.site/) +[![WIKI](http://img.shields.io/badge/-GitHub%20WiKi-FFEC99?style=for-the-badge&logoColor=black&link=https://github.com/woowacourse-teams/2023-fun-eat/wiki)](https://github.com/woowacourse-teams/2023-fun-eat/wiki) +[![Release](https://img.shields.io/github/v/release/woowacourse-teams/2023-fun-eat?style=for-the-badge&color=FFCFCF)](https://github.com/woowacourse-teams/2023-fun-eat/releases/tag/v1.3.0) + +
+ +
+ +# ๐Ÿฅ„ ์„œ๋น„์Šค ์†Œ๊ฐœ + +![1_๋ฉ”์ธํŽ˜์ด์ง€](https://github.com/woowacourse-teams/2023-fun-eat/assets/55427367/9663f7b5-cd38-4f06-86fb-c6636fc364c6) + +
+ +## 1. ํŽธ์˜์ ๋งˆ๋‹ค ํŠน์ƒ‰์žˆ๋Š” ์Œ์‹ ๊ถ๊ธˆํ•ด? + +![5_์ƒํ’ˆ๋ชฉ๋ก](https://github.com/woowacourse-teams/2023-fun-eat/assets/55427367/03fb9955-61fa-4228-a270-ce9dffc710c6) +![6_์ƒํ’ˆ์ƒ์„ธ](https://github.com/woowacourse-teams/2023-fun-eat/assets/55427367/694bc8db-74bd-4fa1-b499-900cd27f5028) +![4_๊ฒ€์ƒ‰](https://github.com/woowacourse-teams/2023-fun-eat/assets/55427367/6a157e08-79d8-450b-9511-ffa461000a22) + +
+
+ +## 2. ์†”์งํ•œ ๋ฆฌ๋ทฐ๋ฅผ ๋ณด๋ฉด ๋” ๋ง›์žˆ์„๊ฑธ? + +![2_๋ฆฌ๋ทฐ](https://github.com/woowacourse-teams/2023-fun-eat/assets/55427367/4bf5ecd7-df08-45d0-b592-8629f3a4e3e6) + +
+
+ +## 3. ์ƒ๊ฐ์ง€ ๋ชปํ–ˆ๋˜ ๊ฟ€์กฐํ•ฉ, ๋จน์–ด๋ด! + +![3_๊ฟ€์กฐํ•ฉ](https://github.com/woowacourse-teams/2023-fun-eat/assets/55427367/8e560b40-d039-47ce-ad29-5e244cba4bf2) + +
+
+ +# ๐Ÿ› ๏ธ ๊ธฐ์ˆ  ์Šคํƒ + +### ๋ฐฑ์—”๋“œ + +
+ BE_๊ธฐ์ˆ ์Šคํƒ +
+ +
+ +### ํ”„๋ก ํŠธ์—”๋“œ + +
+ FE_๊ธฐ์ˆ ์Šคํƒ +
+ +
+ +### ์ธํ”„๋ผ + +
+ ์ธํ”„๋ผ_๊ธฐ์ˆ ์Šคํƒ +
+ +
+
+ +# ์ธํ”„๋ผ ๊ตฌ์กฐ + +### CI/CD + +
+ cicd +
+ +### ๊ตฌ์กฐ + +
+ ์ธํ”„๋ผ ๊ตฌ์กฐ +
+ +
+
+ +# ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ ํŒ€์› + +| Frontend | Frontend | Frontend | Backend | Backend | Backend | Backend | +| :-------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | +| ํƒ€๋ฏธ | ํ•ด์˜จ | ํ™ฉํŽญ | ๋กœ๊ฑด | ๋ง๊ณ  | ์˜ค์ž‰ | ์šฐ๊ฐ€ | +| [๐Ÿฐ ํƒ€๋ฏธ](https://github.com/xodms0309) | [๐ŸŒž ํ•ด์˜จ](https://github.com/hae-on) | [๐Ÿง ํ™ฉํŽญ](https://github.com/Leejin-Yang) | [๐Ÿ˜บ ๋กœ๊ฑด](https://github.com/70825) | [๐Ÿฅญ ๋ง๊ณ ](https://github.com/Go-Jaecheol) | [๐Ÿ‘ป ์˜ค์ž‰](https://github.com/hanueleee) | [๐Ÿ– ์šฐ๊ฐ€](https://github.com/wugawuga) | + +
+ +
+ ํŒ€์†Œ๊ฐœ +
diff --git a/backend/build.gradle b/backend/build.gradle index 8a0ad47dd..3d46c806e 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -31,6 +31,8 @@ dependencies { runtimeOnly 'io.micrometer:micrometer-registry-prometheus' implementation 'com.amazonaws:aws-java-sdk-s3:1.12.547' + + implementation 'org.springframework.session:spring-session-jdbc' } tasks.named('test') { diff --git a/backend/src/main/java/com/funeat/FuneatApplication.java b/backend/src/main/java/com/funeat/FuneatApplication.java index 9fae64b95..34909202c 100644 --- a/backend/src/main/java/com/funeat/FuneatApplication.java +++ b/backend/src/main/java/com/funeat/FuneatApplication.java @@ -1,13 +1,17 @@ package com.funeat; +import com.funeat.common.repository.BaseRepositoryImpl; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +@EnableAsync @SpringBootApplication +@EnableJpaRepositories(repositoryBaseClass = BaseRepositoryImpl.class) public class FuneatApplication { public static void main(String[] args) { SpringApplication.run(FuneatApplication.class, args); } - } diff --git a/backend/src/main/java/com/funeat/admin/application/AdminChecker.java b/backend/src/main/java/com/funeat/admin/application/AdminChecker.java new file mode 100644 index 000000000..39045ce22 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/application/AdminChecker.java @@ -0,0 +1,29 @@ +package com.funeat.admin.application; + +import com.funeat.admin.domain.AdminAuthInfo; +import com.funeat.auth.exception.AuthErrorCode; +import com.funeat.auth.exception.AuthException.NotLoggedInException; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +public class AdminChecker { + + @Value("${back-office.id}") + private String id; + + @Value("${back-office.key}") + private String key; + + public boolean check(final AdminAuthInfo adminAuthInfo) { + if (!id.equals(adminAuthInfo.getId())) { + throw new NotLoggedInException(AuthErrorCode.LOGIN_ADMIN_NOT_FOUND); + } + + if (!key.equals(adminAuthInfo.getKey())) { + throw new NotLoggedInException(AuthErrorCode.LOGIN_ADMIN_NOT_FOUND); + } + + return true; + } +} diff --git a/backend/src/main/java/com/funeat/admin/application/AdminService.java b/backend/src/main/java/com/funeat/admin/application/AdminService.java new file mode 100644 index 000000000..3c97c3c1b --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/application/AdminService.java @@ -0,0 +1,117 @@ +package com.funeat.admin.application; + +import static com.funeat.product.exception.CategoryErrorCode.CATEGORY_NOT_FOUND; +import static com.funeat.product.exception.ProductErrorCode.PRODUCT_NOT_FOUND; + +import com.funeat.admin.dto.AdminProductResponse; +import com.funeat.admin.dto.AdminProductSearchResponse; +import com.funeat.admin.dto.AdminReviewResponse; +import com.funeat.admin.dto.AdminReviewSearchResponse; +import com.funeat.admin.dto.ProductCreateRequest; +import com.funeat.admin.dto.ProductSearchCondition; +import com.funeat.admin.dto.ProductUpdateRequest; +import com.funeat.admin.dto.ReviewSearchCondition; +import com.funeat.admin.repository.AdminProductRepository; +import com.funeat.admin.repository.AdminReviewRepository; +import com.funeat.admin.specification.AdminProductSpecification; +import com.funeat.admin.specification.AdminReviewSpecification; +import com.funeat.product.domain.Category; +import com.funeat.product.domain.Product; +import com.funeat.product.dto.CategoryResponse; +import com.funeat.product.exception.CategoryException.CategoryNotFoundException; +import com.funeat.product.exception.ProductException.ProductNotFoundException; +import com.funeat.product.persistence.CategoryRepository; +import com.funeat.product.persistence.ProductRepository; +import com.funeat.review.domain.Review; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(readOnly = true) +public class AdminService { + + private static final int DEFAULT_PAGE_SIZE = 10; + + private final ProductRepository productRepository; + private final AdminProductRepository adminProductRepository; + private final CategoryRepository categoryRepository; + private final AdminReviewRepository adminReviewRepository; + + public AdminService(final ProductRepository productRepository, final AdminProductRepository adminProductRepository, + final CategoryRepository categoryRepository, final AdminReviewRepository adminReviewRepository) { + this.productRepository = productRepository; + this.adminProductRepository = adminProductRepository; + this.categoryRepository = categoryRepository; + this.adminReviewRepository = adminReviewRepository; + } + + @Transactional + public Long addProduct(final ProductCreateRequest request) { + final Category findCategory = categoryRepository.findById(request.getCategoryId()) + .orElseThrow(() -> new CategoryNotFoundException(CATEGORY_NOT_FOUND, request.getCategoryId())); + + final Product product = Product.create(request.getName(), request.getPrice(), request.getContent(), + findCategory); + + return productRepository.save(product).getId(); + } + + public List getAllCategories() { + final List findCategories = categoryRepository.findAll(); + + return findCategories.stream() + .map(CategoryResponse::toResponse) + .collect(Collectors.toList()); + } + + public AdminProductSearchResponse getSearchProducts(final ProductSearchCondition condition, + final Pageable pageable) { + final Specification specification = AdminProductSpecification.searchBy(condition); + + final Page findProducts = adminProductRepository.findAllForPagination(specification, pageable, + condition.getTotalElements()); + + final List productResponses = findProducts.stream() + .map(AdminProductResponse::toResponse) + .collect(Collectors.toList()); + + final Boolean isLastPage = isLastPage(findProducts, condition.getPrePage()); + + return new AdminProductSearchResponse(productResponses, findProducts.getTotalElements(), isLastPage); + } + + private boolean isLastPage(final Page findProducts, Long prePage) { + return prePage * DEFAULT_PAGE_SIZE + findProducts.getContent().size() == findProducts.getTotalElements(); + } + + @Transactional + public void updateProduct(final Long productId, final ProductUpdateRequest request) { + final Product findProduct = productRepository.findById(productId) + .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, productId)); + + final Category findCategory = categoryRepository.findById(request.getCategoryId()) + .orElseThrow(() -> new CategoryNotFoundException(CATEGORY_NOT_FOUND, request.getCategoryId())); + + findProduct.update(request.getName(), request.getContent(), request.getPrice(), findCategory); + } + + public AdminReviewSearchResponse getSearchReviews(final ReviewSearchCondition condition, final Pageable pageable) { + final Specification specification = AdminReviewSpecification.searchBy(condition); + + final Page findReviews = adminReviewRepository.findAllForPagination(specification, pageable, + condition.getTotalElements()); + + final List reviewResponses = findReviews.stream() + .map(AdminReviewResponse::toResponse) + .collect(Collectors.toList()); + + final Boolean isLastPage = isLastPage(findReviews, condition.getPrePage()); + + return new AdminReviewSearchResponse(reviewResponses, findReviews.getTotalElements(), isLastPage); + } +} diff --git a/backend/src/main/java/com/funeat/admin/domain/AdminAuthInfo.java b/backend/src/main/java/com/funeat/admin/domain/AdminAuthInfo.java new file mode 100644 index 000000000..1a1fb23b8 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/domain/AdminAuthInfo.java @@ -0,0 +1,20 @@ +package com.funeat.admin.domain; + +public class AdminAuthInfo { + + private final String id; + private final String key; + + public AdminAuthInfo(final String id, final String key) { + this.id = id; + this.key = key; + } + + public String getId() { + return id; + } + + public String getKey() { + return key; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/AdminCategoryResponse.java b/backend/src/main/java/com/funeat/admin/dto/AdminCategoryResponse.java new file mode 100644 index 000000000..86c47a715 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/AdminCategoryResponse.java @@ -0,0 +1,32 @@ +package com.funeat.admin.dto; + +import com.funeat.product.domain.Category; + +public class AdminCategoryResponse { + + private final Long id; + private final String name; + private final String image; + + public AdminCategoryResponse(final Long id, final String name, final String image) { + this.id = id; + this.name = name; + this.image = image; + } + + public static AdminCategoryResponse toResponse(final Category category) { + return new AdminCategoryResponse(category.getId(), category.getName(), category.getImage()); + } + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public String getImage() { + return image; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/AdminProductResponse.java b/backend/src/main/java/com/funeat/admin/dto/AdminProductResponse.java new file mode 100644 index 000000000..0f5d2dac5 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/AdminProductResponse.java @@ -0,0 +1,48 @@ +package com.funeat.admin.dto; + +import com.funeat.product.domain.Product; + +public class AdminProductResponse { + + private final Long id; + private final String name; + private final String content; + private final Long price; + private final AdminCategoryResponse categoryResponse; + + private AdminProductResponse(final Long id, final String name, final String content, + final Long price, final AdminCategoryResponse categoryResponse) { + this.id = id; + this.name = name; + this.content = content; + this.price = price; + this.categoryResponse = categoryResponse; + } + + public static AdminProductResponse toResponse(final Product product) { + final AdminCategoryResponse categoryResponse = AdminCategoryResponse.toResponse(product.getCategory()); + + return new AdminProductResponse(product.getId(), product.getName(), product.getContent(), product.getPrice(), + categoryResponse); + } + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public String getContent() { + return content; + } + + public Long getPrice() { + return price; + } + + public AdminCategoryResponse getCategoryResponse() { + return categoryResponse; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/AdminProductSearchResponse.java b/backend/src/main/java/com/funeat/admin/dto/AdminProductSearchResponse.java new file mode 100644 index 000000000..0f543344e --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/AdminProductSearchResponse.java @@ -0,0 +1,29 @@ +package com.funeat.admin.dto; + +import java.util.List; + +public class AdminProductSearchResponse { + + private final List productResponses; + private final Long totalElements; + private final Boolean isLastPage; + + public AdminProductSearchResponse(final List productResponses, final Long totalElements, + final Boolean isLastPage) { + this.productResponses = productResponses; + this.totalElements = totalElements; + this.isLastPage = isLastPage; + } + + public List getProductResponses() { + return productResponses; + } + + public Long getTotalElements() { + return totalElements; + } + + public Boolean isLastPage() { + return isLastPage; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/AdminReviewResponse.java b/backend/src/main/java/com/funeat/admin/dto/AdminReviewResponse.java new file mode 100644 index 000000000..d9f4bddcf --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/AdminReviewResponse.java @@ -0,0 +1,54 @@ +package com.funeat.admin.dto; + +import com.funeat.review.domain.Review; +import java.time.LocalDateTime; + +public class AdminReviewResponse { + + private final Long id; + private final String userName; + private final String content; + private final String image; + private final String productName; + private final LocalDateTime createdAt; + + private AdminReviewResponse(final Long id, final String userName, final String content, + final String image, final String productName, + final LocalDateTime createdAt) { + this.id = id; + this.userName = userName; + this.content = content; + this.image = image; + this.productName = productName; + this.createdAt = createdAt; + } + + public static AdminReviewResponse toResponse(final Review review) { + return new AdminReviewResponse(review.getId(), review.getMember().getNickname(), review.getContent(), + review.getImage(), review.getProduct().getName(), review.getCreatedAt()); + } + + public Long getId() { + return id; + } + + public String getUserName() { + return userName; + } + + public String getContent() { + return content; + } + + public String getImage() { + return image; + } + + public String getProductName() { + return productName; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/AdminReviewSearchResponse.java b/backend/src/main/java/com/funeat/admin/dto/AdminReviewSearchResponse.java new file mode 100644 index 000000000..1b5c0c12b --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/AdminReviewSearchResponse.java @@ -0,0 +1,29 @@ +package com.funeat.admin.dto; + +import java.util.List; + +public class AdminReviewSearchResponse { + + private final List reviewResponses; + private final Long totalElements; + private final Boolean isLastPage; + + public AdminReviewSearchResponse(final List reviewResponses, final Long totalElements, + final Boolean isLastPage) { + this.reviewResponses = reviewResponses; + this.totalElements = totalElements; + this.isLastPage = isLastPage; + } + + public List getReviewResponses() { + return reviewResponses; + } + + public Long getTotalElements() { + return totalElements; + } + + public Boolean getLastPage() { + return isLastPage; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/ProductCreateRequest.java b/backend/src/main/java/com/funeat/admin/dto/ProductCreateRequest.java new file mode 100644 index 000000000..dd835efa3 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/ProductCreateRequest.java @@ -0,0 +1,32 @@ +package com.funeat.admin.dto; + +public class ProductCreateRequest { + + private final String name; + private final Long price; + private final String content; + private final Long categoryId; + + public ProductCreateRequest(final String name, final Long price, final String content, final Long categoryId) { + this.name = name; + this.price = price; + this.content = content; + this.categoryId = categoryId; + } + + public String getName() { + return name; + } + + public Long getPrice() { + return price; + } + + public String getContent() { + return content; + } + + public Long getCategoryId() { + return categoryId; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/ProductSearchCondition.java b/backend/src/main/java/com/funeat/admin/dto/ProductSearchCondition.java new file mode 100644 index 000000000..6114176c2 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/ProductSearchCondition.java @@ -0,0 +1,39 @@ +package com.funeat.admin.dto; + +public class ProductSearchCondition { + + private final String name; + private final Long id; + private final Long categoryId; + private final Long totalElements; + private final Long prePage; + + public ProductSearchCondition(final String name, final Long id, final Long categoryId, + final Long totalElements, final Long prePage) { + this.name = name; + this.id = id; + this.categoryId = categoryId; + this.totalElements = totalElements; + this.prePage = prePage; + } + + public String getName() { + return name; + } + + public Long getId() { + return id; + } + + public Long getCategoryId() { + return categoryId; + } + + public Long getTotalElements() { + return totalElements; + } + + public Long getPrePage() { + return prePage; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/ProductUpdateRequest.java b/backend/src/main/java/com/funeat/admin/dto/ProductUpdateRequest.java new file mode 100644 index 000000000..31d639be4 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/ProductUpdateRequest.java @@ -0,0 +1,32 @@ +package com.funeat.admin.dto; + +public class ProductUpdateRequest { + + private final String name; + private final Long price; + private final String content; + private final Long categoryId; + + public ProductUpdateRequest(final String name, final Long price, final String content, final Long categoryId) { + this.name = name; + this.price = price; + this.content = content; + this.categoryId = categoryId; + } + + public String getName() { + return name; + } + + public Long getPrice() { + return price; + } + + public String getContent() { + return content; + } + + public Long getCategoryId() { + return categoryId; + } +} diff --git a/backend/src/main/java/com/funeat/admin/dto/ReviewSearchCondition.java b/backend/src/main/java/com/funeat/admin/dto/ReviewSearchCondition.java new file mode 100644 index 000000000..02ce7e902 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/dto/ReviewSearchCondition.java @@ -0,0 +1,53 @@ +package com.funeat.admin.dto; + +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +public class ReviewSearchCondition { + + private final Long productId; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private final LocalDateTime from; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private final LocalDateTime to; + + private final Long id; + private final Long totalElements; + private final Long prePage; + + public ReviewSearchCondition(final Long productId, final LocalDateTime from, final LocalDateTime to, + final Long id, final Long totalElements, final Long prePage) { + this.productId = productId; + this.from = from; + this.to = to; + this.id = id; + this.totalElements = totalElements; + this.prePage = prePage; + } + + public Long getProductId() { + return productId; + } + + public LocalDateTime getFrom() { + return from; + } + + public LocalDateTime getTo() { + return to; + } + + public Long getId() { + return id; + } + + public Long getTotalElements() { + return totalElements; + } + + public Long getPrePage() { + return prePage; + } +} diff --git a/backend/src/main/java/com/funeat/admin/presentation/AdminController.java b/backend/src/main/java/com/funeat/admin/presentation/AdminController.java new file mode 100644 index 000000000..6b22890b3 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/presentation/AdminController.java @@ -0,0 +1,70 @@ +package com.funeat.admin.presentation; + +import com.funeat.admin.application.AdminService; +import com.funeat.admin.dto.AdminProductSearchResponse; +import com.funeat.admin.dto.AdminReviewSearchResponse; +import com.funeat.admin.dto.ProductCreateRequest; +import com.funeat.admin.dto.ProductSearchCondition; +import com.funeat.admin.dto.ProductUpdateRequest; +import com.funeat.admin.dto.ReviewSearchCondition; +import com.funeat.product.dto.CategoryResponse; +import java.net.URI; +import java.util.List; +import org.springframework.data.domain.Pageable; +import org.springframework.data.web.PageableDefault; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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.RestController; + +@RestController +@RequestMapping("/api/admin") +public class AdminController { + + private final AdminService adminService; + + public AdminController(final AdminService adminService) { + this.adminService = adminService; + } + + @PostMapping("/products") + public ResponseEntity addProduct(@RequestBody final ProductCreateRequest request) { + final Long productId = adminService.addProduct(request); + + return ResponseEntity.created(URI.create("/api/products/" + productId)).build(); + } + + @GetMapping("/products") + public ResponseEntity getSearchProducts( + @ModelAttribute final ProductSearchCondition condition, + @PageableDefault final Pageable pageable) { + final AdminProductSearchResponse response = adminService.getSearchProducts(condition, pageable); + return ResponseEntity.ok(response); + } + + @PutMapping("/products/{productId}") + public ResponseEntity updateProduct(@PathVariable final Long productId, + @RequestBody final ProductUpdateRequest request) { + adminService.updateProduct(productId, request); + return ResponseEntity.noContent().build(); + } + + @GetMapping("/categories") + public ResponseEntity> getAllCategories() { + final List responses = adminService.getAllCategories(); + return ResponseEntity.ok(responses); + } + + @GetMapping("/reviews") + public ResponseEntity getSearchReviews( + @ModelAttribute final ReviewSearchCondition condition, + @PageableDefault final Pageable pageable) { + final AdminReviewSearchResponse responses = adminService.getSearchReviews(condition, pageable); + return ResponseEntity.ok(responses); + } +} diff --git a/backend/src/main/java/com/funeat/admin/presentation/AdminLoginController.java b/backend/src/main/java/com/funeat/admin/presentation/AdminLoginController.java new file mode 100644 index 000000000..d23125a85 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/presentation/AdminLoginController.java @@ -0,0 +1,38 @@ +package com.funeat.admin.presentation; + +import com.funeat.admin.application.AdminChecker; +import com.funeat.admin.domain.AdminAuthInfo; +import javax.servlet.http.HttpServletRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/admin") +public class AdminLoginController { + + private final AdminChecker adminChecker; + + public AdminLoginController(final AdminChecker adminChecker) { + this.adminChecker = adminChecker; + } + + @PostMapping("/login") + public ResponseEntity login(@RequestBody final AdminAuthInfo adminAuthInfo, + final HttpServletRequest request) { + adminChecker.check(adminAuthInfo); + + request.getSession().setAttribute("authId", adminAuthInfo.getId()); + request.getSession().setAttribute("authKey", adminAuthInfo.getKey()); + + return ResponseEntity.noContent().build(); + } + + @GetMapping("/logged-check") + public ResponseEntity validLoggedInAdmin() { + return ResponseEntity.ok(true); + } +} diff --git a/backend/src/main/java/com/funeat/admin/repository/AdminProductRepository.java b/backend/src/main/java/com/funeat/admin/repository/AdminProductRepository.java new file mode 100644 index 000000000..6dddc02a2 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/repository/AdminProductRepository.java @@ -0,0 +1,7 @@ +package com.funeat.admin.repository; + +import com.funeat.common.repository.BaseRepository; +import com.funeat.product.domain.Product; + +public interface AdminProductRepository extends BaseRepository { +} diff --git a/backend/src/main/java/com/funeat/admin/repository/AdminReviewRepository.java b/backend/src/main/java/com/funeat/admin/repository/AdminReviewRepository.java new file mode 100644 index 000000000..5da483f2e --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/repository/AdminReviewRepository.java @@ -0,0 +1,7 @@ +package com.funeat.admin.repository; + +import com.funeat.common.repository.BaseRepository; +import com.funeat.review.domain.Review; + +public interface AdminReviewRepository extends BaseRepository { +} diff --git a/backend/src/main/java/com/funeat/admin/specification/AdminProductSpecification.java b/backend/src/main/java/com/funeat/admin/specification/AdminProductSpecification.java new file mode 100644 index 000000000..c48ea0305 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/specification/AdminProductSpecification.java @@ -0,0 +1,70 @@ +package com.funeat.admin.specification; + +import com.funeat.admin.dto.ProductSearchCondition; +import com.funeat.product.domain.Category; +import com.funeat.product.domain.Product; +import java.util.List; +import java.util.Objects; +import javax.persistence.criteria.JoinType; +import javax.persistence.criteria.Path; +import org.springframework.data.jpa.domain.Specification; + +public class AdminProductSpecification { + + private static final List> COUNT_RESULT_TYPES = List.of(Long.class, long.class); + + private AdminProductSpecification() { + } + + public static Specification searchBy(final ProductSearchCondition condition) { + return (root, query, criteriaBuilder) -> { + if (!COUNT_RESULT_TYPES.contains(query.getResultType())) { + root.fetch("category", JoinType.LEFT); + } + + criteriaBuilder.desc(root.get("id")); + + return Specification + .where(like(condition.getName())) + .and(lessThan(condition.getId())) + .and(sameCategory(condition.getCategoryId())) + .toPredicate(root, query, criteriaBuilder); + }; + } + + private static Specification like(final String productName) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(productName)) { + return null; + } + + final Path namePath = root.get("name"); + + return criteriaBuilder.like(namePath, "%" + productName + "%"); + }; + } + + private static Specification lessThan(final Long productId) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(productId)) { + return null; + } + + final Path productIdPath = root.get("id"); + + return criteriaBuilder.lessThan(productIdPath, productId); + }; + } + + private static Specification sameCategory(final Long categoryId) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(categoryId)) { + return null; + } + + final Path categoryPath = root.get("category"); + + return criteriaBuilder.equal(categoryPath, categoryId); + }; + } +} diff --git a/backend/src/main/java/com/funeat/admin/specification/AdminReviewSpecification.java b/backend/src/main/java/com/funeat/admin/specification/AdminReviewSpecification.java new file mode 100644 index 000000000..045147de5 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/specification/AdminReviewSpecification.java @@ -0,0 +1,82 @@ +package com.funeat.admin.specification; + +import com.funeat.admin.dto.ReviewSearchCondition; +import com.funeat.product.domain.Product; +import com.funeat.review.domain.Review; +import java.time.LocalDateTime; +import java.util.Objects; +import javax.persistence.criteria.JoinType; +import javax.persistence.criteria.Path; +import org.springframework.data.jpa.domain.Specification; + +public class AdminReviewSpecification { + + private AdminReviewSpecification() { + } + + public static Specification searchBy(final ReviewSearchCondition condition) { + return (root, query, criteriaBuilder) -> { + if (query.getResultType() != Long.class && query.getResultType() != long.class) { + root.fetch("member", JoinType.LEFT); + root.fetch("product", JoinType.LEFT); + } + + criteriaBuilder.desc(root.get("id")); + + return Specification + .where(to(condition.getTo())) + .and(from(condition.getFrom())) + .and(sameProduct(condition.getProductId())) + .and(lessThan(condition.getId())) + .toPredicate(root, query, criteriaBuilder); + }; + } + + private static Specification to(final LocalDateTime to) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(to)) { + return null; + } + + final Path toPath = root.get("createdAt"); + + return criteriaBuilder.lessThanOrEqualTo(toPath, to); + }; + } + + private static Specification from(final LocalDateTime from) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(from)) { + return null; + } + + final Path fromPath = root.get("createdAt"); + + return criteriaBuilder.greaterThanOrEqualTo(fromPath, from); + }; + } + + private static Specification sameProduct(final Long productId) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(productId)) { + return null; + } + + final Path productPath = root.get("product"); + + return criteriaBuilder.equal(productPath, productId); + }; + } + + private static Specification lessThan(final Long reviewId) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(reviewId)) { + return null; + } + + final Path reviewIdPath = root.get("id"); + + return criteriaBuilder.lessThan(reviewIdPath, reviewId); + }; + } +} diff --git a/backend/src/main/java/com/funeat/admin/util/AdminCheckInterceptor.java b/backend/src/main/java/com/funeat/admin/util/AdminCheckInterceptor.java new file mode 100644 index 000000000..59ef45b49 --- /dev/null +++ b/backend/src/main/java/com/funeat/admin/util/AdminCheckInterceptor.java @@ -0,0 +1,42 @@ +package com.funeat.admin.util; + +import static com.funeat.auth.exception.AuthErrorCode.LOGIN_ADMIN_NOT_FOUND; + +import com.funeat.admin.application.AdminChecker; +import com.funeat.admin.domain.AdminAuthInfo; +import com.funeat.auth.exception.AuthException.NotLoggedInException; +import java.util.Objects; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +@Component +public class AdminCheckInterceptor implements HandlerInterceptor { + + private final AdminChecker adminChecker; + + public AdminCheckInterceptor(final AdminChecker adminChecker) { + this.adminChecker = adminChecker; + } + + @Override + public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, + final Object handler) { + final HttpSession session = request.getSession(false); + + if (Objects.isNull(session)) { + throw new NotLoggedInException(LOGIN_ADMIN_NOT_FOUND); + } + + final String authId = String.valueOf(session.getAttribute("authId")); + final String authKey = String.valueOf(session.getAttribute("authKey")); + + if (Objects.isNull(authId) || Objects.isNull(authKey)) { + throw new NotLoggedInException(LOGIN_ADMIN_NOT_FOUND); + } + + return adminChecker.check(new AdminAuthInfo(authId, authKey)); + } +} diff --git a/backend/src/main/java/com/funeat/auth/application/AuthService.java b/backend/src/main/java/com/funeat/auth/application/AuthService.java index dd0a43d6c..20a24345c 100644 --- a/backend/src/main/java/com/funeat/auth/application/AuthService.java +++ b/backend/src/main/java/com/funeat/auth/application/AuthService.java @@ -12,7 +12,7 @@ @Transactional(readOnly = true) public class AuthService { - private static final String COOKIE_NAME = "FUNEAT"; + private static final String COOKIE_NAME = "SESSION"; private final MemberService memberService; private final PlatformUserProvider platformUserProvider; diff --git a/backend/src/main/java/com/funeat/auth/exception/AuthErrorCode.java b/backend/src/main/java/com/funeat/auth/exception/AuthErrorCode.java index 3508ff142..e47350078 100644 --- a/backend/src/main/java/com/funeat/auth/exception/AuthErrorCode.java +++ b/backend/src/main/java/com/funeat/auth/exception/AuthErrorCode.java @@ -5,6 +5,7 @@ public enum AuthErrorCode { LOGIN_MEMBER_NOT_FOUND(HttpStatus.UNAUTHORIZED, "๋กœ๊ทธ์ธ ํ•˜์ง€ ์•Š์€ ํšŒ์›์ž…๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ์„ ํ•ด์ฃผ์„ธ์š”.", "6001"), + LOGIN_ADMIN_NOT_FOUND(HttpStatus.UNAUTHORIZED, "๋กœ๊ทธ์ธ ํ•˜์ง€ ์•Š์€ ๊ด€๋ฆฌ์ž์ž…๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ์„ ํ•ด์ฃผ์„ธ์š”.", "6002"), ; private final HttpStatus status; diff --git a/backend/src/main/java/com/funeat/banner/application/BannerService.java b/backend/src/main/java/com/funeat/banner/application/BannerService.java new file mode 100644 index 000000000..48864670a --- /dev/null +++ b/backend/src/main/java/com/funeat/banner/application/BannerService.java @@ -0,0 +1,28 @@ +package com.funeat.banner.application; + +import com.funeat.banner.domain.Banner; +import com.funeat.banner.dto.BannerResponse; +import com.funeat.banner.persistence.BannerRepository; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(readOnly = true) +public class BannerService { + + private final BannerRepository bannerRepository; + + public BannerService(final BannerRepository bannerRepository) { + this.bannerRepository = bannerRepository; + } + + public List getAllBanners() { + final List findBanners = bannerRepository.findAllByOrderByIdDesc(); + + return findBanners.stream() + .map(BannerResponse::toResponse) + .collect(Collectors.toList()); + } +} diff --git a/backend/src/main/java/com/funeat/banner/domain/Banner.java b/backend/src/main/java/com/funeat/banner/domain/Banner.java new file mode 100644 index 000000000..9ea8eabd2 --- /dev/null +++ b/backend/src/main/java/com/funeat/banner/domain/Banner.java @@ -0,0 +1,38 @@ +package com.funeat.banner.domain; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Banner { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String link; + + private String image; + + protected Banner() { + } + + public Banner(final String link, final String image) { + this.link = link; + this.image = image; + } + + public Long getId() { + return id; + } + + public String getLink() { + return link; + } + + public String getImage() { + return image; + } +} diff --git a/backend/src/main/java/com/funeat/banner/dto/BannerResponse.java b/backend/src/main/java/com/funeat/banner/dto/BannerResponse.java new file mode 100644 index 000000000..fcff62c2f --- /dev/null +++ b/backend/src/main/java/com/funeat/banner/dto/BannerResponse.java @@ -0,0 +1,32 @@ +package com.funeat.banner.dto; + +import com.funeat.banner.domain.Banner; + +public class BannerResponse { + + private final Long id; + private final String link; + private final String image; + + private BannerResponse(final Long id, final String link, final String image) { + this.id = id; + this.link = link; + this.image = image; + } + + public static BannerResponse toResponse(final Banner banner) { + return new BannerResponse(banner.getId(), banner.getLink(), banner.getImage()); + } + + public Long getId() { + return id; + } + + public String getLink() { + return link; + } + + public String getImage() { + return image; + } +} diff --git a/backend/src/main/java/com/funeat/banner/persistence/BannerRepository.java b/backend/src/main/java/com/funeat/banner/persistence/BannerRepository.java new file mode 100644 index 000000000..30f598755 --- /dev/null +++ b/backend/src/main/java/com/funeat/banner/persistence/BannerRepository.java @@ -0,0 +1,10 @@ +package com.funeat.banner.persistence; + +import com.funeat.banner.domain.Banner; +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface BannerRepository extends JpaRepository { + + List findAllByOrderByIdDesc(); +} diff --git a/backend/src/main/java/com/funeat/banner/presentation/BannerApiController.java b/backend/src/main/java/com/funeat/banner/presentation/BannerApiController.java new file mode 100644 index 000000000..7465189ab --- /dev/null +++ b/backend/src/main/java/com/funeat/banner/presentation/BannerApiController.java @@ -0,0 +1,21 @@ +package com.funeat.banner.presentation; + +import com.funeat.banner.dto.BannerResponse; +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.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; + +@Tag(name = "08.Banner", description = "๋ฐฐ๋„ˆ ๊ด€๋ จ API ์ž…๋‹ˆ๋‹ค.") +public interface BannerApiController { + + @Operation(summary = "๋ฐฐ๋„ˆ ์ „์ฒด ์กฐํšŒ", description = "๋ฐฐ๋„ˆ ์ „์ฒด๋ฅผ ์กฐํšŒํ•œ๋‹ค.") + @ApiResponse( + responseCode = "200", + description = "๋ฐฐ๋„ˆ ์ „์ฒด ์กฐํšŒ ์„ฑ๊ณต." + ) + @GetMapping + ResponseEntity> getBanners(); +} diff --git a/backend/src/main/java/com/funeat/banner/presentation/BannerController.java b/backend/src/main/java/com/funeat/banner/presentation/BannerController.java new file mode 100644 index 000000000..164df97cd --- /dev/null +++ b/backend/src/main/java/com/funeat/banner/presentation/BannerController.java @@ -0,0 +1,25 @@ +package com.funeat.banner.presentation; + +import com.funeat.banner.application.BannerService; +import com.funeat.banner.dto.BannerResponse; +import java.util.List; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class BannerController implements BannerApiController { + + private final BannerService bannerService; + + public BannerController(final BannerService bannerService) { + this.bannerService = bannerService; + } + + @GetMapping("/api/banners") + public ResponseEntity> getBanners() { + final List responses = bannerService.getAllBanners(); + + return ResponseEntity.ok(responses); + } +} diff --git a/backend/src/main/java/com/funeat/comment/domain/Comment.java b/backend/src/main/java/com/funeat/comment/domain/Comment.java new file mode 100644 index 000000000..4e6798b9d --- /dev/null +++ b/backend/src/main/java/com/funeat/comment/domain/Comment.java @@ -0,0 +1,59 @@ +package com.funeat.comment.domain; + +import com.funeat.member.domain.Member; +import com.funeat.recipe.domain.Recipe; +import java.time.LocalDateTime; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; + +@Entity +public class Comment { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String comment; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "recipe_id") + private Recipe recipe; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; + + @Column(nullable = false) + private LocalDateTime createdAt = LocalDateTime.now(); + + protected Comment() { + } + + public Comment(final Recipe recipe, final Member member, final String comment) { + this.recipe = recipe; + this.member = member; + this.comment = comment; + } + + public Long getId() { + return id; + } + + public String getComment() { + return comment; + } + + public Member getMember() { + return member; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } +} diff --git a/backend/src/main/java/com/funeat/comment/persistence/CommentRepository.java b/backend/src/main/java/com/funeat/comment/persistence/CommentRepository.java new file mode 100644 index 000000000..e40a47f67 --- /dev/null +++ b/backend/src/main/java/com/funeat/comment/persistence/CommentRepository.java @@ -0,0 +1,8 @@ +package com.funeat.comment.persistence; + +import com.funeat.comment.domain.Comment; +import com.funeat.common.repository.BaseRepository; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface CommentRepository extends JpaRepository, BaseRepository { +} diff --git a/backend/src/main/java/com/funeat/comment/specification/CommentSpecification.java b/backend/src/main/java/com/funeat/comment/specification/CommentSpecification.java new file mode 100644 index 000000000..db6c734bb --- /dev/null +++ b/backend/src/main/java/com/funeat/comment/specification/CommentSpecification.java @@ -0,0 +1,56 @@ +package com.funeat.comment.specification; + +import com.funeat.comment.domain.Comment; +import com.funeat.recipe.domain.Recipe; +import java.util.List; +import java.util.Objects; +import javax.persistence.criteria.JoinType; +import javax.persistence.criteria.Path; +import org.springframework.data.jpa.domain.Specification; + +public class CommentSpecification { + + private CommentSpecification() { + } + + private static final List> COUNT_RESULT_TYPES = List.of(Long.class, long.class); + + public static Specification findAllByRecipe(final Recipe recipe, final Long lastCommentId) { + return (root, query, criteriaBuilder) -> { + if (!COUNT_RESULT_TYPES.contains(query.getResultType())) { + root.fetch("member", JoinType.LEFT); + } + + criteriaBuilder.desc(root.get("id")); + + return Specification + .where(lessThan(lastCommentId)) + .and(equalToRecipe(recipe)) + .toPredicate(root, query, criteriaBuilder); + }; + } + + private static Specification lessThan(final Long commentId) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(commentId)) { + return null; + } + + final Path commentIdPath = root.get("id"); + + return criteriaBuilder.lessThan(commentIdPath, commentId); + }; + } + + private static Specification equalToRecipe(final Recipe recipe) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(recipe)) { + return null; + } + + final Path recipePath = root.get("recipe"); + + return criteriaBuilder.equal(recipePath, recipe); + }; + } +} diff --git a/backend/src/main/java/com/funeat/common/ImageUploader.java b/backend/src/main/java/com/funeat/common/ImageUploader.java index 754b1affd..afd4b5c10 100644 --- a/backend/src/main/java/com/funeat/common/ImageUploader.java +++ b/backend/src/main/java/com/funeat/common/ImageUploader.java @@ -5,4 +5,6 @@ public interface ImageUploader { String upload(final MultipartFile image); + + void delete(final String fileName); } diff --git a/backend/src/main/java/com/funeat/common/OpenApiConfig.java b/backend/src/main/java/com/funeat/common/OpenApiConfig.java index 47c4df2bb..51c42429d 100644 --- a/backend/src/main/java/com/funeat/common/OpenApiConfig.java +++ b/backend/src/main/java/com/funeat/common/OpenApiConfig.java @@ -19,6 +19,7 @@ @Tag(name = "05.Member", description = "์‚ฌ์šฉ์ž ๊ธฐ๋Šฅ"), @Tag(name = "06.Login", description = "๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ"), @Tag(name = "07.Recipe", description = "๊ฟ€์กฐํ•ฉ ๊ธฐ๋Šฅ"), + @Tag(name = "08.Banner", description = "๋ฐฐ๋„ˆ ๊ธฐ๋Šฅ"), } ) @Configuration diff --git a/backend/src/main/java/com/funeat/common/WebConfig.java b/backend/src/main/java/com/funeat/common/WebConfig.java index 638dffe05..c6a0b0e7a 100644 --- a/backend/src/main/java/com/funeat/common/WebConfig.java +++ b/backend/src/main/java/com/funeat/common/WebConfig.java @@ -1,5 +1,6 @@ package com.funeat.common; +import com.funeat.admin.util.AdminCheckInterceptor; import com.funeat.auth.util.AuthArgumentResolver; import com.funeat.auth.util.AuthHandlerInterceptor; import com.funeat.recipe.util.RecipeDetailHandlerInterceptor; @@ -20,16 +21,20 @@ public class WebConfig implements WebMvcConfigurer { private final RecipeHandlerInterceptor recipeHandlerInterceptor; private final RecipeDetailHandlerInterceptor recipeDetailHandlerInterceptor; + private final AdminCheckInterceptor adminCheckInterceptor; + public WebConfig(final CustomPageableHandlerMethodArgumentResolver customPageableHandlerMethodArgumentResolver, final AuthArgumentResolver authArgumentResolver, final AuthHandlerInterceptor authHandlerInterceptor, final RecipeHandlerInterceptor recipeHandlerInterceptor, - final RecipeDetailHandlerInterceptor recipeDetailHandlerInterceptor) { + final RecipeDetailHandlerInterceptor recipeDetailHandlerInterceptor, + final AdminCheckInterceptor adminCheckInterceptor) { this.customPageableHandlerMethodArgumentResolver = customPageableHandlerMethodArgumentResolver; this.authArgumentResolver = authArgumentResolver; this.authHandlerInterceptor = authHandlerInterceptor; this.recipeHandlerInterceptor = recipeHandlerInterceptor; this.recipeDetailHandlerInterceptor = recipeDetailHandlerInterceptor; + this.adminCheckInterceptor = adminCheckInterceptor; } @Override @@ -43,6 +48,9 @@ public void addInterceptors(final InterceptorRegistry registry) { registry.addInterceptor(recipeDetailHandlerInterceptor) .addPathPatterns("/api/recipes/**") .excludePathPatterns("/api/recipes"); + registry.addInterceptor(adminCheckInterceptor) + .excludePathPatterns("/api/admin/login") + .addPathPatterns("/api/admin/**"); } @Override diff --git a/backend/src/main/java/com/funeat/common/exception/CommonException.java b/backend/src/main/java/com/funeat/common/exception/CommonException.java index e2e822c68..55be12d5d 100644 --- a/backend/src/main/java/com/funeat/common/exception/CommonException.java +++ b/backend/src/main/java/com/funeat/common/exception/CommonException.java @@ -22,4 +22,10 @@ public S3UploadFailException(final CommonErrorCode errorCode) { super(errorCode.getStatus(), new ErrorCode<>(errorCode.getCode(), errorCode.getMessage())); } } + + public static class S3DeleteFailException extends CommonException { + public S3DeleteFailException(final CommonErrorCode errorCode) { + super(errorCode.getStatus(), new ErrorCode<>(errorCode.getCode(), errorCode.getMessage())); + } + } } diff --git a/backend/src/main/java/com/funeat/common/repository/BaseRepository.java b/backend/src/main/java/com/funeat/common/repository/BaseRepository.java new file mode 100644 index 000000000..448db7766 --- /dev/null +++ b/backend/src/main/java/com/funeat/common/repository/BaseRepository.java @@ -0,0 +1,17 @@ +package com.funeat.common.repository; + +import java.io.Serializable; +import java.util.List; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.NoRepositoryBean; + +@NoRepositoryBean +public interface BaseRepository extends JpaRepository { + + Page findAllForPagination(final Specification spec, final Pageable pageable, final Long totalElements); + + List findAllWithSpecification(final Specification spec, final int pageSize); +} diff --git a/backend/src/main/java/com/funeat/common/repository/BaseRepositoryImpl.java b/backend/src/main/java/com/funeat/common/repository/BaseRepositoryImpl.java new file mode 100644 index 000000000..64cd508f6 --- /dev/null +++ b/backend/src/main/java/com/funeat/common/repository/BaseRepositoryImpl.java @@ -0,0 +1,51 @@ +package com.funeat.common.repository; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; + +import org.springframework.data.jpa.domain.Specification; +import org.springframework.data.jpa.repository.support.JpaEntityInformation; +import org.springframework.data.jpa.repository.support.SimpleJpaRepository; + +public class BaseRepositoryImpl extends SimpleJpaRepository + implements BaseRepository { + + public BaseRepositoryImpl(final JpaEntityInformation entityInformation, final EntityManager entityManager) { + super(entityInformation, entityManager); + } + + @Override + public Page findAllForPagination(final Specification spec, final Pageable pageable, + final Long totalElements) { + final TypedQuery query = getQuery(spec, pageable.getSort()); + + final int pageSize = pageable.getPageSize(); + + if (totalElements == null) { + return findAll(spec, pageable); + } + + if (pageSize < 1) { + throw new IllegalArgumentException("ํŽ˜์ด์ง€๋Š” 1๋ฏธ๋งŒ์ด ๋  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."); + } + + query.setMaxResults(pageable.getPageSize()); + + return new PageImpl<>(query.getResultList(), PageRequest.of(0, pageSize), totalElements); + } + + @Override + public List findAllWithSpecification(final Specification spec, final int pageSize) { + final TypedQuery query = getQuery(spec, Sort.unsorted()); + query.setMaxResults(pageSize); + + return query.getResultList(); + } +} diff --git a/backend/src/main/java/com/funeat/common/s3/S3Uploader.java b/backend/src/main/java/com/funeat/common/s3/S3Uploader.java index 3f9c86caa..97e6241b7 100644 --- a/backend/src/main/java/com/funeat/common/s3/S3Uploader.java +++ b/backend/src/main/java/com/funeat/common/s3/S3Uploader.java @@ -3,15 +3,19 @@ import static com.funeat.exception.CommonErrorCode.IMAGE_EXTENSION_ERROR_CODE; import static com.funeat.exception.CommonErrorCode.UNKNOWN_SERVER_ERROR_CODE; +import com.amazonaws.AmazonServiceException; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.PutObjectRequest; import com.funeat.common.ImageUploader; import com.funeat.common.exception.CommonException.NotAllowedFileExtensionException; +import com.funeat.common.exception.CommonException.S3DeleteFailException; import com.funeat.common.exception.CommonException.S3UploadFailException; import java.io.IOException; import java.util.List; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @@ -21,8 +25,11 @@ @Profile("!test") public class S3Uploader implements ImageUploader { + private static final int BEGIN_FILE_NAME_INDEX_WITHOUT_CLOUDFRONT_PATH = 31; private static final List INCLUDE_EXTENSIONS = List.of("image/jpeg", "image/png", "image/webp"); + private final Logger log = LoggerFactory.getLogger(this.getClass()); + @Value("${cloud.aws.s3.bucket}") private String bucket; @@ -53,6 +60,18 @@ public String upload(final MultipartFile image) { } } + @Override + public void delete(final String image) { + final String imageName = image.substring(BEGIN_FILE_NAME_INDEX_WITHOUT_CLOUDFRONT_PATH); + try { + final String key = folder + imageName; + amazonS3.deleteObject(bucket, key); + } catch (final AmazonServiceException e) { + log.error("S3 ์ด๋ฏธ์ง€ ์‚ญ์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ : {}", image); + throw new S3DeleteFailException(UNKNOWN_SERVER_ERROR_CODE); + } + } + private void validateExtension(final MultipartFile image) { final String contentType = image.getContentType(); if (!INCLUDE_EXTENSIONS.contains(contentType)) { diff --git a/backend/src/main/java/com/funeat/member/domain/bookmark/ProductBookmark.java b/backend/src/main/java/com/funeat/member/domain/bookmark/ProductBookmark.java deleted file mode 100644 index c18c84b59..000000000 --- a/backend/src/main/java/com/funeat/member/domain/bookmark/ProductBookmark.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.funeat.member.domain.bookmark; - -import com.funeat.member.domain.Member; -import com.funeat.product.domain.Product; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; - -@Entity -public class ProductBookmark { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @ManyToOne - @JoinColumn(name = "member_id") - private Member member; - - @ManyToOne - @JoinColumn(name = "product_id") - private Product product; - - private Boolean checked; -} diff --git a/backend/src/main/java/com/funeat/member/domain/bookmark/RecipeBookmark.java b/backend/src/main/java/com/funeat/member/domain/bookmark/RecipeBookmark.java deleted file mode 100644 index 9dc0b75ad..000000000 --- a/backend/src/main/java/com/funeat/member/domain/bookmark/RecipeBookmark.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.funeat.member.domain.bookmark; - -import com.funeat.member.domain.Member; -import com.funeat.recipe.domain.Recipe; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; - -@Entity -public class RecipeBookmark { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @ManyToOne - @JoinColumn(name = "member_id") - private Member member; - - @ManyToOne - @JoinColumn(name = "recipe_id") - private Recipe recipe; - - private Boolean checked; -} diff --git a/backend/src/main/java/com/funeat/member/domain/favorite/RecipeFavorite.java b/backend/src/main/java/com/funeat/member/domain/favorite/RecipeFavorite.java index ab69e7d98..161f83483 100644 --- a/backend/src/main/java/com/funeat/member/domain/favorite/RecipeFavorite.java +++ b/backend/src/main/java/com/funeat/member/domain/favorite/RecipeFavorite.java @@ -28,24 +28,22 @@ public class RecipeFavorite { @JoinColumn(name = "recipe_id") private Recipe recipe; - private Boolean favorite = false; + private Boolean favorite; protected RecipeFavorite() { } - public RecipeFavorite(final Member member, final Recipe recipe) { - this.member = member; - this.recipe = recipe; - } - public RecipeFavorite(final Member member, final Recipe recipe, final Boolean favorite) { this.member = member; this.recipe = recipe; this.favorite = favorite; } - public static RecipeFavorite create(final Member member, final Recipe recipe) { - return new RecipeFavorite(member, recipe); + public static RecipeFavorite create(final Member member, final Recipe recipe, final Boolean favorite) { + if (favorite == true) { + recipe.addFavoriteCount(); + } + return new RecipeFavorite(member, recipe, favorite); } public void updateFavorite(final Boolean favorite) { diff --git a/backend/src/main/java/com/funeat/member/persistence/ProductBookmarkRepository.java b/backend/src/main/java/com/funeat/member/persistence/ProductBookmarkRepository.java deleted file mode 100644 index c7651b592..000000000 --- a/backend/src/main/java/com/funeat/member/persistence/ProductBookmarkRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.funeat.member.persistence; - -import com.funeat.member.domain.bookmark.ProductBookmark; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface ProductBookmarkRepository extends JpaRepository { -} diff --git a/backend/src/main/java/com/funeat/member/persistence/RecipeBookMarkRepository.java b/backend/src/main/java/com/funeat/member/persistence/RecipeBookMarkRepository.java deleted file mode 100644 index 4ed5cce46..000000000 --- a/backend/src/main/java/com/funeat/member/persistence/RecipeBookMarkRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.funeat.member.persistence; - -import com.funeat.member.domain.bookmark.RecipeBookmark; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface RecipeBookMarkRepository extends JpaRepository { -} diff --git a/backend/src/main/java/com/funeat/member/persistence/ReviewFavoriteRepository.java b/backend/src/main/java/com/funeat/member/persistence/ReviewFavoriteRepository.java index 2e96e623a..f1ae40e5d 100644 --- a/backend/src/main/java/com/funeat/member/persistence/ReviewFavoriteRepository.java +++ b/backend/src/main/java/com/funeat/member/persistence/ReviewFavoriteRepository.java @@ -3,10 +3,15 @@ import com.funeat.member.domain.Member; import com.funeat.member.domain.favorite.ReviewFavorite; import com.funeat.review.domain.Review; +import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; public interface ReviewFavoriteRepository extends JpaRepository { Optional findByMemberAndReview(final Member member, final Review review); + + void deleteByReview(final Review review); + + List findByReview(final Review review); } 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 6e28cfac6..af00932f7 100644 --- a/backend/src/main/java/com/funeat/member/presentation/MemberApiController.java +++ b/backend/src/main/java/com/funeat/member/presentation/MemberApiController.java @@ -15,7 +15,9 @@ import org.springframework.data.web.PageableDefault; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; @@ -51,7 +53,7 @@ public ResponseEntity putMemberProfile(@AuthenticationPrincipal final Logi @RequestPart @Valid final MemberRequest memberRequest) { memberService.modify(loginInfo.getId(), image, memberRequest); - return ResponseEntity.ok().build(); + return ResponseEntity.noContent().build(); } @GetMapping("/reviews") @@ -69,4 +71,13 @@ public ResponseEntity getMemberRecipe(@AuthenticationPrin return ResponseEntity.ok().body(response); } + + @Logging + @DeleteMapping("/reviews/{reviewId}") + public ResponseEntity deleteReview(@PathVariable final Long reviewId, + @AuthenticationPrincipal final LoginInfo loginInfo) { + reviewService.deleteReview(reviewId, loginInfo.getId()); + + return ResponseEntity.noContent().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 9a4ede8da..9c5e60763 100644 --- a/backend/src/main/java/com/funeat/member/presentation/MemberController.java +++ b/backend/src/main/java/com/funeat/member/presentation/MemberController.java @@ -12,7 +12,9 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; @@ -30,7 +32,7 @@ public interface MemberController { @Operation(summary = "์‚ฌ์šฉ์ž ์ •๋ณด ์ˆ˜์ •", description = "์‚ฌ์šฉ์ž ๋‹‰๋„ค์ž„๊ณผ ํ”„๋กœํ•„ ์‚ฌ์ง„์„ ์ˆ˜์ •ํ•œ๋‹ค.") @ApiResponse( - responseCode = "200", + responseCode = "204", description = "์‚ฌ์šฉ์ž ์ •๋ณด ์ˆ˜์ • ์„ฑ๊ณต." ) @PutMapping @@ -55,4 +57,13 @@ ResponseEntity getMemberReview(@AuthenticationPrincipal f @GetMapping ResponseEntity getMemberRecipe(@AuthenticationPrincipal final LoginInfo loginInfo, @PageableDefault final Pageable pageable); + + @Operation(summary = "๋ฆฌ๋ทฐ ์‚ญ์ œ", description = "์ž์‹ ์ด ์ž‘์„ฑํ•œ ๋ฆฌ๋ทฐ๋ฅผ ์‚ญ์ œํ•œ๋‹ค.") + @ApiResponse( + responseCode = "204", + description = "๋ฆฌ๋ทฐ ์‚ญ์ œ ์„ฑ๊ณต." + ) + @DeleteMapping + ResponseEntity deleteReview(@PathVariable final Long reviewId, + @AuthenticationPrincipal final LoginInfo loginInfo); } diff --git a/backend/src/main/java/com/funeat/product/application/ProductService.java b/backend/src/main/java/com/funeat/product/application/ProductService.java index 0301db183..021ffe126 100644 --- a/backend/src/main/java/com/funeat/product/application/ProductService.java +++ b/backend/src/main/java/com/funeat/product/application/ProductService.java @@ -9,6 +9,7 @@ import com.funeat.product.dto.ProductInCategoryDto; import com.funeat.product.dto.ProductResponse; import com.funeat.product.dto.ProductReviewCountDto; +import com.funeat.product.dto.ProductSortCondition; import com.funeat.product.dto.ProductsInCategoryResponse; import com.funeat.product.dto.RankingProductDto; import com.funeat.product.dto.RankingProductsResponse; @@ -21,6 +22,7 @@ import com.funeat.product.persistence.CategoryRepository; import com.funeat.product.persistence.ProductRecipeRepository; import com.funeat.product.persistence.ProductRepository; +import com.funeat.product.persistence.ProductSpecification; import com.funeat.recipe.domain.Recipe; import com.funeat.recipe.domain.RecipeImage; import com.funeat.recipe.dto.RecipeDto; @@ -30,13 +32,14 @@ import com.funeat.review.persistence.ReviewRepository; import com.funeat.review.persistence.ReviewTagRepository; import com.funeat.tag.domain.Tag; +import java.time.LocalDateTime; import java.util.Comparator; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,8 +49,9 @@ public class ProductService { private static final int THREE = 3; private static final int TOP = 0; - public static final String REVIEW_COUNT = "reviewCount"; private static final int RANKING_SIZE = 3; + private static final int DEFAULT_PAGE_SIZE = 10; + private static final int DEFAULT_CURSOR_PAGINATION_SIZE = 11; private final CategoryRepository categoryRepository; private final ProductRepository productRepository; @@ -60,7 +64,8 @@ public class ProductService { public ProductService(final CategoryRepository categoryRepository, final ProductRepository productRepository, final ReviewTagRepository reviewTagRepository, final ReviewRepository reviewRepository, final ProductRecipeRepository productRecipeRepository, - final RecipeImageRepository recipeImageRepository, final RecipeRepository recipeRepository) { + final RecipeImageRepository recipeImageRepository, + final RecipeRepository recipeRepository) { this.categoryRepository = categoryRepository; this.productRepository = productRepository; this.reviewTagRepository = reviewTagRepository; @@ -70,38 +75,53 @@ public ProductService(final CategoryRepository categoryRepository, final Product this.recipeRepository = recipeRepository; } - public ProductsInCategoryResponse getAllProductsInCategory(final Long categoryId, - final Pageable pageable) { + public ProductsInCategoryResponse getAllProductsInCategory(final Long categoryId, final Long lastProductId, + final ProductSortCondition sortCondition) { final Category category = categoryRepository.findById(categoryId) .orElseThrow(() -> new CategoryNotFoundException(CATEGORY_NOT_FOUND, categoryId)); + final Product lastProduct = productRepository.findById(lastProductId).orElse(null); - final Page pages = getAllProductsInCategory(pageable, category); + final Specification specification = ProductSpecification.searchBy(category, lastProduct, sortCondition); + final List findResults = productRepository.findAllWithSpecification(specification, DEFAULT_CURSOR_PAGINATION_SIZE); - final PageDto pageDto = PageDto.toDto(pages); - final List productDtos = pages.getContent(); + final List productDtos = getProductInCategoryDtos(findResults); + final boolean hasNext = hasNextPage(findResults); - return ProductsInCategoryResponse.toResponse(pageDto, productDtos); + return ProductsInCategoryResponse.toResponse(hasNext, productDtos); } - private Page getAllProductsInCategory(final Pageable pageable, final Category category) { - if (Objects.nonNull(pageable.getSort().getOrderFor(REVIEW_COUNT))) { - final PageRequest pageRequest = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()); - return productRepository.findAllByCategoryOrderByReviewCountDesc(category, pageRequest); + private List getProductInCategoryDtos(final List findProducts) { + final int resultSize = getResultSize(findProducts); + final List products = findProducts.subList(0, resultSize); + + return products.stream() + .map(ProductInCategoryDto::toDto) + .collect(Collectors.toList()); + } + + private int getResultSize(final List findProducts) { + if (findProducts.size() < DEFAULT_CURSOR_PAGINATION_SIZE) { + return findProducts.size(); } - return productRepository.findAllByCategory(category, pageable); + return DEFAULT_PAGE_SIZE; + } + + private boolean hasNextPage(final List findProducts) { + return findProducts.size() > DEFAULT_PAGE_SIZE; } public ProductResponse findProductDetail(final Long productId) { final Product product = productRepository.findById(productId) .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, productId)); - final Long reviewCount = reviewRepository.countByProduct(product); final List tags = reviewTagRepository.findTop3TagsByReviewIn(productId, PageRequest.of(TOP, THREE)); - return ProductResponse.toResponse(product, reviewCount, tags); + return ProductResponse.toResponse(product, tags); } public RankingProductsResponse getTop3Products() { - final List productsAndReviewCounts = productRepository.findAllByAverageRatingGreaterThan3(); + final LocalDateTime endDateTime = LocalDateTime.now(); + final LocalDateTime startDateTime = endDateTime.minusWeeks(2L); + final List productsAndReviewCounts = productRepository.findAllByAverageRatingGreaterThan3(startDateTime, endDateTime); final Comparator rankingScoreComparator = Comparator.comparing( (ProductReviewCountDto it) -> it.getProduct().calculateRankingScore(it.getReviewCount()) ).reversed(); diff --git a/backend/src/main/java/com/funeat/product/domain/Category.java b/backend/src/main/java/com/funeat/product/domain/Category.java index 5d6c62a08..7504aad1d 100644 --- a/backend/src/main/java/com/funeat/product/domain/Category.java +++ b/backend/src/main/java/com/funeat/product/domain/Category.java @@ -1,6 +1,11 @@ package com.funeat.product.domain; -import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; @Entity public class Category { @@ -25,6 +30,10 @@ public Category(final String name, final CategoryType type, final String image) this.image = image; } + public boolean isFood() { + return type == CategoryType.FOOD; + } + public Long getId() { return id; } diff --git a/backend/src/main/java/com/funeat/product/domain/Product.java b/backend/src/main/java/com/funeat/product/domain/Product.java index eca71a02d..818217d34 100644 --- a/backend/src/main/java/com/funeat/product/domain/Product.java +++ b/backend/src/main/java/com/funeat/product/domain/Product.java @@ -1,10 +1,7 @@ package com.funeat.product.domain; -import com.funeat.member.domain.bookmark.ProductBookmark; import com.funeat.review.domain.Review; import java.util.List; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicLong; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; @@ -13,6 +10,7 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; +import org.springframework.beans.factory.annotation.Value; @Entity public class Product { @@ -31,6 +29,8 @@ public class Product { private Double averageRating = 0.0; + private Long reviewCount = 0L; + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "category_id") private Category category; @@ -41,10 +41,11 @@ public class Product { @OneToMany(mappedBy = "product") private List productRecipes; - @OneToMany(mappedBy = "product") - private List productBookmarks; + @Value("${cloud.aws.image.food}") + private String basicFoodImage; - private Long reviewCount = 0L; + @Value("${cloud.aws.image.store}") + private String basicStoreImage; protected Product() { } @@ -68,21 +69,70 @@ public Product(final String name, final Long price, final String image, final St this.category = category; } - public void updateAverageRating(final Long rating, final Long count) { + public Product(final String name, final Long price, final String image, final String content, + final Category category, final Long reviewCount) { + this.name = name; + this.price = price; + this.image = image; + this.content = content; + this.category = category; + this.reviewCount = reviewCount; + } + + public Product(final String name, final Long price, final String image, final String content, + final Double averageRating, final Category category, final Long reviewCount) { + this.name = name; + this.price = price; + this.image = image; + this.content = content; + this.averageRating = averageRating; + this.category = category; + this.reviewCount = reviewCount; + } + + public static Product create(final String name, final Long price, final String content, final Category category) { + return new Product(name, price, null, content, category); + } + + public void updateAverageRatingForInsert(final Long count, final Long rating) { final double calculatedRating = ((count - 1) * averageRating + rating) / count; this.averageRating = Math.round(calculatedRating * 10.0) / 10.0; } + public void updateAverageRatingForDelete(final Long deletedRating) { + if (reviewCount == 1) { + this.averageRating = 0.0; + return; + } + final double calculatedRating = (reviewCount * averageRating - deletedRating) / (reviewCount - 1); + this.averageRating = Math.round(calculatedRating * 10.0) / 10.0; + } + public Double calculateRankingScore(final Long reviewCount) { final double exponent = -Math.log10(reviewCount + 1); final double factor = Math.pow(2, exponent); return averageRating - (averageRating - 3.0) * factor; } - public void updateImage(final String topFavoriteImage) { + public void updateBasicImage() { + if (category.isFood()) { + this.image = basicFoodImage; + return; + } + this.image = basicStoreImage; + } + + public void updateFavoriteImage(final String topFavoriteImage) { this.image = topFavoriteImage; } + public void update(final String name, final String content, final Long price, final Category category) { + this.name = name; + this.content = content; + this.price = price; + this.category = category; + } + public Long getId() { return id; } @@ -118,4 +168,8 @@ public Long getReviewCount() { public void addReviewCount() { reviewCount++; } + + public void minusReviewCount() { + reviewCount--; + } } diff --git a/backend/src/main/java/com/funeat/product/dto/ProductInCategoryDto.java b/backend/src/main/java/com/funeat/product/dto/ProductInCategoryDto.java index 7ab4bf467..e4c73b606 100644 --- a/backend/src/main/java/com/funeat/product/dto/ProductInCategoryDto.java +++ b/backend/src/main/java/com/funeat/product/dto/ProductInCategoryDto.java @@ -21,6 +21,11 @@ public ProductInCategoryDto(final Long id, final String name, final Long price, this.reviewCount = reviewCount; } + public static ProductInCategoryDto toDto(final Product product) { + return new ProductInCategoryDto(product.getId(), product.getName(), product.getPrice(), product.getImage(), + product.getAverageRating(), product.getReviewCount()); + } + public static ProductInCategoryDto toDto(final Product product, final Long reviewCount) { return new ProductInCategoryDto(product.getId(), product.getName(), product.getPrice(), product.getImage(), product.getAverageRating(), reviewCount); diff --git a/backend/src/main/java/com/funeat/product/dto/ProductResponse.java b/backend/src/main/java/com/funeat/product/dto/ProductResponse.java index 49c5bba53..d3c0ed264 100644 --- a/backend/src/main/java/com/funeat/product/dto/ProductResponse.java +++ b/backend/src/main/java/com/funeat/product/dto/ProductResponse.java @@ -29,13 +29,13 @@ public ProductResponse(final Long id, final String name, final Long price, final this.tags = tags; } - public static ProductResponse toResponse(final Product product, final Long reviewCount, final List tags) { + public static ProductResponse toResponse(final Product product, final List tags) { List tagDtos = new ArrayList<>(); for (Tag tag : tags) { tagDtos.add(TagDto.toDto(tag)); } return new ProductResponse(product.getId(), product.getName(), product.getPrice(), product.getImage(), - product.getContent(), product.getAverageRating(), reviewCount, tagDtos); + product.getContent(), product.getAverageRating(), product.getReviewCount(), tagDtos); } public Long getId() { diff --git a/backend/src/main/java/com/funeat/product/dto/ProductSortCondition.java b/backend/src/main/java/com/funeat/product/dto/ProductSortCondition.java new file mode 100644 index 000000000..8a929f99c --- /dev/null +++ b/backend/src/main/java/com/funeat/product/dto/ProductSortCondition.java @@ -0,0 +1,25 @@ +package com.funeat.product.dto; + +public class ProductSortCondition { + + private final String by; + private final String order; + + private ProductSortCondition(final String by, final String order) { + this.by = by; + this.order = order; + } + + public static ProductSortCondition toDto(final String sort) { + final String[] split = sort.split(","); + return new ProductSortCondition(split[0], split[1]); + } + + public String getBy() { + return by; + } + + public String getOrder() { + return order; + } +} diff --git a/backend/src/main/java/com/funeat/product/dto/ProductsInCategoryResponse.java b/backend/src/main/java/com/funeat/product/dto/ProductsInCategoryResponse.java index 4712e90fb..39c685268 100644 --- a/backend/src/main/java/com/funeat/product/dto/ProductsInCategoryResponse.java +++ b/backend/src/main/java/com/funeat/product/dto/ProductsInCategoryResponse.java @@ -1,24 +1,24 @@ package com.funeat.product.dto; -import com.funeat.common.dto.PageDto; import java.util.List; public class ProductsInCategoryResponse { - private final PageDto page; + private final boolean hasNext; private final List products; - public ProductsInCategoryResponse(final PageDto page, final List products) { - this.page = page; + public ProductsInCategoryResponse(final boolean hasNext, final List products) { + this.hasNext = hasNext; this.products = products; } - public static ProductsInCategoryResponse toResponse(final PageDto page, final List products) { - return new ProductsInCategoryResponse(page, products); + public static ProductsInCategoryResponse toResponse(final boolean hasNext, + final List products) { + return new ProductsInCategoryResponse(hasNext, products); } - public PageDto getPage() { - return page; + public boolean isHasNext() { + return hasNext; } public List getProducts() { diff --git a/backend/src/main/java/com/funeat/product/exception/ProductErrorCode.java b/backend/src/main/java/com/funeat/product/exception/ProductErrorCode.java index 933f91098..e3b4d3ccc 100644 --- a/backend/src/main/java/com/funeat/product/exception/ProductErrorCode.java +++ b/backend/src/main/java/com/funeat/product/exception/ProductErrorCode.java @@ -5,6 +5,7 @@ public enum ProductErrorCode { PRODUCT_NOT_FOUND(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์ƒํ’ˆ์ž…๋‹ˆ๋‹ค. ์ƒํ’ˆ id๋ฅผ ํ™•์ธํ•˜์„ธ์š”.", "1001"), + NOT_SUPPORTED_PRODUCT_SORTING_CONDITION(HttpStatus.BAD_REQUEST, "์ •๋ ฌ ์กฐ๊ฑด์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ •๋ ฌ ์กฐ๊ฑด์„ ํ™•์ธํ•˜์„ธ์š”", "1002"); ; private final HttpStatus status; diff --git a/backend/src/main/java/com/funeat/product/exception/ProductException.java b/backend/src/main/java/com/funeat/product/exception/ProductException.java index c9b1f1720..bdbb4782b 100644 --- a/backend/src/main/java/com/funeat/product/exception/ProductException.java +++ b/backend/src/main/java/com/funeat/product/exception/ProductException.java @@ -15,4 +15,10 @@ public ProductNotFoundException(final ProductErrorCode errorCode, final Long pro super(errorCode.getStatus(), new ErrorCode<>(errorCode.getCode(), errorCode.getMessage(), productId)); } } + + public static class NotSupportedProductSortingConditionException extends ProductException { + public NotSupportedProductSortingConditionException(final ProductErrorCode errorCode, final String sortBy) { + super(errorCode.getStatus(), new ErrorCode<>(errorCode.getCode(), errorCode.getMessage(), sortBy)); + } + } } diff --git a/backend/src/main/java/com/funeat/product/persistence/ProductRepository.java b/backend/src/main/java/com/funeat/product/persistence/ProductRepository.java index ad4cdab0e..27208f254 100644 --- a/backend/src/main/java/com/funeat/product/persistence/ProductRepository.java +++ b/backend/src/main/java/com/funeat/product/persistence/ProductRepository.java @@ -1,42 +1,25 @@ package com.funeat.product.persistence; -import com.funeat.product.domain.Category; +import com.funeat.common.repository.BaseRepository; import com.funeat.product.domain.Product; -import com.funeat.product.dto.ProductInCategoryDto; import com.funeat.product.dto.ProductReviewCountDto; +import java.time.LocalDateTime; import java.util.List; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; -public interface ProductRepository extends JpaRepository { - - @Query(value = "SELECT new com.funeat.product.dto.ProductInCategoryDto(p.id, p.name, p.price, p.image, p.averageRating, COUNT(r)) " - + "FROM Product p " - + "LEFT JOIN p.reviews r " - + "WHERE p.category = :category " - + "GROUP BY p ", - countQuery = "SELECT COUNT(p) FROM Product p WHERE p.category = :category") - Page findAllByCategory(@Param("category") final Category category, final Pageable pageable); - - @Query(value = "SELECT new com.funeat.product.dto.ProductInCategoryDto(p.id, p.name, p.price, p.image, p.averageRating, COUNT(r)) " - + "FROM Product p " - + "LEFT JOIN p.reviews r " - + "WHERE p.category = :category " - + "GROUP BY p " - + "ORDER BY COUNT(r) DESC, p.id DESC ", - countQuery = "SELECT COUNT(p) FROM Product p WHERE p.category = :category") - Page findAllByCategoryOrderByReviewCountDesc(@Param("category") final Category category, - final Pageable pageable); +public interface ProductRepository extends BaseRepository { @Query("SELECT new com.funeat.product.dto.ProductReviewCountDto(p, COUNT(r.id)) " + "FROM Product p " + "LEFT JOIN Review r ON r.product.id = p.id " + "WHERE p.averageRating > 3.0 " + + "AND r.createdAt BETWEEN :startDateTime AND :endDateTime " + "GROUP BY p.id") - List findAllByAverageRatingGreaterThan3(); + List findAllByAverageRatingGreaterThan3(final LocalDateTime startDateTime, + final LocalDateTime endDateTime); @Query("SELECT p FROM Product p " + "WHERE p.name LIKE CONCAT('%', :name, '%') " diff --git a/backend/src/main/java/com/funeat/product/persistence/ProductSpecification.java b/backend/src/main/java/com/funeat/product/persistence/ProductSpecification.java new file mode 100644 index 000000000..f2dbd2ff2 --- /dev/null +++ b/backend/src/main/java/com/funeat/product/persistence/ProductSpecification.java @@ -0,0 +1,108 @@ +package com.funeat.product.persistence; + +import static com.funeat.product.exception.ProductErrorCode.NOT_SUPPORTED_PRODUCT_SORTING_CONDITION; + +import com.funeat.product.domain.Category; +import com.funeat.product.domain.Product; +import com.funeat.product.dto.ProductSortCondition; +import com.funeat.product.exception.ProductException.NotSupportedProductSortingConditionException; +import java.util.Objects; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Path; +import javax.persistence.criteria.Root; +import org.springframework.data.jpa.domain.Specification; + +public class ProductSpecification { + + private ProductSpecification() { + } + + private static final String DESC = "desc"; + private static final String CATEGORY = "category"; + private static final String ID = "id"; + private static final String REVIEW_COUNT = "reviewCount"; + private static final String AVERAGE_RATING = "averageRating"; + private static final String PRICE = "price"; + + public static Specification searchBy(final Category category, final Product lastProduct, + final ProductSortCondition sortCondition) { + return (root, query, builder) -> { + setOrderBy(sortCondition, root, query, builder); + + return Specification + .where(sameCategory(category)) + .and(nextCursor(lastProduct, sortCondition)) + .toPredicate(root, query, builder); + }; + } + + private static void setOrderBy(final ProductSortCondition sortCondition, final Root root, + final CriteriaQuery query, final CriteriaBuilder builder) { + final String sortBy = sortCondition.getBy(); + final String sortOrder = sortCondition.getOrder(); + + if (DESC.equals(sortOrder)) { + query.orderBy(builder.desc(root.get(sortBy)), builder.desc(root.get(ID))); + } else { + query.orderBy(builder.asc(root.get(sortBy)), builder.desc(root.get(ID))); + } + } + + private static Specification sameCategory(final Category category) { + return (root, query, builder) -> { + final Path categoryPath = root.get(CATEGORY); + + return builder.equal(categoryPath, category); + }; + } + + private static Specification nextCursor(final Product lastProduct, final ProductSortCondition sortCondition) { + final String sortBy = sortCondition.getBy(); + final String sortOrder = sortCondition.getOrder(); + + return (root, query, builder) -> { + if (Objects.isNull(lastProduct)) { + return null; + } + + final Comparable comparisonValue = (Comparable) getComparisonValue(lastProduct, sortBy); + + return builder.or( + sameValueAndSmallerId(sortBy, lastProduct.getId(), comparisonValue).toPredicate(root, query, builder), + nextValue(sortBy, sortOrder, comparisonValue).toPredicate(root, query, builder) + ); + }; + } + + private static Object getComparisonValue(final Product lastProduct, final String sortBy) { + if (PRICE.equals(sortBy)) { + return lastProduct.getPrice(); + } + if (AVERAGE_RATING.equals(sortBy)) { + return lastProduct.getAverageRating(); + } + if (REVIEW_COUNT.equals(sortBy)) { + return lastProduct.getReviewCount(); + } + throw new NotSupportedProductSortingConditionException(NOT_SUPPORTED_PRODUCT_SORTING_CONDITION, sortBy); + } + + private static Specification sameValueAndSmallerId(final String sortBy, final Long lastProductId, + final Comparable comparisonValue) { + return (root, query, builder) -> builder.and( + builder.equal(root.get(sortBy), comparisonValue), + builder.lessThan(root.get(ID), lastProductId)); + } + + private static Specification nextValue(final String sortBy, final String sortOrder, + final Comparable comparisonValue) { + return (root, query, builder) -> { + if (DESC.equals(sortOrder)) { + return builder.lessThan(root.get(sortBy), comparisonValue); + } else { + return builder.greaterThan(root.get(sortBy), comparisonValue); + } + }; + } +} diff --git a/backend/src/main/java/com/funeat/product/presentation/ProductApiController.java b/backend/src/main/java/com/funeat/product/presentation/ProductApiController.java index f71a1a706..46435aee7 100644 --- a/backend/src/main/java/com/funeat/product/presentation/ProductApiController.java +++ b/backend/src/main/java/com/funeat/product/presentation/ProductApiController.java @@ -2,6 +2,7 @@ import com.funeat.product.application.ProductService; import com.funeat.product.dto.ProductResponse; +import com.funeat.product.dto.ProductSortCondition; import com.funeat.product.dto.ProductsInCategoryResponse; import com.funeat.product.dto.RankingProductsResponse; import com.funeat.product.dto.SearchProductResultsResponse; @@ -29,8 +30,10 @@ public ProductApiController(final ProductService productService) { @GetMapping("/categories/{categoryId}/products") public ResponseEntity getAllProductsInCategory(@PathVariable final Long categoryId, - @PageableDefault final Pageable pageable) { - final ProductsInCategoryResponse response = productService.getAllProductsInCategory(categoryId, pageable); + @RequestParam final Long lastProductId, + @RequestParam final String sort) { + final ProductSortCondition sortCondition = ProductSortCondition.toDto(sort); + final ProductsInCategoryResponse response = productService.getAllProductsInCategory(categoryId, lastProductId, sortCondition); return ResponseEntity.ok(response); } diff --git a/backend/src/main/java/com/funeat/product/presentation/ProductController.java b/backend/src/main/java/com/funeat/product/presentation/ProductController.java index d7f9e653f..3fa704eb7 100644 --- a/backend/src/main/java/com/funeat/product/presentation/ProductController.java +++ b/backend/src/main/java/com/funeat/product/presentation/ProductController.java @@ -26,7 +26,9 @@ public interface ProductController { ) @GetMapping ResponseEntity getAllProductsInCategory( - @PathVariable(name = "category_id") final Long categoryId, @PageableDefault final Pageable pageable + @PathVariable final Long categoryId, + @RequestParam final Long lastProductId, + @RequestParam final String sort ); @Operation(summary = "ํ•ด๋‹น ์ƒํ’ˆ ์ƒ์„ธ ์กฐํšŒ", description = "ํ•ด๋‹น ์ƒํ’ˆ ์ƒ์„ธ์ •๋ณด๋ฅผ ์กฐํšŒํ•œ๋‹ค.") 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 1fd173fce..19545b20b 100644 --- a/backend/src/main/java/com/funeat/recipe/application/RecipeService.java +++ b/backend/src/main/java/com/funeat/recipe/application/RecipeService.java @@ -5,6 +5,9 @@ import static com.funeat.product.exception.ProductErrorCode.PRODUCT_NOT_FOUND; import static com.funeat.recipe.exception.RecipeErrorCode.RECIPE_NOT_FOUND; +import com.funeat.comment.domain.Comment; +import com.funeat.comment.persistence.CommentRepository; +import com.funeat.comment.specification.CommentSpecification; import com.funeat.common.ImageUploader; import com.funeat.common.dto.PageDto; import com.funeat.member.domain.Member; @@ -26,6 +29,10 @@ import com.funeat.recipe.dto.RankingRecipeDto; import com.funeat.recipe.dto.RankingRecipesResponse; import com.funeat.recipe.dto.RecipeAuthorDto; +import com.funeat.recipe.dto.RecipeCommentCondition; +import com.funeat.recipe.dto.RecipeCommentCreateRequest; +import com.funeat.recipe.dto.RecipeCommentResponse; +import com.funeat.recipe.dto.RecipeCommentsResponse; import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeDetailResponse; import com.funeat.recipe.dto.RecipeDto; @@ -36,6 +43,8 @@ import com.funeat.recipe.exception.RecipeException.RecipeNotFoundException; import com.funeat.recipe.persistence.RecipeImageRepository; import com.funeat.recipe.persistence.RecipeRepository; +import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -43,6 +52,8 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -51,8 +62,10 @@ @Transactional(readOnly = true) public class RecipeService { - private static final int THREE = 3; - private static final int TOP = 0; + private static final long RANKING_MINIMUM_FAVORITE_COUNT = 1L; + private static final int RANKING_SIZE = 3; + private static final int RECIPE_COMMENT_PAGE_SIZE = 10; + private static final int DEFAULT_CURSOR_PAGINATION_SIZE = 11; private final MemberRepository memberRepository; private final ProductRepository productRepository; @@ -60,18 +73,21 @@ public class RecipeService { private final RecipeRepository recipeRepository; private final RecipeImageRepository recipeImageRepository; private final RecipeFavoriteRepository recipeFavoriteRepository; + private final CommentRepository commentRepository; private final ImageUploader imageUploader; public RecipeService(final MemberRepository memberRepository, final ProductRepository productRepository, final ProductRecipeRepository productRecipeRepository, final RecipeRepository recipeRepository, final RecipeImageRepository recipeImageRepository, - final RecipeFavoriteRepository recipeFavoriteRepository, final ImageUploader imageUploader) { + final RecipeFavoriteRepository recipeFavoriteRepository, + final CommentRepository commentRepository, final ImageUploader imageUploader) { this.memberRepository = memberRepository; this.productRepository = productRepository; this.productRecipeRepository = productRecipeRepository; this.recipeRepository = recipeRepository; this.recipeImageRepository = recipeImageRepository; this.recipeFavoriteRepository = recipeFavoriteRepository; + this.commentRepository = commentRepository; this.imageUploader = imageUploader; } @@ -161,14 +177,15 @@ public void likeRecipe(final Long memberId, final Long recipeId, final RecipeFav .orElseThrow(() -> new RecipeNotFoundException(RECIPE_NOT_FOUND, recipeId)); final RecipeFavorite recipeFavorite = recipeFavoriteRepository.findByMemberAndRecipe(member, recipe) - .orElseGet(() -> createAndSaveRecipeFavorite(member, recipe)); + .orElseGet(() -> createAndSaveRecipeFavorite(member, recipe, request.getFavorite())); recipeFavorite.updateFavorite(request.getFavorite()); } - private RecipeFavorite createAndSaveRecipeFavorite(final Member member, final Recipe recipe) { + private RecipeFavorite createAndSaveRecipeFavorite(final Member member, final Recipe recipe, + final Boolean favorite) { try { - final RecipeFavorite recipeFavorite = RecipeFavorite.create(member, recipe); + final RecipeFavorite recipeFavorite = RecipeFavorite.create(member, recipe, favorite); return recipeFavoriteRepository.save(recipeFavorite); } catch (final DataIntegrityViolationException e) { throw new MemberDuplicateFavoriteException(MEMBER_DUPLICATE_FAVORITE, member.getId()); @@ -190,9 +207,11 @@ public SearchRecipeResultsResponse getSearchResults(final String query, final Pa } public RankingRecipesResponse getTop3Recipes() { - final List recipes = recipeRepository.findRecipesByOrderByFavoriteCountDesc(PageRequest.of(TOP, THREE)); + final List recipes = recipeRepository.findRecipesByFavoriteCountGreaterThanEqual(RANKING_MINIMUM_FAVORITE_COUNT); final List dtos = recipes.stream() + .sorted(Comparator.comparing(Recipe::calculateRankingScore).reversed()) + .limit(RANKING_SIZE) .map(recipe -> { final List findRecipeImages = recipeImageRepository.findByRecipe(recipe); final RecipeAuthorDto author = RecipeAuthorDto.toDto(recipe.getMember()); @@ -201,4 +220,63 @@ public RankingRecipesResponse getTop3Recipes() { .collect(Collectors.toList()); return RankingRecipesResponse.toResponse(dtos); } + + @Transactional + public Long writeCommentOfRecipe(final Long memberId, final Long recipeId, + final RecipeCommentCreateRequest request) { + final Member findMember = memberRepository.findById(memberId) + .orElseThrow(() -> new MemberNotFoundException(MEMBER_NOT_FOUND, memberId)); + + final Recipe findRecipe = recipeRepository.findById(recipeId) + .orElseThrow(() -> new RecipeNotFoundException(RECIPE_NOT_FOUND, recipeId)); + + final Comment comment = new Comment(findRecipe, findMember, request.getComment()); + + final Comment savedComment = commentRepository.save(comment); + return savedComment.getId(); + } + + public RecipeCommentsResponse getCommentsOfRecipe(final Long recipeId, final RecipeCommentCondition condition) { + final Recipe findRecipe = recipeRepository.findById(recipeId) + .orElseThrow(() -> new RecipeNotFoundException(RECIPE_NOT_FOUND, recipeId)); + + final Specification specification = CommentSpecification.findAllByRecipe(findRecipe, + condition.getLastId()); + + final PageRequest pageable = PageRequest.of(0, DEFAULT_CURSOR_PAGINATION_SIZE, Sort.by("id").descending()); + + final Page commentPaginationResult = commentRepository.findAllForPagination(specification, pageable, + condition.getTotalElements()); + + final List recipeCommentResponses = getRecipeCommentResponses( + commentPaginationResult.getContent()); + + final Boolean hasNext = hasNextPage(commentPaginationResult); + + return RecipeCommentsResponse.toResponse(recipeCommentResponses, hasNext, + commentPaginationResult.getTotalElements()); + } + + private List getRecipeCommentResponses(final List findComments) { + final List recipeCommentResponses = new ArrayList<>(); + final int resultSize = getResultSize(findComments); + final List comments = findComments.subList(0, resultSize); + + for (final Comment comment : comments) { + final RecipeCommentResponse recipeCommentResponse = RecipeCommentResponse.toResponse(comment); + recipeCommentResponses.add(recipeCommentResponse); + } + return recipeCommentResponses; + } + + private int getResultSize(final List findComments) { + if (findComments.size() < DEFAULT_CURSOR_PAGINATION_SIZE) { + return findComments.size(); + } + return RECIPE_COMMENT_PAGE_SIZE; + } + + private Boolean hasNextPage(final Page findComments) { + return findComments.getContent().size() > RECIPE_COMMENT_PAGE_SIZE; + } } diff --git a/backend/src/main/java/com/funeat/recipe/domain/Recipe.java b/backend/src/main/java/com/funeat/recipe/domain/Recipe.java index dcb607148..5ffb0438b 100644 --- a/backend/src/main/java/com/funeat/recipe/domain/Recipe.java +++ b/backend/src/main/java/com/funeat/recipe/domain/Recipe.java @@ -2,6 +2,7 @@ import com.funeat.member.domain.Member; import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -14,6 +15,8 @@ @Entity public class Recipe { + private static final double RANKING_GRAVITY = 0.1; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @@ -48,6 +51,21 @@ public Recipe(final String title, final String content, final Member member, this.favoriteCount = favoriteCount; } + public Recipe(final String title, final String content, final Member member, final Long favoriteCount, + final LocalDateTime createdAt) { + this.title = title; + this.content = content; + this.member = member; + this.favoriteCount = favoriteCount; + this.createdAt = createdAt; + } + + public Double calculateRankingScore() { + final long age = ChronoUnit.DAYS.between(createdAt, LocalDateTime.now()); + final double denominator = Math.pow(age + 1.0, RANKING_GRAVITY); + return favoriteCount / denominator; + } + public void addFavoriteCount() { this.favoriteCount++; } diff --git a/backend/src/main/java/com/funeat/recipe/dto/RankingRecipeDto.java b/backend/src/main/java/com/funeat/recipe/dto/RankingRecipeDto.java index c6fdcfc7c..3f26a69ca 100644 --- a/backend/src/main/java/com/funeat/recipe/dto/RankingRecipeDto.java +++ b/backend/src/main/java/com/funeat/recipe/dto/RankingRecipeDto.java @@ -2,6 +2,7 @@ import com.funeat.recipe.domain.Recipe; import com.funeat.recipe.domain.RecipeImage; +import java.time.LocalDateTime; import java.util.List; public class RankingRecipeDto { @@ -11,23 +12,26 @@ public class RankingRecipeDto { private final String title; private final RecipeAuthorDto author; private final Long favoriteCount; + private final LocalDateTime createdAt; public RankingRecipeDto(final Long id, final String image, final String title, final RecipeAuthorDto author, - final Long favoriteCount) { + final Long favoriteCount, final LocalDateTime createdAt) { this.id = id; this.image = image; this.title = title; this.author = author; this.favoriteCount = favoriteCount; + this.createdAt = createdAt; } public static RankingRecipeDto toDto(final Recipe recipe, final List images, final RecipeAuthorDto author) { if (images.isEmpty()) { - return new RankingRecipeDto(recipe.getId(), null, recipe.getTitle(), author, recipe.getFavoriteCount()); + return new RankingRecipeDto(recipe.getId(), null, recipe.getTitle(), author, + recipe.getFavoriteCount(), recipe.getCreatedAt()); } return new RankingRecipeDto(recipe.getId(), images.get(0).getImage(), recipe.getTitle(), author, - recipe.getFavoriteCount()); + recipe.getFavoriteCount(), recipe.getCreatedAt()); } public Long getId() { @@ -49,4 +53,8 @@ public RecipeAuthorDto getAuthor() { public Long getFavoriteCount() { return favoriteCount; } + + public LocalDateTime getCreatedAt() { + return createdAt; + } } diff --git a/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentCondition.java b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentCondition.java new file mode 100644 index 000000000..dcb3cf2d1 --- /dev/null +++ b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentCondition.java @@ -0,0 +1,20 @@ +package com.funeat.recipe.dto; + +public class RecipeCommentCondition { + + private final Long lastId; + private final Long totalElements; + + public RecipeCommentCondition(final Long lastId, final Long totalElements) { + this.lastId = lastId; + this.totalElements = totalElements; + } + + public Long getLastId() { + return lastId; + } + + public Long getTotalElements() { + return totalElements; + } +} diff --git a/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentCreateRequest.java b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentCreateRequest.java new file mode 100644 index 000000000..2b24e9207 --- /dev/null +++ b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentCreateRequest.java @@ -0,0 +1,20 @@ +package com.funeat.recipe.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +public class RecipeCommentCreateRequest { + + @NotBlank(message = "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์„ ํ™•์ธํ•ด ์ฃผ์„ธ์š”") + @Size(max = 200, message = "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์€ ์ตœ๋Œ€ 200์ž๊นŒ์ง€ ์ž…๋ ฅ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค") + private final String comment; + + public RecipeCommentCreateRequest(@JsonProperty("comment") final String comment) { + this.comment = comment; + } + + public String getComment() { + return comment; + } +} diff --git a/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentMemberResponse.java b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentMemberResponse.java new file mode 100644 index 000000000..ad66d7811 --- /dev/null +++ b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentMemberResponse.java @@ -0,0 +1,26 @@ +package com.funeat.recipe.dto; + +import com.funeat.member.domain.Member; + +public class RecipeCommentMemberResponse { + + private final String nickname; + private final String profileImage; + + private RecipeCommentMemberResponse(final String nickname, final String profileImage) { + this.nickname = nickname; + this.profileImage = profileImage; + } + + public static RecipeCommentMemberResponse toResponse(final Member member) { + return new RecipeCommentMemberResponse(member.getNickname(), member.getProfileImage()); + } + + public String getNickname() { + return nickname; + } + + public String getProfileImage() { + return profileImage; + } +} diff --git a/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentResponse.java b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentResponse.java new file mode 100644 index 000000000..989e52bd5 --- /dev/null +++ b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentResponse.java @@ -0,0 +1,42 @@ +package com.funeat.recipe.dto; + +import com.funeat.comment.domain.Comment; +import java.time.LocalDateTime; + +public class RecipeCommentResponse { + + private final Long id; + private final String comment; + private final LocalDateTime createdAt; + private final RecipeCommentMemberResponse author; + + private RecipeCommentResponse(final Long id, final String comment, final LocalDateTime createdAt, + final RecipeCommentMemberResponse author) { + this.id = id; + this.comment = comment; + this.createdAt = createdAt; + this.author = author; + } + + public static RecipeCommentResponse toResponse(final Comment comment) { + final RecipeCommentMemberResponse author = RecipeCommentMemberResponse.toResponse(comment.getMember()); + + return new RecipeCommentResponse(comment.getId(), comment.getComment(), comment.getCreatedAt(), author); + } + + public Long getId() { + return id; + } + + public String getComment() { + return comment; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public RecipeCommentMemberResponse getAuthor() { + return author; + } +} diff --git a/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentsResponse.java b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentsResponse.java new file mode 100644 index 000000000..7e7d6dc19 --- /dev/null +++ b/backend/src/main/java/com/funeat/recipe/dto/RecipeCommentsResponse.java @@ -0,0 +1,34 @@ +package com.funeat.recipe.dto; + +import java.util.List; + +public class RecipeCommentsResponse { + + private final List comments; + private final boolean hasNext; + private final Long totalElements; + + private RecipeCommentsResponse(final List comments, final boolean hasNext, + final Long totalElements) { + this.comments = comments; + this.hasNext = hasNext; + this.totalElements = totalElements; + } + + public static RecipeCommentsResponse toResponse(final List comments, final boolean hasNext, + final Long totalElements) { + return new RecipeCommentsResponse(comments, hasNext, totalElements); + } + + public List getComments() { + return comments; + } + + public boolean getHasNext() { + return hasNext; + } + + public Long getTotalElements() { + return totalElements; + } +} diff --git a/backend/src/main/java/com/funeat/recipe/persistence/RecipeRepository.java b/backend/src/main/java/com/funeat/recipe/persistence/RecipeRepository.java index 4d1a3a306..ce5ef3c31 100644 --- a/backend/src/main/java/com/funeat/recipe/persistence/RecipeRepository.java +++ b/backend/src/main/java/com/funeat/recipe/persistence/RecipeRepository.java @@ -32,9 +32,9 @@ public interface RecipeRepository extends JpaRepository { @Query("SELECT r FROM Recipe r LEFT JOIN ProductRecipe pr ON pr.product = :product WHERE pr.recipe.id = r.id") Page findRecipesByProduct(final Product product, final Pageable pageable); - List findRecipesByOrderByFavoriteCountDesc(final Pageable pageable); - @Lock(PESSIMISTIC_WRITE) @Query("SELECT r FROM Recipe r WHERE r.id=:id") Optional findByIdForUpdate(final Long id); + + List findRecipesByFavoriteCountGreaterThanEqual(final Long favoriteCount); } 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 8406c1645..17eb1f1d6 100644 --- a/backend/src/main/java/com/funeat/recipe/presentation/RecipeApiController.java +++ b/backend/src/main/java/com/funeat/recipe/presentation/RecipeApiController.java @@ -5,6 +5,9 @@ import com.funeat.common.logging.Logging; import com.funeat.recipe.application.RecipeService; import com.funeat.recipe.dto.RankingRecipesResponse; +import com.funeat.recipe.dto.RecipeCommentCondition; +import com.funeat.recipe.dto.RecipeCommentCreateRequest; +import com.funeat.recipe.dto.RecipeCommentsResponse; import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeDetailResponse; import com.funeat.recipe.dto.RecipeFavoriteRequest; @@ -19,6 +22,7 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -88,4 +92,22 @@ public ResponseEntity getSearchResults(@RequestPara return ResponseEntity.ok(response); } + + @PostMapping("/api/recipes/{recipeId}/comments") + public ResponseEntity writeComment(@AuthenticationPrincipal final LoginInfo loginInfo, + @PathVariable final Long recipeId, + @RequestBody @Valid final RecipeCommentCreateRequest request) { + final Long savedCommentId = recipeService.writeCommentOfRecipe(loginInfo.getId(), recipeId, request); + + return ResponseEntity.created(URI.create("/api/recipes/" + recipeId + "/" + savedCommentId)).build(); + } + + @GetMapping("/api/recipes/{recipeId}/comments") + public ResponseEntity getCommentsOfRecipe( + @AuthenticationPrincipal final LoginInfo loginInfo, @PathVariable final Long recipeId, + @ModelAttribute final RecipeCommentCondition condition) { + final RecipeCommentsResponse response = recipeService.getCommentsOfRecipe(recipeId, condition); + + 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 013c559cd..05602cc7f 100644 --- a/backend/src/main/java/com/funeat/recipe/presentation/RecipeController.java +++ b/backend/src/main/java/com/funeat/recipe/presentation/RecipeController.java @@ -3,6 +3,9 @@ import com.funeat.auth.dto.LoginInfo; import com.funeat.auth.util.AuthenticationPrincipal; import com.funeat.recipe.dto.RankingRecipesResponse; +import com.funeat.recipe.dto.RecipeCommentCondition; +import com.funeat.recipe.dto.RecipeCommentCreateRequest; +import com.funeat.recipe.dto.RecipeCommentsResponse; import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeDetailResponse; import com.funeat.recipe.dto.RecipeFavoriteRequest; @@ -16,6 +19,7 @@ import org.springframework.data.web.PageableDefault; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -80,4 +84,24 @@ ResponseEntity likeRecipe(@AuthenticationPrincipal final LoginInfo loginIn @GetMapping ResponseEntity getSearchResults(@RequestParam final String query, @PageableDefault final Pageable pageable); + + @Operation(summary = "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€ ์ž‘์„ฑ", description = "๊ฟ€์กฐํ•ฉ ์ƒ์„ธ์—์„œ ๋Œ“๊ธ€์„ ์ž‘์„ฑํ•œ๋‹ค.") + @ApiResponse( + responseCode = "201", + description = "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€ ์ž‘์„ฑ ์„ฑ๊ณต." + ) + @PostMapping("/api/recipes/{recipeId}/comments") + ResponseEntity writeComment(@AuthenticationPrincipal final LoginInfo loginInfo, + @PathVariable final Long recipeId, + @RequestBody final RecipeCommentCreateRequest request); + + @Operation(summary = "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€ ์กฐํšŒ", description = "๊ฟ€์กฐํ•ฉ ์ƒ์„ธ์—์„œ ๋Œ“๊ธ€์„ ์กฐํšŒํ•œ๋‹ค.") + @ApiResponse( + responseCode = "200", + description = "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€ ์กฐํšŒ ์„ฑ๊ณต." + ) + @GetMapping("/api/recipes/{recipeId}/comments") + ResponseEntity getCommentsOfRecipe(@AuthenticationPrincipal final LoginInfo loginInfo, + @PathVariable final Long recipeId, + @ModelAttribute final RecipeCommentCondition condition); } diff --git a/backend/src/main/java/com/funeat/review/application/ReviewDeleteEvent.java b/backend/src/main/java/com/funeat/review/application/ReviewDeleteEvent.java new file mode 100644 index 000000000..7c69eee3c --- /dev/null +++ b/backend/src/main/java/com/funeat/review/application/ReviewDeleteEvent.java @@ -0,0 +1,14 @@ +package com.funeat.review.application; + +public class ReviewDeleteEvent { + + private final String image; + + public ReviewDeleteEvent(final String image) { + this.image = image; + } + + public String getImage() { + return image; + } +} diff --git a/backend/src/main/java/com/funeat/review/application/ReviewDeleteEventListener.java b/backend/src/main/java/com/funeat/review/application/ReviewDeleteEventListener.java new file mode 100644 index 000000000..a92c4f943 --- /dev/null +++ b/backend/src/main/java/com/funeat/review/application/ReviewDeleteEventListener.java @@ -0,0 +1,27 @@ +package com.funeat.review.application; + +import com.funeat.common.ImageUploader; +import io.micrometer.core.instrument.util.StringUtils; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.springframework.transaction.event.TransactionPhase; +import org.springframework.transaction.event.TransactionalEventListener; + +@Component +public class ReviewDeleteEventListener { + + private final ImageUploader imageUploader; + + public ReviewDeleteEventListener(final ImageUploader imageUploader) { + this.imageUploader = imageUploader; + } + + @Async + @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) + public void deleteReviewImageInS3(final ReviewDeleteEvent event) { + final String image = event.getImage(); + if (!StringUtils.isBlank(image)) { + imageUploader.delete(image); + } + } +} 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 ec7020cad..a65922c82 100644 --- a/backend/src/main/java/com/funeat/review/application/ReviewService.java +++ b/backend/src/main/java/com/funeat/review/application/ReviewService.java @@ -3,6 +3,7 @@ import static com.funeat.member.exception.MemberErrorCode.MEMBER_DUPLICATE_FAVORITE; import static com.funeat.member.exception.MemberErrorCode.MEMBER_NOT_FOUND; import static com.funeat.product.exception.ProductErrorCode.PRODUCT_NOT_FOUND; +import static com.funeat.review.exception.ReviewErrorCode.NOT_AUTHOR_OF_REVIEW; import static com.funeat.review.exception.ReviewErrorCode.REVIEW_NOT_FOUND; import com.funeat.common.ImageUploader; @@ -20,24 +21,33 @@ import com.funeat.product.persistence.ProductRepository; import com.funeat.review.domain.Review; import com.funeat.review.domain.ReviewTag; +import com.funeat.review.dto.MostFavoriteReviewResponse; import com.funeat.review.dto.RankingReviewDto; import com.funeat.review.dto.RankingReviewsResponse; import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewDetailResponse; import com.funeat.review.dto.ReviewFavoriteRequest; import com.funeat.review.dto.SortingReviewDto; +import com.funeat.review.dto.SortingReviewDtoWithoutTag; +import com.funeat.review.dto.SortingReviewRequest; import com.funeat.review.dto.SortingReviewsResponse; +import com.funeat.review.exception.ReviewException.NotAuthorOfReviewException; import com.funeat.review.exception.ReviewException.ReviewNotFoundException; import com.funeat.review.persistence.ReviewRepository; import com.funeat.review.persistence.ReviewTagRepository; +import com.funeat.review.specification.SortingReviewSpecification; import com.funeat.tag.domain.Tag; import com.funeat.tag.persistence.TagRepository; +import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -46,9 +56,13 @@ @Transactional(readOnly = true) public class ReviewService { - private static final int TOP = 0; + private static final int FIRST_PAGE = 0; + private static final int START_INDEX = 0; private static final int ONE = 1; private static final String EMPTY_URL = ""; + private static final int RANKING_SIZE = 3; + private static final long RANKING_MINIMUM_FAVORITE_COUNT = 1L; + private static final int REVIEW_PAGE_SIZE = 10; private final ReviewRepository reviewRepository; private final TagRepository tagRepository; @@ -57,11 +71,13 @@ public class ReviewService { private final ProductRepository productRepository; private final ReviewFavoriteRepository reviewFavoriteRepository; private final ImageUploader imageUploader; + private final ApplicationEventPublisher eventPublisher; public ReviewService(final ReviewRepository reviewRepository, final TagRepository tagRepository, final ReviewTagRepository reviewTagRepository, final MemberRepository memberRepository, final ProductRepository productRepository, - final ReviewFavoriteRepository reviewFavoriteRepository, final ImageUploader imageUploader) { + final ReviewFavoriteRepository reviewFavoriteRepository, + final ImageUploader imageUploader, final ApplicationEventPublisher eventPublisher) { this.reviewRepository = reviewRepository; this.tagRepository = tagRepository; this.reviewTagRepository = reviewTagRepository; @@ -69,6 +85,7 @@ public ReviewService(final ReviewRepository reviewRepository, final TagRepositor this.productRepository = productRepository; this.reviewFavoriteRepository = reviewFavoriteRepository; this.imageUploader = imageUploader; + this.eventPublisher = eventPublisher; } @Transactional @@ -94,7 +111,7 @@ public void create(final Long productId, final Long memberId, final MultipartFil final Long countByProduct = reviewRepository.countByProduct(findProduct); - findProduct.updateAverageRating(savedReview.getRating(), countByProduct); + findProduct.updateAverageRatingForInsert(countByProduct, savedReview.getRating()); findProduct.addReviewCount(); reviewTagRepository.saveAll(reviewTags); } @@ -114,8 +131,7 @@ public void likeReview(final Long reviewId, final Long memberId, final ReviewFav private ReviewFavorite saveReviewFavorite(final Member member, final Review review, final Boolean favorite) { try { - final ReviewFavorite reviewFavorite = ReviewFavorite.create(member, review, - favorite); + final ReviewFavorite reviewFavorite = ReviewFavorite.create(member, review, favorite); return reviewFavoriteRepository.save(reviewFavorite); } catch (final DataIntegrityViolationException e) { throw new MemberDuplicateFavoriteException(MEMBER_DUPLICATE_FAVORITE, member.getId()); @@ -123,42 +139,85 @@ private ReviewFavorite saveReviewFavorite(final Member member, final Review revi } @Transactional - public void updateProductImage(final Long reviewId) { - final Review review = reviewRepository.findById(reviewId) - .orElseThrow(() -> new ReviewNotFoundException(REVIEW_NOT_FOUND, reviewId)); + public void updateProductImage(final Long productId) { + final Product product = productRepository.findById(productId) + .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, productId)); - final Product product = review.getProduct(); - final Long productId = product.getId(); - final PageRequest pageRequest = PageRequest.of(TOP, ONE); + final PageRequest pageRequest = PageRequest.of(FIRST_PAGE, ONE); final List topFavoriteReview = reviewRepository.findPopularReviewWithImage(productId, pageRequest); - if (!topFavoriteReview.isEmpty()) { - final String topFavoriteReviewImage = topFavoriteReview.get(TOP).getImage(); - product.updateImage(topFavoriteReviewImage); + if (topFavoriteReview.isEmpty()) { + product.updateBasicImage(); + return; } + final String topFavoriteReviewImage = topFavoriteReview.get(START_INDEX).getImage(); + product.updateFavoriteImage(topFavoriteReviewImage); } - public SortingReviewsResponse sortingReviews(final Long productId, final Pageable pageable, final Long memberId) { - final Member member = memberRepository.findById(memberId) + public SortingReviewsResponse sortingReviews(final Long productId, final Long memberId, + final SortingReviewRequest request) { + final Member findMember = memberRepository.findById(memberId) .orElseThrow(() -> new MemberNotFoundException(MEMBER_NOT_FOUND, memberId)); - - final Product product = productRepository.findById(productId) + final Product findProduct = productRepository.findById(productId) .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, productId)); - final Page reviewPage = reviewRepository.findReviewsByProduct(pageable, product); + final List sortingReviews = getSortingReviews(findMember, findProduct, request); + final int resultSize = getResultSize(sortingReviews); + + final List resizeSortingReviews = sortingReviews.subList(START_INDEX, resultSize); + final Boolean hasNext = hasNextPage(sortingReviews); + + return SortingReviewsResponse.toResponse(resizeSortingReviews, hasNext); + } + + private List getSortingReviews(final Member member, final Product product, + final SortingReviewRequest request) { + final Long lastReviewId = request.getLastReviewId(); + final String sortOption = request.getSort(); + + final Specification specification = getSortingSpecification(product, sortOption, lastReviewId); + final List sortingReviewDtoWithoutTags = reviewRepository.getSortingReview(member, + specification, sortOption); - final PageDto pageDto = PageDto.toDto(reviewPage); - final List reviewDtos = reviewPage.stream() - .map(review -> SortingReviewDto.toDto(review, member)) + return addTagsToSortingReviews(sortingReviewDtoWithoutTags); + } + + private List addTagsToSortingReviews( + final List sortingReviewDtoWithoutTags) { + return sortingReviewDtoWithoutTags.stream() + .map(reviewDto -> SortingReviewDto.toDto(reviewDto, + tagRepository.findTagsByReviewId(reviewDto.getId()))) .collect(Collectors.toList()); + } - return SortingReviewsResponse.toResponse(pageDto, reviewDtos); + private Specification getSortingSpecification(final Product product, final String sortOption, + final Long lastReviewId) { + if (lastReviewId == FIRST_PAGE) { + return SortingReviewSpecification.sortingFirstPageBy(product); + } + + final Review lastReview = reviewRepository.findById(lastReviewId) + .orElseThrow(() -> new ReviewNotFoundException(REVIEW_NOT_FOUND, lastReviewId)); + + return SortingReviewSpecification.sortingBy(product, sortOption, lastReview); } - public RankingReviewsResponse getTopReviews() { - final List rankingReviews = reviewRepository.findTop3ByOrderByFavoriteCountDesc(); + private int getResultSize(final List sortingReviews) { + if (sortingReviews.size() <= REVIEW_PAGE_SIZE) { + return sortingReviews.size(); + } + return REVIEW_PAGE_SIZE; + } + + private Boolean hasNextPage(final List sortingReviews) { + return sortingReviews.size() > REVIEW_PAGE_SIZE; + } - final List dtos = rankingReviews.stream() + public RankingReviewsResponse getTopReviews() { + final List reviews = reviewRepository.findReviewsByFavoriteCountGreaterThanEqual(RANKING_MINIMUM_FAVORITE_COUNT); + final List dtos = reviews.stream() + .sorted(Comparator.comparing(Review::calculateRankingScore).reversed()) + .limit(RANKING_SIZE) .map(RankingReviewDto::toDto) .collect(Collectors.toList()); @@ -178,4 +237,65 @@ public MemberReviewsResponse findReviewByMember(final Long memberId, final Pagea return MemberReviewsResponse.toResponse(pageDto, dtos); } + + @Transactional + public void deleteReview(final Long reviewId, final Long memberId) { + final Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MemberNotFoundException(MEMBER_NOT_FOUND, memberId)); + final Review review = reviewRepository.findById(reviewId) + .orElseThrow(() -> new ReviewNotFoundException(REVIEW_NOT_FOUND, reviewId)); + final Product product = review.getProduct(); + final String image = review.getImage(); + + if (review.checkAuthor(member)) { + eventPublisher.publishEvent(new ReviewDeleteEvent(image)); + deleteThingsRelatedToReview(review); + updateProduct(product, review.getRating()); + return; + } + throw new NotAuthorOfReviewException(NOT_AUTHOR_OF_REVIEW, memberId); + } + + private void deleteThingsRelatedToReview(final Review review) { + deleteReviewTags(review); + deleteReviewFavorites(review); + reviewRepository.delete(review); + } + + private void deleteReviewTags(final Review review) { + final List reviewTags = reviewTagRepository.findByReview(review); + final List ids = reviewTags.stream() + .map(ReviewTag::getId) + .collect(Collectors.toList()); + reviewTagRepository.deleteAllByIdInBatch(ids); + } + + private void deleteReviewFavorites(final Review review) { + final List reviewFavorites = reviewFavoriteRepository.findByReview(review); + final List ids = reviewFavorites.stream() + .map(ReviewFavorite::getId) + .collect(Collectors.toList()); + reviewFavoriteRepository.deleteAllByIdInBatch(ids); + } + + private void updateProduct(final Product product, final Long deletedRating) { + product.updateAverageRatingForDelete(deletedRating); + product.minusReviewCount(); + updateProductImage(product.getId()); + } + + public Optional getMostFavoriteReview(final Long productId) { + final Product findProduct = productRepository.findById(productId) + .orElseThrow(() -> new ProductNotFoundException(PRODUCT_NOT_FOUND, productId)); + + final Optional review = reviewRepository.findTopByProductOrderByFavoriteCountDescIdDesc(findProduct); + + return MostFavoriteReviewResponse.toResponse(review); + } + + public ReviewDetailResponse getReviewDetail(final Long reviewId) { + final Review review = reviewRepository.findById(reviewId) + .orElseThrow(() -> new ReviewNotFoundException(REVIEW_NOT_FOUND, reviewId)); + return ReviewDetailResponse.toResponse(review); + } } diff --git a/backend/src/main/java/com/funeat/review/domain/Review.java b/backend/src/main/java/com/funeat/review/domain/Review.java index 3545371e3..9b1a458d3 100644 --- a/backend/src/main/java/com/funeat/review/domain/Review.java +++ b/backend/src/main/java/com/funeat/review/domain/Review.java @@ -4,6 +4,7 @@ import com.funeat.member.domain.favorite.ReviewFavorite; import com.funeat.product.domain.Product; import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -20,6 +21,8 @@ @Entity public class Review { + private static final double RANKING_GRAVITY = 0.5; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @@ -80,6 +83,18 @@ public Review(final Member member, final Product findProduct, final String image this.favoriteCount = favoriteCount; } + public Review(final Member member, final Product findProduct, final String image, final Long rating, + final String content, final Boolean reBuy, final Long favoriteCount, final LocalDateTime createdAt) { + this.member = member; + this.product = findProduct; + this.image = image; + this.rating = rating; + this.content = content; + this.reBuy = reBuy; + this.favoriteCount = favoriteCount; + this.createdAt = createdAt; + } + public void addFavoriteCount() { this.favoriteCount++; } @@ -88,6 +103,16 @@ public void minusFavoriteCount() { this.favoriteCount--; } + public Double calculateRankingScore() { + final long age = ChronoUnit.DAYS.between(createdAt, LocalDateTime.now()); + final double denominator = Math.pow(age + 1.0, RANKING_GRAVITY); + return favoriteCount / denominator; + } + + public boolean checkAuthor(final Member member) { + return Objects.equals(this.member, member); + } + public Long getId() { return id; } diff --git a/backend/src/main/java/com/funeat/review/dto/MostFavoriteReviewResponse.java b/backend/src/main/java/com/funeat/review/dto/MostFavoriteReviewResponse.java new file mode 100644 index 000000000..0d1352f80 --- /dev/null +++ b/backend/src/main/java/com/funeat/review/dto/MostFavoriteReviewResponse.java @@ -0,0 +1,106 @@ +package com.funeat.review.dto; + +import com.funeat.review.domain.Review; +import com.funeat.review.domain.ReviewTag; +import com.funeat.tag.dto.TagDto; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +public class MostFavoriteReviewResponse { + + private final Long id; + private final String userName; + private final String profileImage; + private final String image; + private final Long rating; + private final List tags; + private final String content; + private final Boolean rebuy; + private final Long favoriteCount; + private final LocalDateTime createdAt; + + public MostFavoriteReviewResponse(final Long id, final String userName, final String profileImage, + final String image, final Long rating, final List tags, + final String content, final boolean rebuy, final Long favoriteCount, + final LocalDateTime createdAt) { + this.id = id; + this.userName = userName; + this.profileImage = profileImage; + this.image = image; + this.rating = rating; + this.tags = tags; + this.content = content; + this.rebuy = rebuy; + this.favoriteCount = favoriteCount; + this.createdAt = createdAt; + } + + public static Optional toResponse(final Optional nullableReview) { + if (nullableReview.isEmpty()) { + return Optional.empty(); + } + + final Review review = nullableReview.get(); + return Optional.of(new MostFavoriteReviewResponse( + review.getId(), + review.getMember().getNickname(), + review.getMember().getProfileImage(), + review.getImage(), + review.getRating(), + findTagDtos(review), + review.getContent(), + review.getReBuy(), + review.getFavoriteCount(), + review.getCreatedAt() + )); + } + + private static List findTagDtos(final Review review) { + return review.getReviewTags().stream() + .map(ReviewTag::getTag) + .map(TagDto::toDto) + .collect(Collectors.toList()); + } + + public Long getId() { + return id; + } + + public String getUserName() { + return userName; + } + + public String getProfileImage() { + return profileImage; + } + + public String getImage() { + return image; + } + + public Long getRating() { + return rating; + } + + public List getTags() { + return tags; + } + + public String getContent() { + return content; + } + + public Boolean isRebuy() { + return rebuy; + } + + public Long getFavoriteCount() { + return favoriteCount; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } +} diff --git a/backend/src/main/java/com/funeat/review/dto/RankingReviewDto.java b/backend/src/main/java/com/funeat/review/dto/RankingReviewDto.java index cecbe2cec..5ac70bb59 100644 --- a/backend/src/main/java/com/funeat/review/dto/RankingReviewDto.java +++ b/backend/src/main/java/com/funeat/review/dto/RankingReviewDto.java @@ -1,6 +1,7 @@ package com.funeat.review.dto; import com.funeat.review.domain.Review; +import java.time.LocalDateTime; public class RankingReviewDto { @@ -11,10 +12,11 @@ public class RankingReviewDto { private final String content; private final Long rating; private final Long favoriteCount; + private final LocalDateTime createdAt; private RankingReviewDto(final Long reviewId, final Long productId, final String categoryType, final String productName, final String content, - final Long rating, final Long favoriteCount) { + final Long rating, final Long favoriteCount, final LocalDateTime createdAt) { this.reviewId = reviewId; this.productId = productId; this.categoryType = categoryType; @@ -22,6 +24,7 @@ private RankingReviewDto(final Long reviewId, final Long productId, final String this.content = content; this.rating = rating; this.favoriteCount = favoriteCount; + this.createdAt = createdAt; } public static RankingReviewDto toDto(final Review review) { @@ -32,8 +35,8 @@ public static RankingReviewDto toDto(final Review review) { review.getProduct().getName(), review.getContent(), review.getRating(), - review.getFavoriteCount() - ); + review.getFavoriteCount(), + review.getCreatedAt()); } public Long getReviewId() { @@ -63,4 +66,8 @@ public Long getFavoriteCount() { public String getCategoryType() { return categoryType; } + + public LocalDateTime getCreatedAt() { + return createdAt; + } } diff --git a/backend/src/main/java/com/funeat/review/dto/ReviewDetailResponse.java b/backend/src/main/java/com/funeat/review/dto/ReviewDetailResponse.java new file mode 100644 index 000000000..7e0c9858b --- /dev/null +++ b/backend/src/main/java/com/funeat/review/dto/ReviewDetailResponse.java @@ -0,0 +1,121 @@ +package com.funeat.review.dto; + +import com.funeat.review.domain.Review; +import com.funeat.review.domain.ReviewTag; +import com.funeat.tag.dto.TagDto; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +public class ReviewDetailResponse { + + private final Long id; + private final String userName; + private final String profileImage; + private final String image; + private final Long rating; + private final List tags; + private final String content; + private final boolean rebuy; + private final Long favoriteCount; + private final LocalDateTime createdAt; + private final String categoryType; + private final Long productId; + private final String productName; + + public ReviewDetailResponse(final Long id, final String userName, final String profileImage, final String image, + final Long rating, final List tags, final String content, final boolean rebuy, + final Long favoriteCount, final LocalDateTime createdAt, final String categoryType, + final Long productId, final String productName) { + this.id = id; + this.userName = userName; + this.profileImage = profileImage; + this.image = image; + this.rating = rating; + this.tags = tags; + this.content = content; + this.rebuy = rebuy; + this.favoriteCount = favoriteCount; + this.createdAt = createdAt; + this.categoryType = categoryType; + this.productId = productId; + this.productName = productName; + } + + public static ReviewDetailResponse toResponse(final Review review) { + return new ReviewDetailResponse( + review.getId(), + review.getMember().getNickname(), + review.getMember().getProfileImage(), + review.getImage(), + review.getRating(), + findTagDtos(review), + review.getContent(), + review.getReBuy(), + review.getFavoriteCount(), + review.getCreatedAt(), + review.getProduct().getCategory().getType().getName(), + review.getProduct().getId(), + review.getProduct().getName() + ); + } + + private static List findTagDtos(final Review review) { + return review.getReviewTags().stream() + .map(ReviewTag::getTag) + .map(TagDto::toDto) + .collect(Collectors.toList()); + } + + public Long getId() { + return id; + } + + public String getUserName() { + return userName; + } + + public String getProfileImage() { + return profileImage; + } + + public String getImage() { + return image; + } + + public Long getRating() { + return rating; + } + + public List getTags() { + return tags; + } + + public String getContent() { + return content; + } + + public boolean isRebuy() { + return rebuy; + } + + public Long getFavoriteCount() { + return favoriteCount; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public String getCategoryType() { + return categoryType; + } + + public Long getProductId() { + return productId; + } + + public String getProductName() { + return productName; + } +} diff --git a/backend/src/main/java/com/funeat/review/dto/SortingReviewDto.java b/backend/src/main/java/com/funeat/review/dto/SortingReviewDto.java index 7254dd6c1..1231d0058 100644 --- a/backend/src/main/java/com/funeat/review/dto/SortingReviewDto.java +++ b/backend/src/main/java/com/funeat/review/dto/SortingReviewDto.java @@ -1,12 +1,16 @@ package com.funeat.review.dto; +import com.fasterxml.jackson.annotation.JsonCreator; import com.funeat.member.domain.Member; import com.funeat.member.domain.favorite.ReviewFavorite; import com.funeat.review.domain.Review; import com.funeat.review.domain.ReviewTag; +import com.funeat.tag.domain.Tag; import com.funeat.tag.dto.TagDto; import java.time.LocalDateTime; +import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; public class SortingReviewDto { @@ -23,6 +27,7 @@ public class SortingReviewDto { private final boolean favorite; private final LocalDateTime createdAt; + @JsonCreator public SortingReviewDto(final Long id, final String userName, final String profileImage, final String image, final Long rating, final List tags, final String content, final boolean rebuy, final Long favoriteCount, final boolean favorite, @@ -40,37 +45,23 @@ public SortingReviewDto(final Long id, final String userName, final String profi this.createdAt = createdAt; } - public static SortingReviewDto toDto(final Review review, final Member member) { - return new SortingReviewDto( - review.getId(), - review.getMember().getNickname(), - review.getMember().getProfileImage(), - review.getImage(), - review.getRating(), - findTagDtos(review), - review.getContent(), - review.getReBuy(), - review.getFavoriteCount(), - findReviewFavoriteChecked(review, member), - review.getCreatedAt() - ); - } - - private static List findTagDtos(final Review review) { - return review.getReviewTags().stream() - .map(ReviewTag::getTag) + public static SortingReviewDto toDto(final SortingReviewDtoWithoutTag sortingReviewDto, final List tags) { + final List tagDtos = tags.stream() .map(TagDto::toDto) .collect(Collectors.toList()); - } - private static boolean findReviewFavoriteChecked(final Review review, final Member member) { - return review.getReviewFavorites() - .stream() - .filter(reviewFavorite -> reviewFavorite.getReview().equals(review)) - .filter(reviewFavorite -> reviewFavorite.getMember().equals(member)) - .findFirst() - .map(ReviewFavorite::getFavorite) - .orElse(false); + return new SortingReviewDto( + sortingReviewDto.getId(), + sortingReviewDto.getUserName(), + sortingReviewDto.getProfileImage(), + sortingReviewDto.getImage(), + sortingReviewDto.getRating(), + tagDtos, + sortingReviewDto.getContent(), + sortingReviewDto.getRebuy(), + sortingReviewDto.getFavoriteCount(), + sortingReviewDto.getFavorite(), + sortingReviewDto.getCreatedAt()); } public Long getId() { @@ -101,7 +92,7 @@ public String getContent() { return content; } - public boolean isRebuy() { + public boolean getRebuy() { return rebuy; } @@ -109,7 +100,7 @@ public Long getFavoriteCount() { return favoriteCount; } - public boolean isFavorite() { + public boolean getFavorite() { return favorite; } diff --git a/backend/src/main/java/com/funeat/review/dto/SortingReviewDtoWithoutTag.java b/backend/src/main/java/com/funeat/review/dto/SortingReviewDtoWithoutTag.java new file mode 100644 index 000000000..b58ac7165 --- /dev/null +++ b/backend/src/main/java/com/funeat/review/dto/SortingReviewDtoWithoutTag.java @@ -0,0 +1,84 @@ +package com.funeat.review.dto; + +import java.time.LocalDateTime; +import java.util.Objects; + +public class SortingReviewDtoWithoutTag { + + private final Long id; + private final String userName; + private final String profileImage; + private final String image; + private final Long rating; + private final String content; + private final boolean rebuy; + private final Long favoriteCount; + private final boolean favorite; + private final LocalDateTime createdAt; + + public SortingReviewDtoWithoutTag(final Long id, final String userName, final String profileImage, + final String image, final Long rating, + final String content, final boolean rebuy, final Long favoriteCount, + final Boolean favorite, + final LocalDateTime createdAt) { + final Boolean isFavorite = checkingFavorite(favorite); + + this.id = id; + this.userName = userName; + this.profileImage = profileImage; + this.image = image; + this.rating = rating; + this.content = content; + this.rebuy = rebuy; + this.favoriteCount = favoriteCount; + this.favorite = isFavorite; + this.createdAt = createdAt; + } + + private static Boolean checkingFavorite(final Boolean favorite) { + if (Objects.isNull(favorite)) { + return Boolean.FALSE; + } + return favorite; + } + + public Long getId() { + return id; + } + + public String getUserName() { + return userName; + } + + public String getProfileImage() { + return profileImage; + } + + public String getImage() { + return image; + } + + public Long getRating() { + return rating; + } + + public String getContent() { + return content; + } + + public boolean getRebuy() { + return rebuy; + } + + public Long getFavoriteCount() { + return favoriteCount; + } + + public boolean getFavorite() { + return favorite; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } +} diff --git a/backend/src/main/java/com/funeat/review/dto/SortingReviewRequest.java b/backend/src/main/java/com/funeat/review/dto/SortingReviewRequest.java new file mode 100644 index 000000000..b6bdeb1eb --- /dev/null +++ b/backend/src/main/java/com/funeat/review/dto/SortingReviewRequest.java @@ -0,0 +1,27 @@ +package com.funeat.review.dto; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.PositiveOrZero; + +public class SortingReviewRequest { + + @NotNull(message = "์ •๋ ฌ ์กฐ๊ฑด์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”") + private String sort; + + @NotNull(message = "๋งˆ์ง€๋ง‰์œผ๋กœ ์กฐํšŒํ•œ ๋ฆฌ๋ทฐ ID๋ฅผ ํ™•์ธํ•ด์ฃผ์„ธ์š”") + @PositiveOrZero(message = "๋งˆ์ง€๋ง‰์œผ๋กœ ์กฐํšŒํ•œ ID๋Š” 0 ์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. (์ฒ˜์Œ ์กฐํšŒํ•˜๋ฉด 0)") + private Long lastReviewId; + + public SortingReviewRequest(final String sort, final Long lastReviewId) { + this.sort = sort; + this.lastReviewId = lastReviewId; + } + + public String getSort() { + return sort; + } + + public Long getLastReviewId() { + return lastReviewId; + } +} diff --git a/backend/src/main/java/com/funeat/review/dto/SortingReviewsResponse.java b/backend/src/main/java/com/funeat/review/dto/SortingReviewsResponse.java index caf1ea155..1dc082fe0 100644 --- a/backend/src/main/java/com/funeat/review/dto/SortingReviewsResponse.java +++ b/backend/src/main/java/com/funeat/review/dto/SortingReviewsResponse.java @@ -1,27 +1,26 @@ package com.funeat.review.dto; -import com.funeat.common.dto.PageDto; import java.util.List; public class SortingReviewsResponse { - private final PageDto page; private final List reviews; + private final Boolean hasNext; - public SortingReviewsResponse(final PageDto page, final List reviews) { - this.page = page; + public SortingReviewsResponse(final List reviews, final Boolean hasNext) { this.reviews = reviews; + this.hasNext = hasNext; } - public static SortingReviewsResponse toResponse(final PageDto page, final List reviews) { - return new SortingReviewsResponse(page, reviews); - } - - public PageDto getPage() { - return page; + public static SortingReviewsResponse toResponse(final List reviews, final Boolean hasNextReview) { + return new SortingReviewsResponse(reviews, hasNextReview); } public List getReviews() { return reviews; } + + public Boolean getHasNext() { + return hasNext; + } } diff --git a/backend/src/main/java/com/funeat/review/exception/ReviewErrorCode.java b/backend/src/main/java/com/funeat/review/exception/ReviewErrorCode.java index d91c0c8c3..2f5fb5c64 100644 --- a/backend/src/main/java/com/funeat/review/exception/ReviewErrorCode.java +++ b/backend/src/main/java/com/funeat/review/exception/ReviewErrorCode.java @@ -5,6 +5,8 @@ public enum ReviewErrorCode { REVIEW_NOT_FOUND(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋ฆฌ๋ทฐ์ž…๋‹ˆ๋‹ค. ๋ฆฌ๋ทฐ id๋ฅผ ํ™•์ธํ•˜์„ธ์š”.", "3001"), + NOT_SUPPORTED_REVIEW_SORTING_CONDITION(HttpStatus.BAD_REQUEST, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์ •๋ ฌ ์˜ต์…˜์ž…๋‹ˆ๋‹ค. ์ •๋ ฌ ์˜ต์…˜์„ ํ™•์ธํ•˜์„ธ์š”.", "3002"), + NOT_AUTHOR_OF_REVIEW(HttpStatus.BAD_REQUEST, "ํ•ด๋‹น ๋ฆฌ๋ทฐ๋ฅผ ์ž‘์„ฑํ•œ ํšŒ์›์ด ์•„๋‹™๋‹ˆ๋‹ค", "3003") ; private final HttpStatus status; diff --git a/backend/src/main/java/com/funeat/review/exception/ReviewException.java b/backend/src/main/java/com/funeat/review/exception/ReviewException.java index 4699f3af6..85fd3f666 100644 --- a/backend/src/main/java/com/funeat/review/exception/ReviewException.java +++ b/backend/src/main/java/com/funeat/review/exception/ReviewException.java @@ -15,4 +15,16 @@ public ReviewNotFoundException(final ReviewErrorCode errorCode, final Long revie super(errorCode.getStatus(), new ErrorCode<>(errorCode.getCode(), errorCode.getMessage(), reviewId)); } } + + public static class NotSupportedReviewSortingConditionException extends ReviewException { + public NotSupportedReviewSortingConditionException(final ReviewErrorCode errorCode, final String sortFieldName) { + super(errorCode.getStatus(), new ErrorCode<>(errorCode.getCode(), errorCode.getMessage(), sortFieldName)); + } + } + + public static class NotAuthorOfReviewException extends ReviewException { + public NotAuthorOfReviewException(final ReviewErrorCode errorCode, final Long memberId) { + super(errorCode.getStatus(), new ErrorCode<>(errorCode.getCode(), errorCode.getMessage(), memberId)); + } + } } diff --git a/backend/src/main/java/com/funeat/review/persistence/ReviewCustomRepository.java b/backend/src/main/java/com/funeat/review/persistence/ReviewCustomRepository.java new file mode 100644 index 000000000..e2dd79992 --- /dev/null +++ b/backend/src/main/java/com/funeat/review/persistence/ReviewCustomRepository.java @@ -0,0 +1,14 @@ +package com.funeat.review.persistence; + +import com.funeat.member.domain.Member; +import com.funeat.review.domain.Review; +import com.funeat.review.dto.SortingReviewDtoWithoutTag; +import java.util.List; +import org.springframework.data.jpa.domain.Specification; + +public interface ReviewCustomRepository { + + List getSortingReview(final Member loginMember, + final Specification specification, + final String sortField); +} diff --git a/backend/src/main/java/com/funeat/review/persistence/ReviewRepository.java b/backend/src/main/java/com/funeat/review/persistence/ReviewRepository.java index 0fa4e050a..69d35018d 100644 --- a/backend/src/main/java/com/funeat/review/persistence/ReviewRepository.java +++ b/backend/src/main/java/com/funeat/review/persistence/ReviewRepository.java @@ -14,11 +14,7 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; -public interface ReviewRepository extends JpaRepository { - - Page findReviewsByProduct(final Pageable pageable, final Product product); - - List findTop3ByOrderByFavoriteCountDesc(); +public interface ReviewRepository extends JpaRepository, ReviewCustomRepository { Long countByProduct(final Product product); @@ -34,4 +30,8 @@ public interface ReviewRepository extends JpaRepository { + "WHERE p.id = :id AND r.image != '' " + "ORDER BY r.favoriteCount DESC, r.id DESC") List findPopularReviewWithImage(@Param("id") final Long productId, final Pageable pageable); + + Optional findTopByProductOrderByFavoriteCountDescIdDesc(final Product product); + + List findReviewsByFavoriteCountGreaterThanEqual(final Long favoriteCount); } diff --git a/backend/src/main/java/com/funeat/review/persistence/ReviewRepositoryImpl.java b/backend/src/main/java/com/funeat/review/persistence/ReviewRepositoryImpl.java new file mode 100644 index 000000000..ae47f7127 --- /dev/null +++ b/backend/src/main/java/com/funeat/review/persistence/ReviewRepositoryImpl.java @@ -0,0 +1,91 @@ +package com.funeat.review.persistence; + +import com.funeat.member.domain.Member; +import com.funeat.member.domain.favorite.ReviewFavorite; +import com.funeat.review.domain.Review; +import com.funeat.review.dto.SortingReviewDtoWithoutTag; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CompoundSelection; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Join; +import javax.persistence.criteria.JoinType; +import javax.persistence.criteria.Order; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Repository; + +@Repository +public class ReviewRepositoryImpl implements ReviewCustomRepository { + + @PersistenceContext + private EntityManager em; + + @Override + public List getSortingReview(final Member loginMember, + final Specification specification, + final String sortOption) { + final CriteriaBuilder cb = em.getCriteriaBuilder(); + final CriteriaQuery cq = cb.createQuery(SortingReviewDtoWithoutTag.class); + final Root root = cq.from(Review.class); + + // sortField, sortOrder + final String[] sortOptionSplit = sortOption.split(","); + final String sortField = sortOptionSplit[0]; + final String sortOrder = sortOptionSplit[1]; + + // join + final Join joinMember = root.join("member", JoinType.INNER); + + // left join + final Join leftJoinReviewFavorite = root.join("reviewFavorites", JoinType.LEFT); + final Predicate condition = cb.equal(leftJoinReviewFavorite.get("member"), loginMember); + leftJoinReviewFavorite.on(condition); + + // select - from - where - order by + cq.select(getConstruct(root, cb, joinMember, leftJoinReviewFavorite)) + .where(specification.toPredicate(root, cq, cb)) + .orderBy(getOrderBy(root, cb, sortField, sortOrder)); + + // limit + final TypedQuery query = em.createQuery(cq); + query.setMaxResults(11); + + // result + return query.getResultList(); + } + + private CompoundSelection getConstruct(final Root root, + final CriteriaBuilder cb, + final Join joinMember, + final Join leftJoinReviewFavorite) { + + return cb.construct(SortingReviewDtoWithoutTag.class, + root.get("id"), + joinMember.get("nickname"), + joinMember.get("profileImage"), + root.get("image"), + root.get("rating"), + root.get("content"), + root.get("reBuy"), + root.get("favoriteCount"), + leftJoinReviewFavorite.get("favorite"), + root.get("createdAt")); + } + + private List getOrderBy(final Root root, + final CriteriaBuilder cb, + final String fieldName, + final String sortOption) { + if ("ASC".equalsIgnoreCase(sortOption)) { + final Order order = cb.asc(root.get(fieldName)); + return List.of(order, cb.desc(root.get("id"))); + } + final Order order = cb.desc(root.get(fieldName)); + return List.of(order, cb.desc(root.get("id"))); + } +} diff --git a/backend/src/main/java/com/funeat/review/persistence/ReviewTagRepository.java b/backend/src/main/java/com/funeat/review/persistence/ReviewTagRepository.java index 7129a711c..cbdf3c3bf 100644 --- a/backend/src/main/java/com/funeat/review/persistence/ReviewTagRepository.java +++ b/backend/src/main/java/com/funeat/review/persistence/ReviewTagRepository.java @@ -1,5 +1,6 @@ package com.funeat.review.persistence; +import com.funeat.review.domain.Review; import com.funeat.review.domain.ReviewTag; import com.funeat.tag.domain.Tag; import java.util.List; @@ -16,4 +17,8 @@ public interface ReviewTagRepository extends JpaRepository { + "GROUP BY rt.tag " + "ORDER BY cnt DESC") List findTop3TagsByReviewIn(final Long productId, final Pageable pageable); + + void deleteByReview(final Review review); + + List findByReview(final Review review); } 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 00c7683b6..ff82ff499 100644 --- a/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java +++ b/backend/src/main/java/com/funeat/review/presentation/ReviewApiController.java @@ -4,17 +4,20 @@ import com.funeat.auth.util.AuthenticationPrincipal; import com.funeat.common.logging.Logging; import com.funeat.review.application.ReviewService; +import com.funeat.review.dto.MostFavoriteReviewResponse; import com.funeat.review.dto.RankingReviewsResponse; import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewDetailResponse; import com.funeat.review.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.SortingReviewRequest; import com.funeat.review.dto.SortingReviewsResponse; import java.net.URI; +import java.util.Optional; 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.ModelAttribute; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -46,11 +49,12 @@ public ResponseEntity writeReview(@PathVariable final Long productId, @Logging @PatchMapping("/api/products/{productId}/reviews/{reviewId}") - public ResponseEntity toggleLikeReview(@PathVariable final Long reviewId, + public ResponseEntity toggleLikeReview(@PathVariable final Long productId, + @PathVariable final Long reviewId, @AuthenticationPrincipal final LoginInfo loginInfo, @RequestBody @Valid final ReviewFavoriteRequest request) { reviewService.likeReview(reviewId, loginInfo.getId(), request); - reviewService.updateProductImage(reviewId); + reviewService.updateProductImage(productId); return ResponseEntity.noContent().build(); } @@ -58,8 +62,8 @@ public ResponseEntity toggleLikeReview(@PathVariable final Long reviewId, @GetMapping("/api/products/{productId}/reviews") public ResponseEntity getSortingReviews(@AuthenticationPrincipal final LoginInfo loginInfo, @PathVariable final Long productId, - @PageableDefault final Pageable pageable) { - final SortingReviewsResponse response = reviewService.sortingReviews(productId, pageable, loginInfo.getId()); + @ModelAttribute final SortingReviewRequest request) { + final SortingReviewsResponse response = reviewService.sortingReviews(productId, loginInfo.getId(), request); return ResponseEntity.ok(response); } @@ -70,4 +74,21 @@ public ResponseEntity getRankingReviews() { return ResponseEntity.ok(response); } + + @GetMapping("/api/ranks/products/{productId}/reviews") + public ResponseEntity> getMostFavoriteReview(@PathVariable final Long productId) { + final Optional response = reviewService.getMostFavoriteReview(productId); + + if (response.isEmpty()) { + return ResponseEntity.noContent().build(); + } + return ResponseEntity.ok(response); + } + + @GetMapping("/api/reviews/{reviewId}") + public ResponseEntity getReviewDetail(@PathVariable final Long reviewId) { + final ReviewDetailResponse response = reviewService.getReviewDetail(reviewId); + + return ResponseEntity.ok(response); + } } 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 574e50fb4..13fb85e94 100644 --- a/backend/src/main/java/com/funeat/review/presentation/ReviewController.java +++ b/backend/src/main/java/com/funeat/review/presentation/ReviewController.java @@ -2,17 +2,20 @@ import com.funeat.auth.dto.LoginInfo; import com.funeat.auth.util.AuthenticationPrincipal; +import com.funeat.review.dto.MostFavoriteReviewResponse; import com.funeat.review.dto.RankingReviewsResponse; import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewDetailResponse; import com.funeat.review.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.SortingReviewRequest; 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; -import org.springframework.data.domain.Pageable; -import org.springframework.data.web.PageableDefault; +import java.util.Optional; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -40,7 +43,8 @@ ResponseEntity writeReview(@PathVariable final Long productId, description = "๋ฆฌ๋ทฐ ์ข‹์•„์š”(์ทจ์†Œ) ์„ฑ๊ณต." ) @PatchMapping - ResponseEntity toggleLikeReview(@PathVariable final Long reviewId, + ResponseEntity toggleLikeReview(@PathVariable final Long productId, + @PathVariable final Long reviewId, @AuthenticationPrincipal final LoginInfo loginInfo, @RequestBody final ReviewFavoriteRequest request); @@ -52,7 +56,7 @@ ResponseEntity toggleLikeReview(@PathVariable final Long reviewId, @GetMapping ResponseEntity getSortingReviews(@AuthenticationPrincipal final LoginInfo loginInfo, @PathVariable final Long productId, - @PageableDefault final Pageable pageable); + @ModelAttribute final SortingReviewRequest request); @Operation(summary = "๋ฆฌ๋ทฐ ๋žญํ‚น Top3 ์กฐํšŒ", description = "๋ฆฌ๋ทฐ ๋žญํ‚น Top3 ์กฐํšŒํ•œ๋‹ค.") @ApiResponse( @@ -61,4 +65,20 @@ ResponseEntity getSortingReviews(@AuthenticationPrincipa ) @GetMapping ResponseEntity getRankingReviews(); + + @Operation(summary = "์ข‹์•„์š”๋ฅผ ์ œ์ผ ๋งŽ์€ ๋ฐ›์€ ๋ฆฌ๋ทฐ ์กฐํšŒ", description = "ํŠน์ • ์ƒํ’ˆ์— ๋Œ€ํ•ด ์ข‹์•„์š”๋ฅผ ์ œ์ผ ๋งŽ์ด ๋ฐ›์€ ๋ฆฌ๋ทฐ๋ฅผ ์กฐํšŒํ•œ๋‹ค.") + @ApiResponse( + responseCode = "200", + description = "์ข‹์•„์š”๋ฅผ ์ œ์ผ ๋งŽ์ด ๋ฐ›์€ ๋ฆฌ๋ทฐ ์กฐํšŒ ์„ฑ๊ณต." + ) + @GetMapping + ResponseEntity> getMostFavoriteReview(@PathVariable final Long productId); + + @Operation(summary = "๋ฆฌ๋ทฐ ์ƒ์„ธ ์กฐํšŒ", description = "๋ฆฌ๋ทฐ์˜ ์ƒ์„ธ ์ •๋ณด๋ฅผ ์กฐํšŒํ•œ๋‹ค.") + @ApiResponse( + responseCode = "200", + description = "๋ฆฌ๋ทฐ ์ƒ์„ธ ์กฐํšŒ ์„ฑ๊ณต." + ) + @GetMapping + ResponseEntity getReviewDetail(@PathVariable final Long reviewId); } diff --git a/backend/src/main/java/com/funeat/review/specification/LongTypeReviewSortSpec.java b/backend/src/main/java/com/funeat/review/specification/LongTypeReviewSortSpec.java new file mode 100644 index 000000000..23914e003 --- /dev/null +++ b/backend/src/main/java/com/funeat/review/specification/LongTypeReviewSortSpec.java @@ -0,0 +1,27 @@ +package com.funeat.review.specification; + +import com.funeat.review.domain.Review; +import java.util.Arrays; +import java.util.function.Function; + +public enum LongTypeReviewSortSpec { + + FAVORITE_COUNT("favoriteCount", Review::getFavoriteCount), + RATING("rating", Review::getRating); + + private final String fieldName; + private final Function function; + + LongTypeReviewSortSpec(final String fieldName, final Function function) { + this.fieldName = fieldName; + this.function = function; + } + + public static Long find(final String fieldName, final Review lastReview) { + return Arrays.stream(LongTypeReviewSortSpec.values()) + .filter(reviewSortSpec -> reviewSortSpec.fieldName.equals(fieldName)) + .findFirst() + .orElseThrow(IllegalArgumentException::new) + .function.apply(lastReview); + } +} diff --git a/backend/src/main/java/com/funeat/review/specification/SortingReviewSpecification.java b/backend/src/main/java/com/funeat/review/specification/SortingReviewSpecification.java new file mode 100644 index 000000000..781032017 --- /dev/null +++ b/backend/src/main/java/com/funeat/review/specification/SortingReviewSpecification.java @@ -0,0 +1,161 @@ +package com.funeat.review.specification; + +import static com.funeat.review.exception.ReviewErrorCode.NOT_SUPPORTED_REVIEW_SORTING_CONDITION; + +import com.funeat.product.domain.Product; +import com.funeat.review.domain.Review; +import com.funeat.review.exception.ReviewException.NotSupportedReviewSortingConditionException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.Path; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import org.springframework.data.jpa.domain.Specification; + +public final class SortingReviewSpecification { + + private static final List LOCALDATETIME_TYPE_INCLUDE = List.of("createdAt"); + private static final List LONG_TYPE_INCLUDE = List.of("favoriteCount", "rating"); + private static final String DELIMITER = ","; + private static final String PRODUCT = "product"; + private static final String ID = "id"; + private static final String ASC = "ASC"; + + private SortingReviewSpecification() { + } + + public static Specification sortingFirstPageBy(final Product product) { + return (root, query, criteriaBuilder) -> Specification + .where(equalsProduct(product)) + .toPredicate(root, query, criteriaBuilder); + } + + public static Specification sortingBy(final Product product, final String sortOption, + final Review lastReview) { + return (root, query, criteriaBuilder) -> { + final String[] sortFieldSplit = sortOption.split(DELIMITER); + final String field = sortFieldSplit[0]; + final String sort = sortFieldSplit[1]; + + return Specification + .where((equalsProduct(product).and(equals(field, lastReview)).and(lessThanLastReviewId(lastReview))) + .or(equalsProduct(product).and(lessOrGreaterThan(field, sort, lastReview)))) + .toPredicate(root, query, criteriaBuilder); + }; + } + + private static Specification equalsProduct(final Product product) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(product)) { + return null; + } + + final Path productPath = root.get(PRODUCT); + + return criteriaBuilder.equal(productPath, product); + }; + } + + private static Specification lessThanLastReviewId(final Review lastReview) { + return (root, query, criteriaBuilder) -> { + if (Objects.isNull(lastReview)) { + return null; + } + + final Path reviewPath = root.get(ID); + + return criteriaBuilder.lessThan(reviewPath, lastReview.getId()); + }; + } + + private static Specification equals(final String fieldName, final Review lastReview) { + return (root, query, criteriaBuilder) -> { + if (validateNull(fieldName, lastReview)) { + return null; + } + + return checkEquals(fieldName, lastReview, root, criteriaBuilder); + }; + } + + private static Predicate checkEquals(final String fieldName, + final Review lastReview, + final Root root, + final CriteriaBuilder criteriaBuilder) { + if (LOCALDATETIME_TYPE_INCLUDE.contains(fieldName)) { + final Path createdAtPath = root.get(fieldName); + final LocalDateTime lastReviewCreatedAt = lastReview.getCreatedAt(); + return criteriaBuilder.equal(createdAtPath, lastReviewCreatedAt); + } + if (LONG_TYPE_INCLUDE.contains(fieldName)) { + final Path reviewPath = root.get(fieldName); + final Long lastReviewField = LongTypeReviewSortSpec.find(fieldName, lastReview); + return criteriaBuilder.equal(reviewPath, lastReviewField); + } + throw new NotSupportedReviewSortingConditionException(NOT_SUPPORTED_REVIEW_SORTING_CONDITION, fieldName); + } + + private static Specification lessOrGreaterThan(final String field, final String sort, + final Review lastReview) { + if (ASC.equalsIgnoreCase(sort)) { + return greaterThan(field, lastReview); + } + return lessThan(field, lastReview); + } + + private static Specification greaterThan(final String fieldName, final Review lastReview) { + return (root, query, criteriaBuilder) -> { + if (validateNull(fieldName, lastReview)) { + return null; + } + + return checkGreaterThan(fieldName, lastReview, root, criteriaBuilder); + }; + } + + private static Predicate checkGreaterThan(final String fieldName, final Review lastReview, final Root root, + final CriteriaBuilder criteriaBuilder) { + if (LOCALDATETIME_TYPE_INCLUDE.contains(fieldName)) { + final Path createdAtPath = root.get(fieldName); + final LocalDateTime lastReviewCreatedAt = lastReview.getCreatedAt(); + return criteriaBuilder.greaterThan(createdAtPath, lastReviewCreatedAt); + } + if (LONG_TYPE_INCLUDE.contains(fieldName)) { + final Path reviewPath = root.get(fieldName); + final Long lastReviewField = LongTypeReviewSortSpec.find(fieldName, lastReview); + return criteriaBuilder.greaterThan(reviewPath, lastReviewField); + } + throw new NotSupportedReviewSortingConditionException(NOT_SUPPORTED_REVIEW_SORTING_CONDITION, fieldName); + } + + private static Specification lessThan(final String fieldName, final Review lastReview) { + return (root, query, criteriaBuilder) -> { + if (validateNull(fieldName, lastReview)) { + return null; + } + + return checkLessThan(fieldName, lastReview, root, criteriaBuilder); + }; + } + + private static boolean validateNull(final String fieldName, final Review lastReview) { + return Objects.isNull(fieldName) || Objects.isNull(lastReview); + } + + private static Predicate checkLessThan(final String fieldName, final Review lastReview, final Root root, + final CriteriaBuilder criteriaBuilder) { + if (LOCALDATETIME_TYPE_INCLUDE.contains(fieldName)) { + final Path createdAtPath = root.get(fieldName); + final LocalDateTime lastReviewCreatedAt = lastReview.getCreatedAt(); + return criteriaBuilder.lessThan(createdAtPath, lastReviewCreatedAt); + } + if (LONG_TYPE_INCLUDE.contains(fieldName)) { + final Path reviewPath = root.get(fieldName); + final Long lastReviewField = LongTypeReviewSortSpec.find(fieldName, lastReview); + return criteriaBuilder.lessThan(reviewPath, lastReviewField); + } + throw new NotSupportedReviewSortingConditionException(NOT_SUPPORTED_REVIEW_SORTING_CONDITION, fieldName); + } +} diff --git a/backend/src/main/java/com/funeat/tag/persistence/TagRepository.java b/backend/src/main/java/com/funeat/tag/persistence/TagRepository.java index b74e0197c..9ad319f7a 100644 --- a/backend/src/main/java/com/funeat/tag/persistence/TagRepository.java +++ b/backend/src/main/java/com/funeat/tag/persistence/TagRepository.java @@ -4,10 +4,18 @@ import com.funeat.tag.domain.TagType; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface TagRepository extends JpaRepository { List findTagsByIdIn(final List tagIds); List findTagsByTagType(final TagType tagType); + + @Query("SELECT t " + + "FROM ReviewTag rt " + + "JOIN rt.tag t " + + "WHERE rt.review.id = :reviewId") + List findTagsByReviewId(@Param("reviewId") final Long reviewId); } diff --git a/backend/src/main/resources/application-dev.yml b/backend/src/main/resources/application-dev.yml index dfa2fd258..2eafb5528 100644 --- a/backend/src/main/resources/application-dev.yml +++ b/backend/src/main/resources/application-dev.yml @@ -35,8 +35,6 @@ management: enabled: true prometheus: enabled: true - server: - port: { SERVER_PORT } cloud: aws: @@ -46,3 +44,6 @@ cloud: bucket: { S3_BUCKET } folder: { S3_DEV_FOLDER } cloudfrontPath: { S3_DEV_CLOUDFRONT_PATH } + image: + food: { DEV_BASIC_FOOD_IMAGE } + store: { DEV_BASIC_STORE_IMAGE } diff --git a/backend/src/main/resources/application-local.yml b/backend/src/main/resources/application-local.yml index e9e6a6acf..3bab01cff 100644 --- a/backend/src/main/resources/application-local.yml +++ b/backend/src/main/resources/application-local.yml @@ -12,7 +12,6 @@ spring: hibernate: format_sql: true show_sql: true - logging: level: org.hibernate.type.descriptor.sql: trace @@ -28,5 +27,8 @@ cloud: static: { S3_REGION } s3: bucket: { S3_BUCKET } - folder: { S3_DEV_FOLDER } - cloudfrontPath: { S3_DEV_CLOUDFRONT_PATH } + folder: { S3_LOCAL_FOLDER } + cloudfrontPath: { S3_LOCAL_CLOUDFRONT_PATH } + image: + food: { LOCAL_BASIC_FOOD_IMAGE } + store: { LOCAL_BASIC_STORE_IMAGE } diff --git a/backend/src/main/resources/application-prod.yml b/backend/src/main/resources/application-prod.yml index 5dbe5844c..339749bf4 100644 --- a/backend/src/main/resources/application-prod.yml +++ b/backend/src/main/resources/application-prod.yml @@ -34,8 +34,6 @@ management: enabled: true prometheus: enabled: true - server: - port: { SERVER_PORT } cloud: aws: @@ -45,3 +43,6 @@ cloud: bucket: { S3_BUCKET } folder: { S3_PROD_FOLDER } cloudfrontPath: { S3_PROD_CLOUDFRONT_PATH } + image: + food: { PROD_BASIC_FOOD_IMAGE } + store: { PROD_BASIC_STORE_IMAGE } diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index d77ffa4b2..941adb9cf 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -6,6 +6,19 @@ spring: enabled: true maxFileSize: 10MB maxRequestSize: 15MB + task: + execution: + pool: + core-size: { THREAD_CORE_SIZE } + max-size: { THREAD_MAX_SIZE } + session: + store-type: jdbc + jdbc: + initialize-schema: never + datasource: + hikari: + connection-timeout: { CONNECTION_TIMEOUT } + maximum-pool-size: { MAXIMUM_POOL_SIZE } springdoc: swagger-ui: @@ -23,7 +36,7 @@ server: max: { MAX_THREADS } max-connections: { MAX_CONNECTIONS } accept-count: { ACCEPT_COUNT } - servlet: - session: - cookie: - name: FUNEAT + +back-office: + id: { BACK_OFFICE_ID } + key: { BACK_OFFICE_KEY } diff --git a/backend/src/test/java/com/funeat/acceptance/auth/AuthAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/auth/AuthAcceptanceTest.java index 20c547dd1..77270c589 100644 --- a/backend/src/test/java/com/funeat/acceptance/auth/AuthAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/auth/AuthAcceptanceTest.java @@ -54,7 +54,7 @@ class loginAuthorizeUser_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test void ์‹ ๊ทœ_์œ ์ €๋ผ๋ฉด_๋งˆ์ดํŽ˜์ด์ง€_๊ฒฝ๋กœ๋ฅผ_ํ—ค๋”์—_๋‹ด์•„_์‘๋‹ต์„_๋ณด๋‚ธ๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ๋กœ๊ทธ์ธ_์‹œ๋„_์š”์ฒญ(๋ฉค๋ฒ„1); // then @@ -81,7 +81,7 @@ class logout_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test void ๋กœ๊ทธ์•„์›ƒ์„_ํ•˜๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ๋กœ๊ทธ์•„์›ƒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1)); // then diff --git a/backend/src/test/java/com/funeat/acceptance/auth/LoginSteps.java b/backend/src/test/java/com/funeat/acceptance/auth/LoginSteps.java index dd75b30ab..92d2f48c7 100644 --- a/backend/src/test/java/com/funeat/acceptance/auth/LoginSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/auth/LoginSteps.java @@ -29,7 +29,7 @@ public class LoginSteps { public static ExtractableResponse ๋กœ๊ทธ์•„์›ƒ_์š”์ฒญ(final String loginCookie) { return given() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .when() .post("/api/logout") .then() @@ -44,6 +44,6 @@ public class LoginSteps { .then() .extract() .response() - .getCookie("FUNEAT"); + .getCookie("SESSION"); } } diff --git a/backend/src/test/java/com/funeat/acceptance/banner/BannerAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/banner/BannerAcceptanceTest.java new file mode 100644 index 000000000..e5b3a39fd --- /dev/null +++ b/backend/src/test/java/com/funeat/acceptance/banner/BannerAcceptanceTest.java @@ -0,0 +1,62 @@ +package com.funeat.acceptance.banner; + +import static com.funeat.acceptance.banner.BannerSteps.๋ฐฐ๋„ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ; +import static com.funeat.acceptance.common.CommonSteps.STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค; +import static com.funeat.acceptance.common.CommonSteps.์ •์ƒ_์ฒ˜๋ฆฌ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ1_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ2_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ3_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ4_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ5_์ƒ์„ฑ; +import static org.assertj.core.api.Assertions.assertThat; + +import com.funeat.acceptance.common.AcceptanceTest; +import com.funeat.banner.domain.Banner; +import com.funeat.banner.dto.BannerResponse; +import io.restassured.response.ExtractableResponse; +import io.restassured.response.Response; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("NonAsciiCharacters") +public class BannerAcceptanceTest extends AcceptanceTest { + + @Nested + class getBanners_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฐฐ๋„ˆ๋ฅผ_์•„์ด๋””_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์ „์ฒด_์กฐํšŒํ•œ๋‹ค() { + // given + final var ๋ฐฐ๋„ˆ1 = ๋ฐฐ๋„ˆ1_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ2 = ๋ฐฐ๋„ˆ2_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ3 = ๋ฐฐ๋„ˆ3_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ4 = ๋ฐฐ๋„ˆ4_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ5 = ๋ฐฐ๋„ˆ5_์ƒ์„ฑ(); + final var ์ƒ์„ฑํ• _๋ฐฐ๋„ˆ_๋ฆฌ์ŠคํŠธ = Arrays.asList(๋ฐฐ๋„ˆ1, ๋ฐฐ๋„ˆ2, ๋ฐฐ๋„ˆ3, ๋ฐฐ๋„ˆ4, ๋ฐฐ๋„ˆ5); + bannerRepository.saveAll(์ƒ์„ฑํ• _๋ฐฐ๋„ˆ_๋ฆฌ์ŠคํŠธ); + + // when + final var ์‘๋‹ต = ๋ฐฐ๋„ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + ๋ฐฐ๋„ˆ_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ƒ์„ฑํ• _๋ฐฐ๋„ˆ_๋ฆฌ์ŠคํŠธ); + } + } + + private void ๋ฐฐ๋„ˆ_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, + final List expected) { + List expectedResponse = new ArrayList<>(); + for (int i = expected.size() - 1; i >= 0; i--) { + expectedResponse.add(BannerResponse.toResponse(expected.get(i))); + } + + final List result = response.jsonPath().getList("$", BannerResponse.class); + assertThat(result).usingRecursiveComparison() + .ignoringFields("id") + .isEqualTo(expectedResponse); + } +} diff --git a/backend/src/test/java/com/funeat/acceptance/banner/BannerSteps.java b/backend/src/test/java/com/funeat/acceptance/banner/BannerSteps.java new file mode 100644 index 000000000..6fbc155f9 --- /dev/null +++ b/backend/src/test/java/com/funeat/acceptance/banner/BannerSteps.java @@ -0,0 +1,17 @@ +package com.funeat.acceptance.banner; + +import io.restassured.RestAssured; +import io.restassured.response.ExtractableResponse; +import io.restassured.response.Response; + +@SuppressWarnings("NonAsciiCharacters") +public class BannerSteps { + + public static ExtractableResponse ๋ฐฐ๋„ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ() { + return RestAssured.given() + .when() + .get("/api/banners") + .then() + .extract(); + } +} diff --git a/backend/src/test/java/com/funeat/acceptance/common/AcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/common/AcceptanceTest.java index 17c6d725b..2e5be6b6d 100644 --- a/backend/src/test/java/com/funeat/acceptance/common/AcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/common/AcceptanceTest.java @@ -1,5 +1,7 @@ package com.funeat.acceptance.common; +import com.funeat.banner.persistence.BannerRepository; +import com.funeat.comment.persistence.CommentRepository; import com.funeat.common.DataClearExtension; import com.funeat.member.domain.Member; import com.funeat.member.persistence.MemberRepository; @@ -57,16 +59,22 @@ public abstract class AcceptanceTest { protected ReviewFavoriteRepository reviewFavoriteRepository; @Autowired - public RecipeRepository recipeRepository; + protected RecipeRepository recipeRepository; @Autowired - public RecipeImageRepository recipeImageRepository; + protected RecipeImageRepository recipeImageRepository; @Autowired protected ProductRecipeRepository productRecipeRepository; @Autowired - public RecipeFavoriteRepository recipeFavoriteRepository; + protected RecipeFavoriteRepository recipeFavoriteRepository; + + @Autowired + protected BannerRepository bannerRepository; + + @Autowired + protected CommentRepository commentRepository; @BeforeEach void setUp() { diff --git a/backend/src/test/java/com/funeat/acceptance/common/CommonSteps.java b/backend/src/test/java/com/funeat/acceptance/common/CommonSteps.java index 32dcb85e2..af33aa14f 100644 --- a/backend/src/test/java/com/funeat/acceptance/common/CommonSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/common/CommonSteps.java @@ -74,4 +74,10 @@ public class CommonSteps { assertThat(actual).usingRecursiveComparison() .isEqualTo(expected); } + + public static void ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final boolean expected) { + final var actual = response.jsonPath().getBoolean("hasNext"); + + assertThat(actual).isEqualTo(expected); + } } 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 9af331623..b2a94b2c0 100644 --- a/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java @@ -7,7 +7,10 @@ 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.์ •์ƒ_์ฒ˜๋ฆฌ_NO_CONTENT; +import static com.funeat.acceptance.common.CommonSteps.์ฐพ์„์ˆ˜_์—†์Œ; import static com.funeat.acceptance.common.CommonSteps.ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค; +import static com.funeat.acceptance.member.MemberSteps.๋ฆฌ๋ทฐ_์‚ญ์ œ_์š”์ฒญ; import static com.funeat.acceptance.member.MemberSteps.์‚ฌ์šฉ์ž_๊ฟ€์กฐํ•ฉ_์กฐํšŒ_์š”์ฒญ; import static com.funeat.acceptance.member.MemberSteps.์‚ฌ์šฉ์ž_๋ฆฌ๋ทฐ_์กฐํšŒ_์š”์ฒญ; import static com.funeat.acceptance.member.MemberSteps.์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •_์š”์ฒญ; @@ -32,17 +35,22 @@ import static com.funeat.fixture.PageFixture.์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜; import static com.funeat.fixture.PageFixture.์ด_ํŽ˜์ด์ง€; import static com.funeat.fixture.PageFixture.์ตœ์‹ ์ˆœ; +import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ; import static com.funeat.fixture.RecipeFixture.๋ ˆ์‹œํ”ผ; import static com.funeat.fixture.RecipeFixture.๋ ˆ์‹œํ”ผ1; import static com.funeat.fixture.RecipeFixture.๋ ˆ์‹œํ”ผ2; import static com.funeat.fixture.RecipeFixture.๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ1; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ2; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static com.funeat.fixture.ScoreFixture.์ ์ˆ˜_1์ ; import static com.funeat.fixture.ScoreFixture.์ ์ˆ˜_2์ ; import static com.funeat.fixture.ScoreFixture.์ ์ˆ˜_3์ ; +import static com.funeat.fixture.ScoreFixture.์ ์ˆ˜_4์ ; import static com.funeat.fixture.TagFixture.ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ; +import static com.funeat.review.exception.ReviewErrorCode.REVIEW_NOT_FOUND; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.SoftAssertions.assertSoftly; @@ -68,7 +76,7 @@ class getMemberProfile_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test void ์‚ฌ์šฉ์ž_์ •๋ณด๋ฅผ_ํ™•์ธํ•˜๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ์‚ฌ์šฉ์ž_์ •๋ณด_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1)); // then @@ -98,29 +106,29 @@ class putMemberProfile_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test void ์‚ฌ์šฉ์ž_์ •๋ณด๋ฅผ_์ˆ˜์ •ํ•˜๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ์œ ์ €๋‹‰๋„ค์ž„์ˆ˜์ •์š”์ฒญ_์ƒ์„ฑ("after")); // then - STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ_NO_CONTENT); } @Test void ์‚ฌ์šฉ์ž_๋‹‰๋„ค์ž„์„_์ˆ˜์ •ํ•˜๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ์œ ์ €๋‹‰๋„ค์ž„์ˆ˜์ •์š”์ฒญ_์ƒ์„ฑ("member1")); // then - STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ_NO_CONTENT); } @Test void ์‚ฌ์šฉ์ž_์ด๋ฏธ์ง€๋ฅผ_์ˆ˜์ •ํ•˜๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ์œ ์ €๋‹‰๋„ค์ž„์ˆ˜์ •์š”์ฒญ_์ƒ์„ฑ("after")); // then - STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ_NO_CONTENT); } } @@ -130,7 +138,7 @@ class putMemberProfile_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @ParameterizedTest @NullAndEmptySource void ๋กœ๊ทธ์ธ_ํ•˜์ง€์•Š์€_์‚ฌ์šฉ์ž๊ฐ€_์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค(final String cookie) { - // given && when + // given & when final var ์‘๋‹ต = ์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •_์š”์ฒญ(cookie, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ์œ ์ €๋‹‰๋„ค์ž„์ˆ˜์ •์š”์ฒญ_์ƒ์„ฑ("after")); // then @@ -142,7 +150,7 @@ class putMemberProfile_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @ParameterizedTest @NullAndEmptySource void ์‚ฌ์šฉ์ž๊ฐ€_์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •ํ• ๋•Œ_๋‹‰๋„ค์ž„_๋ฏธ๊ธฐ์ž…์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค(final String nickname) { - // given && when + // given & when final var ์‘๋‹ต = ์‚ฌ์šฉ์ž_์ •๋ณด_์ˆ˜์ •_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ์œ ์ €๋‹‰๋„ค์ž„์ˆ˜์ •์š”์ฒญ_์ƒ์„ฑ(nickname)); // then @@ -299,6 +307,81 @@ class getMemberRecipes_์‹คํŒจ_ํ…Œ์ŠคํŠธ { } } + @Nested + class deleteReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ์ž์‹ ์ด_์ž‘์„ฑํ•œ_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ํƒœ๊ทธ = ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ()); + ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); + + // when + final var ์‘๋‹ต = ๋ฆฌ๋ทฐ_์‚ญ์ œ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ๋ฆฌ๋ทฐ1); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ_NO_CONTENT); + } + } + + @Nested + class deleteReview_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @ParameterizedTest + @NullAndEmptySource + void ๋กœ๊ทธ์ธํ•˜์ง€_์•Š๋Š”_์‚ฌ์šฉ์ž๊ฐ€_๋ฆฌ๋ทฐ_์‚ญ์ œ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค(final String cookie) { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ํƒœ๊ทธ = ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ()); + ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); + + // when + final var ์‘๋‹ต = ๋ฆฌ๋ทฐ_์‚ญ์ œ_์š”์ฒญ(cookie, ๋ฆฌ๋ทฐ1); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ธ์ฆ๋˜์ง€_์•Š์Œ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, LOGIN_MEMBER_NOT_FOUND.getCode(), LOGIN_MEMBER_NOT_FOUND.getMessage()); + } + + @Test + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ• _์ˆ˜_์—†๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ํƒœ๊ทธ = ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ()); + ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); + + // when + final var ์‘๋‹ต = ๋ฆฌ๋ทฐ_์‚ญ์ œ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ๋ฆฌ๋ทฐ2); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ฐพ์„์ˆ˜_์—†์Œ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, REVIEW_NOT_FOUND.getCode(), REVIEW_NOT_FOUND.getMessage()); + } + + @Test + void ์ž์‹ ์ด_์ž‘์„ฑํ•˜์ง€_์•Š์€_๋ฆฌ๋ทฐ๋Š”_์‚ญ์ œํ• _์ˆ˜_์—†๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ํƒœ๊ทธ = ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ()); + ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); + + // when + final var ์‘๋‹ต = ๋ฆฌ๋ทฐ_์‚ญ์ œ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ๋ฆฌ๋ทฐ1); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ž˜๋ชป๋œ_์š”์ฒญ); + } + } + private void ์‚ฌ์šฉ์ž_๋ฆฌ๋ทฐ_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final int expectedReviewSize) { final var actual = response.jsonPath().getList("reviews", MemberReviewDto.class); 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 32ad97500..98cf4d6fa 100644 --- a/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/member/MemberSteps.java @@ -13,7 +13,7 @@ public class MemberSteps { public static ExtractableResponse ์‚ฌ์šฉ์ž_์ •๋ณด_์กฐํšŒ_์š”์ฒญ(final String loginCookie) { return given() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .when() .get("/api/members") .then() @@ -24,7 +24,7 @@ public class MemberSteps { final MultiPartSpecification image, final MemberRequest request) { final var requestSpec = given() - .cookie("FUNEAT", loginCookie); + .cookie("SESSION", loginCookie); if (Objects.nonNull(image)) { requestSpec.multiPart(image); @@ -43,7 +43,7 @@ public class MemberSteps { final Long page) { return given() .when() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .queryParam("sort", sort) .queryParam("page", page) .get("/api/members/reviews") @@ -55,11 +55,20 @@ public class MemberSteps { final Long page) { return given() .when() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .queryParam("sort", sort) .queryParam("page", page) .get("/api/members/recipes") .then() .extract(); } + + public static ExtractableResponse ๋ฆฌ๋ทฐ_์‚ญ์ œ_์š”์ฒญ(final String loginCookie, final Long reviewId) { + return given() + .cookie("SESSION", loginCookie) + .when() + .delete("/api/members/reviews/{reviewId}", reviewId) + .then() + .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 f6469f384..5a73e6554 100644 --- a/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java @@ -2,6 +2,7 @@ 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.์ •์ƒ_์ฒ˜๋ฆฌ; @@ -124,14 +125,12 @@ class ๊ฐ€๊ฒฉ_๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { final var ์ƒํ’ˆ2 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); final var ์ƒํ’ˆ3 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 4์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ๊ฐ€๊ฒฉ_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ๊ฐ€๊ฒฉ_๋‚ด๋ฆผ์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(์ƒํ’ˆ3, ์ƒํ’ˆ1, ์ƒํ’ˆ2)); } @@ -144,14 +143,12 @@ class ๊ฐ€๊ฒฉ_๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { final var ์ƒํ’ˆ2 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); final var ์ƒํ’ˆ3 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๊ฐ€๊ฒฉ_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๊ฐ€๊ฒฉ_๋‚ด๋ฆผ์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(์ƒํ’ˆ3, ์ƒํ’ˆ2, ์ƒํ’ˆ1)); } } @@ -168,14 +165,12 @@ class ๊ฐ€๊ฒฉ_๊ธฐ์ค€_์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { final var ์ƒํ’ˆ2 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 4์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); final var ์ƒํ’ˆ3 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๊ฐ€๊ฒฉ_์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๊ฐ€๊ฒฉ_์˜ค๋ฆ„์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(์ƒํ’ˆ1, ์ƒํ’ˆ3, ์ƒํ’ˆ2)); } @@ -188,14 +183,12 @@ class ๊ฐ€๊ฒฉ_๊ธฐ์ค€_์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(3L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ๊ฐ€๊ฒฉ_์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ๊ฐ€๊ฒฉ_์˜ค๋ฆ„์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(3L, 2L, 1L)); } } @@ -212,14 +205,12 @@ class ํ‰์ _๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(3L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(2L, 1L, 3L)); } @@ -232,14 +223,12 @@ class ํ‰์ _๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(3L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(3L, 2L, 1L)); } } @@ -256,14 +245,12 @@ class ํ‰์ _๊ธฐ์ค€_์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(3L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(1L, 3L, 2L)); } @@ -276,14 +263,12 @@ class ํ‰์ _๊ธฐ์ค€_์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(3L, 1L, true, true, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(1L, ํ‰๊ท _ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(3L, 2L, 1L)); } } @@ -305,14 +290,12 @@ class ๋ฆฌ๋ทฐ์ˆ˜_๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ2, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ2, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€3), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_2์ , List.of(ํƒœ๊ทธ))); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๋ฆฌ๋ทฐ์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๋ฆฌ๋ทฐ์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(์ƒํ’ˆ2, ์ƒํ’ˆ1, ์ƒํ’ˆ3)); } @@ -325,14 +308,12 @@ class ๋ฆฌ๋ทฐ์ˆ˜_๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ { final var ์ƒํ’ˆ2 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ5000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); final var ์ƒํ’ˆ3 = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 1์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๋ฆฌ๋ทฐ์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์นดํ…Œ๊ณ ๋ฆฌ_์•„์ด๋””, ๋ฆฌ๋ทฐ์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, 0L); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€X); ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(์ƒํ’ˆ3, ์ƒํ’ˆ2, ์ƒํ’ˆ1)); } } @@ -343,7 +324,7 @@ class getAllProductsInCategory_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @Test void ์ƒํ’ˆ์„_์ •๋ ฌํ• ๋•Œ_์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€_์กด์žฌํ•˜์ง€_์•Š์œผ๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(์กด์žฌํ•˜์ง€_์•Š๋Š”_์นดํ…Œ๊ณ ๋ฆฌ, ๊ฐ€๊ฒฉ_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); // then @@ -382,7 +363,7 @@ class getProductDetail_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @Test void ์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ_์ƒ์„ธ_์ •๋ณด๋ฅผ_์กฐํšŒํ• ๋•Œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ์ƒํ’ˆ_์ƒ์„ธ_์กฐํšŒ_์š”์ฒญ(์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ); // then diff --git a/backend/src/test/java/com/funeat/acceptance/product/ProductSteps.java b/backend/src/test/java/com/funeat/acceptance/product/ProductSteps.java index 8092bc187..d41bd5be1 100644 --- a/backend/src/test/java/com/funeat/acceptance/product/ProductSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/product/ProductSteps.java @@ -10,10 +10,10 @@ public class ProductSteps { public static ExtractableResponse ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(final Long categoryId, final String sort, - final Long page) { + final Long lastProductId) { return given() .queryParam("sort", sort) - .queryParam("page", page) + .queryParam("lastProductId", lastProductId) .when() .get("/api/categories/{category_id}/products", categoryId) .then() 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 dc39065cb..bb388ea78 100644 --- a/backend/src/test/java/com/funeat/acceptance/recipe/RecipeAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/recipe/RecipeAcceptanceTest.java @@ -11,6 +11,8 @@ import static com.funeat.acceptance.common.CommonSteps.์ฐพ์„์ˆ˜_์—†์Œ; import static com.funeat.acceptance.common.CommonSteps.ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค; import static com.funeat.acceptance.recipe.RecipeSteps.๋ ˆ์‹œํ”ผ_๊ฒ€์ƒ‰_๊ฒฐ๊ณผ_์กฐํšŒ_์š”์ฒญ; +import static com.funeat.acceptance.recipe.RecipeSteps.๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ; +import static com.funeat.acceptance.recipe.RecipeSteps.๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_์š”์ฒญ; import static com.funeat.acceptance.recipe.RecipeSteps.๋ ˆ์‹œํ”ผ_๋žญํ‚น_์กฐํšŒ_์š”์ฒญ; import static com.funeat.acceptance.recipe.RecipeSteps.๋ ˆ์‹œํ”ผ_๋ชฉ๋ก_์š”์ฒญ; import static com.funeat.acceptance.recipe.RecipeSteps.๋ ˆ์‹œํ”ผ_์ƒ์„ธ_์ •๋ณด_์š”์ฒญ; @@ -59,12 +61,14 @@ import static org.assertj.core.api.SoftAssertions.assertSoftly; import com.funeat.acceptance.common.AcceptanceTest; -import com.funeat.common.dto.PageDto; import com.funeat.member.domain.Member; import com.funeat.recipe.domain.Recipe; import com.funeat.recipe.dto.ProductRecipeDto; import com.funeat.recipe.dto.RankingRecipeDto; import com.funeat.recipe.dto.RecipeAuthorDto; +import com.funeat.recipe.dto.RecipeCommentCondition; +import com.funeat.recipe.dto.RecipeCommentCreateRequest; +import com.funeat.recipe.dto.RecipeCommentResponse; import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeDetailResponse; import com.funeat.recipe.dto.RecipeDto; @@ -268,7 +272,7 @@ class getRecipeDetail_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @Test void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ ˆ์‹œํ”ผ_์‚ฌ์šฉ์ž๊ฐ€_๋ ˆ์‹œํ”ผ_์ƒ์„ธ_์กฐํšŒ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ƒ์„ธ_์ •๋ณด_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ ˆ์‹œํ”ผ); // then @@ -356,7 +360,7 @@ class likeRecipe_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @Test void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ ˆ์‹œํ”ผ์—_์‚ฌ์šฉ์ž๊ฐ€_์ข‹์•„์š”๋ฅผ_ํ• ๋•Œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { - // given && when + // given & when final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ข‹์•„์š”_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ ˆ์‹œํ”ผ, ๋ ˆ์‹œํ”ผ์ข‹์•„์š”์š”์ฒญ_์ƒ์„ฑ(์ข‹์•„์š”O)); // then @@ -532,6 +536,189 @@ class getRankingRecipes_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } } + @Nested + class writeRecipeComment_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_์ž‘์„ฑํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์—ฌ๋Ÿฌ๊ฐœ_์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(์ƒํ’ˆ)); + + // when + final var ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋”” = ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต); + final var ๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“ = ๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2); + final var ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€ = new RecipeCommentCreateRequest("ํ…Œ์ŠคํŠธ ์ฝ”๋ฉ˜ํŠธ 1"); + + final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ƒ์„ฑ); + ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€_์ž‘์„ฑ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋ฉค๋ฒ„2, ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€); + } + } + + @Nested + class writeRecipeComment_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @ParameterizedTest + @NullAndEmptySource + void ๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_์ž‘์„ฑํ• ๋•Œ_๋Œ“๊ธ€์ด_๋น„์–ด์žˆ์„์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค(final String comment) { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์—ฌ๋Ÿฌ๊ฐœ_์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(์ƒํ’ˆ)); + + // when + final var ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋”” = ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต); + final var ๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“ = ๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2); + final var ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€ = new RecipeCommentCreateRequest(comment); + + final var ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ = ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ, ์ž˜๋ชป๋œ_์š”์ฒญ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ, REQUEST_VALID_ERROR_CODE.getCode(), + "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์„ ํ™•์ธํ•ด ์ฃผ์„ธ์š”. " + REQUEST_VALID_ERROR_CODE.getMessage()); + } + + @Test + void ๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_์ž‘์„ฑํ• ๋•Œ_๋Œ“๊ธ€์ด_200์ž_์ดˆ๊ณผ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์—ฌ๋Ÿฌ๊ฐœ_์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(์ƒํ’ˆ)); + + // when + final var ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋”” = ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต); + final var ๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“ = ๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2); + final var ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€ = new RecipeCommentCreateRequest("1" + "๋Œ“๊ธ€์ž…๋‹ˆ๋‹ค".repeat(40)); + + final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ž˜๋ชป๋œ_์š”์ฒญ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, REQUEST_VALID_ERROR_CODE.getCode(), + "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์€ ์ตœ๋Œ€ 200์ž๊นŒ์ง€ ์ž…๋ ฅ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. " + REQUEST_VALID_ERROR_CODE.getMessage()); + } + + @ParameterizedTest + @NullAndEmptySource + void ๋กœ๊ทธ์ธ_ํ•˜์ง€์•Š์€_์‚ฌ์šฉ์ž๊ฐ€_๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€_์ž‘์„ฑ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค(final String cookie) { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์—ฌ๋Ÿฌ๊ฐœ_์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(์ƒํ’ˆ)); + + // when + final var ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋”” = ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต); + final var ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€ = new RecipeCommentCreateRequest("ํ…Œ์ŠคํŠธ ์ฝ”๋ฉ˜ํŠธ 1"); + + final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(cookie, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ธ์ฆ๋˜์ง€_์•Š์Œ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, LOGIN_MEMBER_NOT_FOUND.getCode(), + LOGIN_MEMBER_NOT_FOUND.getMessage()); + } + } + + @Nested + class getRecipeComment_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_์กฐํšŒํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์—ฌ๋Ÿฌ๊ฐœ_์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(์ƒํ’ˆ)); + + final var ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋”” = ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต); + final var ๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“ = ๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2); + + for (int i = 1; i <= 15; i++) { + ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, + new RecipeCommentCreateRequest("ํ…Œ์ŠคํŠธ ์ฝ”๋ฉ˜ํŠธ" + i)); + } + + // when + final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, + new RecipeCommentCondition(null, null)); + + // then + final var expectedSize = 10; + final var expectedHasNext = true; + + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, expectedSize, expectedHasNext); + } + + @Test + void ๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_๋งˆ์ง€๋ง‰_ํŽ˜์ด์ง€๋ฅผ_์กฐํšŒํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์—ฌ๋Ÿฌ๊ฐœ_์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(์ƒํ’ˆ)); + + final var ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋”” = ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต); + final var ๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“ = ๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2); + + final var totalElements = 15L; + final var lastId = 6L; + + for (int i = 1; i <= totalElements; i++) { + ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, + new RecipeCommentCreateRequest("ํ…Œ์ŠคํŠธ ์ฝ”๋ฉ˜ํŠธ" + i)); + } + + // when + final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, new RecipeCommentCondition(lastId, totalElements)); + + // then + final var expectedSize = 5; + final var expectedHasNext = false; + + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, expectedSize, expectedHasNext); + } + } + + @Nested + class getRecipeComment_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @ParameterizedTest + @NullAndEmptySource + void ๋กœ๊ทธ์ธ_ํ•˜์ง€์•Š์€_์‚ฌ์šฉ์ž๊ฐ€_๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€_์กฐํšŒ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค(final String cookie) { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต = ๋ ˆ์‹œํ”ผ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์—ฌ๋Ÿฌ๊ฐœ_์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ ˆ์‹œํ”ผ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(์ƒํ’ˆ)); + + final var ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋”” = ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(๊ฟ€์กฐํ•ฉ_์ž‘์„ฑ_์‘๋‹ต); + final var ๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“ = ๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2); + final var ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€ = new RecipeCommentCreateRequest("ํ…Œ์ŠคํŠธ ์ฝ”๋ฉ˜ํŠธ"); + + ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(๋Œ“๊ธ€์ž‘์„ฑ์ž_๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€); + + // when + final var ์‘๋‹ต = ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_์š”์ฒญ(cookie, ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””, + new RecipeCommentCondition(6L, 15L)); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ธ์ฆ๋˜์ง€_์•Š์Œ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, LOGIN_MEMBER_NOT_FOUND.getCode(), + LOGIN_MEMBER_NOT_FOUND.getMessage()); + } + } + private void ๋ ˆ์‹œํ”ผ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final List recipeIds) { final var actual = response.jsonPath().getList("recipes", RecipeDto.class); @@ -590,4 +777,30 @@ class getRankingRecipes_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { assertThat(actual).extracting(SearchRecipeResultDto::getId) .containsExactlyElementsOf(recipeIds); } + + private Long ์ž‘์„ฑ๋œ_๊ฟ€์กฐํ•ฉ_์•„์ด๋””_์ถ”์ถœ(final ExtractableResponse response) { + return Long.parseLong(response.header("Location").split("/")[3]); + } + + private void ๊ฟ€์กฐํ•ฉ_๋Œ“๊ธ€_์ž‘์„ฑ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final Long memberId, + final RecipeCommentCreateRequest request) { + final var savedCommentId = Long.parseLong(response.header("Location").split("/")[4]); + + final var findComments = commentRepository.findAll(); + + assertSoftly(soft -> { + soft.assertThat(savedCommentId).isEqualTo(findComments.get(0).getId()); + soft.assertThat(memberId).isEqualTo(findComments.get(0).getMember().getId()); + soft.assertThat(request.getComment()).isEqualTo(findComments.get(0).getComment()); + }); + } + + private void ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final int expectedSize, + final boolean expectedHasNext) { + final var actualComments = response.jsonPath().getList("comments", RecipeCommentResponse.class); + final var actualHasNext = response.jsonPath().getBoolean("hasNext"); + + assertThat(actualComments).hasSize(expectedSize); + assertThat(actualHasNext).isEqualTo(expectedHasNext); + } } 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 f82c84f93..8d68fe7e9 100644 --- a/backend/src/test/java/com/funeat/acceptance/recipe/RecipeSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/recipe/RecipeSteps.java @@ -4,6 +4,8 @@ import static com.funeat.fixture.RecipeFixture.๋ ˆ์‹œํ”ผ์ข‹์•„์š”์š”์ฒญ_์ƒ์„ฑ; import static io.restassured.RestAssured.given; +import com.funeat.recipe.dto.RecipeCommentCondition; +import com.funeat.recipe.dto.RecipeCommentCreateRequest; import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeFavoriteRequest; import io.restassured.response.ExtractableResponse; @@ -19,7 +21,7 @@ public class RecipeSteps { final List images, final RecipeCreateRequest recipeRequest) { final var requestSpec = given() - .cookie("FUNEAT", loginCookie); + .cookie("SESSION", loginCookie); if (Objects.nonNull(images) && !images.isEmpty()) { images.forEach(requestSpec::multiPart); @@ -35,7 +37,7 @@ public class RecipeSteps { public static ExtractableResponse ๋ ˆ์‹œํ”ผ_์ƒ์„ธ_์ •๋ณด_์š”์ฒญ(final String loginCookie, final Long recipeId) { return given() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .when() .get("/api/recipes/{recipeId}", recipeId) .then() @@ -55,7 +57,7 @@ public class RecipeSteps { public static ExtractableResponse ๋ ˆ์‹œํ”ผ_์ข‹์•„์š”_์š”์ฒญ(final String loginCookie, final Long recipeId, final RecipeFavoriteRequest request) { return given() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .contentType("application/json") .body(request) .when() @@ -90,4 +92,30 @@ public class RecipeSteps { .then() .extract(); } + + public static ExtractableResponse ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์ž‘์„ฑ_์š”์ฒญ(final String loginCookie, + final Long recipeId, + final RecipeCommentCreateRequest request) { + return given() + .cookie("SESSION", loginCookie) + .contentType("application/json") + .body(request) + .when() + .post("/api/recipes/" + recipeId + "/comments") + .then() + .extract(); + } + + public static ExtractableResponse ๋ ˆ์‹œํ”ผ_๋Œ“๊ธ€_์กฐํšŒ_์š”์ฒญ(final String loginCookie, final Long recipeId, + final RecipeCommentCondition condition) { + return given() + .cookie("SESSION", loginCookie) + .contentType("application/json") + .param("lastId", condition.getLastId()) + .param("totalElements", condition.getTotalElements()) + .when() + .get("/api/recipes/" + recipeId + "/comments") + .then() + .extract(); + } } 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 07552c34c..233cc4ca5 100644 --- a/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java @@ -2,6 +2,7 @@ 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.์ž˜๋ชป๋œ_์š”์ฒญ; @@ -9,13 +10,14 @@ import static com.funeat.acceptance.common.CommonSteps.์ •์ƒ_์ฒ˜๋ฆฌ; import static com.funeat.acceptance.common.CommonSteps.์ •์ƒ_์ฒ˜๋ฆฌ_NO_CONTENT; import static com.funeat.acceptance.common.CommonSteps.์ฐพ์„์ˆ˜_์—†์Œ; -import static com.funeat.acceptance.common.CommonSteps.ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค; import static com.funeat.acceptance.product.ProductSteps.์ƒํ’ˆ_์ƒ์„ธ_์กฐํšŒ_์š”์ฒญ; import static com.funeat.acceptance.review.ReviewSteps.๋ฆฌ๋ทฐ_๋žญํ‚น_์กฐํšŒ_์š”์ฒญ; +import static com.funeat.acceptance.review.ReviewSteps.๋ฆฌ๋ทฐ_์ƒ์„ธ_์กฐํšŒ_์š”์ฒญ; import static com.funeat.acceptance.review.ReviewSteps.๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ; import static com.funeat.acceptance.review.ReviewSteps.๋ฆฌ๋ทฐ_์ข‹์•„์š”_์š”์ฒญ; import static com.funeat.acceptance.review.ReviewSteps.์—ฌ๋Ÿฌ๋ช…์ด_๋ฆฌ๋ทฐ_์ข‹์•„์š”_์š”์ฒญ; import static com.funeat.acceptance.review.ReviewSteps.์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ; +import static com.funeat.acceptance.review.ReviewSteps.์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_์กฐํšŒ_์š”์ฒญ; import static com.funeat.auth.exception.AuthErrorCode.LOGIN_MEMBER_NOT_FOUND; import static com.funeat.exception.CommonErrorCode.REQUEST_VALID_ERROR_CODE; import static com.funeat.fixture.CategoryFixture.์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ; @@ -28,19 +30,15 @@ import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„2; import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„3; import static com.funeat.fixture.PageFixture.FIRST_PAGE; -import static com.funeat.fixture.PageFixture.PAGE_SIZE; -import static com.funeat.fixture.PageFixture.๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O; -import static com.funeat.fixture.PageFixture.์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ; import static com.funeat.fixture.PageFixture.์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ; -import static com.funeat.fixture.PageFixture.์ฒซํŽ˜์ด์ง€O; -import static com.funeat.fixture.PageFixture.์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜; -import static com.funeat.fixture.PageFixture.์ด_ํŽ˜์ด์ง€; import static com.funeat.fixture.PageFixture.์ตœ์‹ ์ˆœ; import static com.funeat.fixture.PageFixture.ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ; import static com.funeat.fixture.PageFixture.ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ; +import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ1; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ; +import static com.funeat.fixture.ReviewFixture.๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ1; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ2; @@ -54,6 +52,7 @@ import static com.funeat.fixture.ReviewFixture.์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฆฌ๋ทฐ; import static com.funeat.fixture.ReviewFixture.์ข‹์•„์š”O; import static com.funeat.fixture.ReviewFixture.์ข‹์•„์š”X; +import static com.funeat.fixture.ReviewFixture.์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด; import static com.funeat.fixture.ScoreFixture.์ ์ˆ˜_1์ ; import static com.funeat.fixture.ScoreFixture.์ ์ˆ˜_2์ ; import static com.funeat.fixture.ScoreFixture.์ ์ˆ˜_3์ ; @@ -68,7 +67,9 @@ import com.funeat.acceptance.common.AcceptanceTest; import com.funeat.review.dto.RankingReviewDto; import com.funeat.review.dto.ReviewCreateRequest; +import com.funeat.review.dto.ReviewDetailResponse; import com.funeat.review.dto.SortingReviewDto; +import com.funeat.tag.dto.TagDto; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; import java.util.Collections; @@ -384,14 +385,12 @@ class ์ข‹์•„์š”_๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ { ์—ฌ๋Ÿฌ๋ช…์ด_๋ฆฌ๋ทฐ_์ข‹์•„์š”_์š”์ฒญ(List.of(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ๋ฆฌ๋ทฐ3, ์ข‹์•„์š”O); ์—ฌ๋Ÿฌ๋ช…์ด_๋ฆฌ๋ทฐ_์ข‹์•„์š”_์š”์ฒญ(List.of(๋ฉค๋ฒ„2, ๋ฉค๋ฒ„3), ์ƒํ’ˆ, ๋ฆฌ๋ทฐ2, ์ข‹์•„์š”O); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX); ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(๋ฆฌ๋ทฐ2, ๋ฆฌ๋ทฐ3, ๋ฆฌ๋ทฐ1)); } @@ -407,14 +406,12 @@ class ์ข‹์•„์š”_๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„3), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€3), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX); ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(๋ฆฌ๋ทฐ3, ๋ฆฌ๋ทฐ2, ๋ฆฌ๋ทฐ1)); } } @@ -434,14 +431,12 @@ class ํ‰์ _๊ธฐ์ค€_์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ_๋ฆฌ๋ทฐ_๋ชฉ๋ก์„_์กฐํšŒ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„3), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€3), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX); ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(๋ฆฌ๋ทฐ1, ๋ฆฌ๋ทฐ3, ๋ฆฌ๋ทฐ2)); } @@ -457,14 +452,12 @@ class ํ‰์ _๊ธฐ์ค€_์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ_๋ฆฌ๋ทฐ_๋ชฉ๋ก์„_์กฐํšŒ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„3), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€3), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX); ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(๋ฆฌ๋ทฐ3, ๋ฆฌ๋ทฐ2, ๋ฆฌ๋ทฐ1)); } } @@ -484,14 +477,12 @@ class ํ‰์ _๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„3), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€3), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX); ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(๋ฆฌ๋ทฐ2, ๋ฆฌ๋ทฐ3, ๋ฆฌ๋ทฐ1)); } @@ -507,14 +498,12 @@ class ํ‰์ _๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„3), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€3), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX); ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(๋ฆฌ๋ทฐ3, ๋ฆฌ๋ทฐ2, ๋ฆฌ๋ทฐ1)); } } @@ -534,14 +523,12 @@ class ์ตœ์‹ ์ˆœ์œผ๋กœ_๋ฆฌ๋ทฐ_๋ชฉ๋ก์„_์กฐํšŒ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„3), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€3), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); - final var ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€ = ์‘๋‹ต_ํŽ˜์ด์ง€_์ƒ์„ฑ(์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(3L), ์ด_ํŽ˜์ด์ง€(1L), ์ฒซํŽ˜์ด์ง€O, ๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€O, FIRST_PAGE, PAGE_SIZE); - // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ตœ์‹ ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ์ตœ์‹ ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); - ํŽ˜์ด์ง€๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์˜ˆ์ƒ_์‘๋‹ต_ํŽ˜์ด์ง€); + ๋‹ค์Œ_๋ฐ์ดํ„ฐ๊ฐ€_์žˆ๋Š”์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX); ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, List.of(๋ฆฌ๋ทฐ3, ๋ฆฌ๋ทฐ2, ๋ฆฌ๋ทฐ1)); } } @@ -562,7 +549,7 @@ class getSortingReviews_์‹คํŒจ_ํ…Œ์ŠคํŠธ { ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_2์ , List.of(ํƒœ๊ทธ))); // when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(cookie, ์ƒํ’ˆ, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(cookie, ์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ธ์ฆ๋˜์ง€_์•Š์Œ); @@ -573,7 +560,7 @@ class getSortingReviews_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @Test void ์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ์˜_๋ฆฌ๋ทฐ_๋ชฉ๋ก์„_์กฐํšŒ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { // given && when - final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); + final var ์‘๋‹ต = ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ, ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, FIRST_PAGE); // then STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ฐพ์„์ˆ˜_์—†์Œ); @@ -611,6 +598,96 @@ class getRankingReviews_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } } + @Nested + class getMostFavoriteReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ํŠน์ •_์ƒํ’ˆ์—์„œ_์ข‹์•„์š”๋ฅผ_๊ฐ€์žฅ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ๋ฅผ_์กฐํšŒํ•˜๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ํƒœ๊ทธ = ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ()); + + ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ))); + ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„2), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€2), ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_4์ , List.of(ํƒœ๊ทธ))); + ์—ฌ๋Ÿฌ๋ช…์ด_๋ฆฌ๋ทฐ_์ข‹์•„์š”_์š”์ฒญ(List.of(๋ฉค๋ฒ„1, ๋ฉค๋ฒ„2, ๋ฉค๋ฒ„3), ์ƒํ’ˆ1, ๋ฆฌ๋ทฐ2, ์ข‹์•„์š”O); + + // when + final var ์‘๋‹ต = ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_์กฐํšŒ_์š”์ฒญ(์ƒํ’ˆ); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ๋ฆฌ๋ทฐ2); + } + + @Test + void ํŠน์ •_์ƒํ’ˆ์—์„œ_๋ฆฌ๋ทฐ๊ฐ€_์—†๋‹ค๋ฉด_๋นˆ_์‘๋‹ต์„_๋ฐ˜ํ™˜ํ•˜๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + + // when + final var ์‘๋‹ต = ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_์กฐํšŒ_์š”์ฒญ(์ƒํ’ˆ); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ_NO_CONTENT); + ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_๊ฒฐ๊ณผ๊ฐ€_๋นˆ_์‘๋‹ต์ธ์ง€_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต); + } + } + + @Nested + class getMostFavoriteReview_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @Test + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ์˜_์ข‹์•„์š”๋ฅผ_๊ฐ€์žฅ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_์กฐํšŒ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given & when + final var ์‘๋‹ต = ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_์กฐํšŒ_์š”์ฒญ(์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ฐพ์„์ˆ˜_์—†์Œ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, PRODUCT_NOT_FOUND.getCode(), PRODUCT_NOT_FOUND.getMessage()); + } + } + + @Nested + class getReviewDetail_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฆฌ๋ทฐ_์ƒ์„ธ_์ •๋ณด๋ฅผ_์กฐํšŒํ•œ๋‹ค() { + // given + final var ์นดํ…Œ๊ณ ๋ฆฌ = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(์นดํ…Œ๊ณ ๋ฆฌ); + final var ์ƒํ’ˆ = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(์นดํ…Œ๊ณ ๋ฆฌ)); + final var ํƒœ๊ทธ = ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ()); + + final var ์š”์ฒญ = ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(์ ์ˆ˜_3์ , List.of(ํƒœ๊ทธ)); + ๋ฆฌ๋ทฐ_์ž‘์„ฑ_์š”์ฒญ(๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“(๋ฉค๋ฒ„1), ์ƒํ’ˆ, ์‚ฌ์ง„_๋ช…์„ธ_์š”์ฒญ(์ด๋ฏธ์ง€1), ์š”์ฒญ); + + // when + final var ์‘๋‹ต = ๋ฆฌ๋ทฐ_์ƒ์„ธ_์กฐํšŒ_์š”์ฒญ(๋ฆฌ๋ทฐ); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ •์ƒ_์ฒ˜๋ฆฌ); + ๋ฆฌ๋ทฐ_์ƒ์„ธ_์ •๋ณด_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์š”์ฒญ); + } + } + + @Nested + class getReviewDetail_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @Test + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฆฌ๋ทฐ_์กฐํšŒ์‹œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given & when + final var ์‘๋‹ต = ๋ฆฌ๋ทฐ_์ƒ์„ธ_์กฐํšŒ_์š”์ฒญ(์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฆฌ๋ทฐ); + + // then + STATUS_CODE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, ์ฐพ์„์ˆ˜_์—†์Œ); + RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(์‘๋‹ต, REVIEW_NOT_FOUND.getCode(), REVIEW_NOT_FOUND.getMessage()); + } + } + private void RESPONSE_CODE์™€_MESSAGE๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final String expectedCode, final String expectedMessage) { assertSoftly(soft -> { @@ -636,10 +713,40 @@ class getRankingReviews_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { .containsExactlyElementsOf(reviewIds); } + private void ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final Long reviewId) { + final var actual = response.jsonPath() + .getLong("id"); + + assertThat(actual).isEqualTo(reviewId); + } + + private void ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_๊ฒฐ๊ณผ๊ฐ€_๋นˆ_์‘๋‹ต์ธ์ง€_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response) { + final var actual = response.body() + .asString(); + + assertThat(actual).isEmpty(); + } + private void ์ƒํ’ˆ_์‚ฌ์ง„์„_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final String expected) { final var actual = response.jsonPath() .getString("image"); assertThat(actual).isEqualTo(expected); } + + private void ๋ฆฌ๋ทฐ_์ƒ์„ธ_์ •๋ณด_์กฐํšŒ_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final ExtractableResponse response, final ReviewCreateRequest request) { + final var actual = response.as(ReviewDetailResponse.class); + final var actualTags = response.jsonPath().getList("tags", TagDto.class); + + assertSoftly(soft -> { + soft.assertThat(actual.getId()).isEqualTo(๋ฆฌ๋ทฐ); + soft.assertThat(actual.getImage()).isEqualTo("1.png"); + soft.assertThat(actual.getRating()).isEqualTo(request.getRating()); + soft.assertThat(actual.getContent()).isEqualTo(request.getContent()); + soft.assertThat(actual.isRebuy()).isEqualTo(request.getRebuy()); + soft.assertThat(actual.getFavoriteCount()).isEqualTo(0L); + soft.assertThat(actualTags).extracting(TagDto::getId) + .containsExactlyElementsOf(request.getTagIds()); + }); + } } 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 d59d9eded..d1b556d7d 100644 --- a/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java +++ b/backend/src/test/java/com/funeat/acceptance/review/ReviewSteps.java @@ -1,7 +1,6 @@ package com.funeat.acceptance.review; import static com.funeat.acceptance.auth.LoginSteps.๋กœ๊ทธ์ธ_์ฟ ํ‚ค_ํš๋“; -import static com.funeat.acceptance.common.CommonSteps.LOCATION_ํ—ค๋”์—์„œ_ID_์ถ”์ถœ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ข‹์•„์š”์š”์ฒญ_์ƒ์„ฑ; import static io.restassured.RestAssured.given; @@ -20,7 +19,7 @@ public class ReviewSteps { final MultiPartSpecification image, final ReviewCreateRequest request) { final var requestSpec = given() - .cookie("FUNEAT", loginCookie); + .cookie("SESSION", loginCookie); if (Objects.nonNull(image)) { requestSpec.multiPart(image); @@ -37,7 +36,7 @@ public class ReviewSteps { public static ExtractableResponse ๋ฆฌ๋ทฐ_์ข‹์•„์š”_์š”์ฒญ(final String loginCookie, final Long productId, final Long reviewId, final ReviewFavoriteRequest request) { return given() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .contentType("application/json") .body(request) .when() @@ -56,14 +55,16 @@ public class ReviewSteps { } public static ExtractableResponse ์ •๋ ฌ๋œ_๋ฆฌ๋ทฐ_๋ชฉ๋ก_์กฐํšŒ_์š”์ฒญ(final String loginCookie, final Long productId, + final Long lastReviewId, final String sort, final Long page) { return given() - .cookie("FUNEAT", loginCookie) + .cookie("SESSION", loginCookie) .queryParam("sort", sort) .queryParam("page", page) + .queryParam("lastReviewId", lastReviewId).log().all() .when() .get("/api/products/{product_id}/reviews", productId) - .then() + .then().log().all() .extract(); } @@ -74,4 +75,20 @@ public class ReviewSteps { .then() .extract(); } + + public static ExtractableResponse ์ข‹์•„์š”๋ฅผ_์ œ์ผ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ_์กฐํšŒ_์š”์ฒญ(final Long productId) { + return given() + .when() + .get("/api/ranks/products/{product_id}/reviews", productId) + .then().log().all() + .extract(); + } + + public static ExtractableResponse ๋ฆฌ๋ทฐ_์ƒ์„ธ_์กฐํšŒ_์š”์ฒญ(final Long reviewId) { + return given() + .when() + .get("/api/reviews/{reviewId}", reviewId) + .then() + .extract(); + } } diff --git a/backend/src/test/java/com/funeat/banner/application/BannerServiceTest.java b/backend/src/test/java/com/funeat/banner/application/BannerServiceTest.java new file mode 100644 index 000000000..dad7292f4 --- /dev/null +++ b/backend/src/test/java/com/funeat/banner/application/BannerServiceTest.java @@ -0,0 +1,47 @@ +package com.funeat.banner.application; + +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ1_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ2_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ3_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ4_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ5_์ƒ์„ฑ; +import static org.assertj.core.api.Assertions.assertThat; + +import com.funeat.banner.dto.BannerResponse; +import com.funeat.common.ServiceTest; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("NonAsciiCharacters") +public class BannerServiceTest extends ServiceTest { + + @Nested + class getBanners_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฐฐ๋„ˆ๋ฅผ_์•„์ด๋””_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์ „์ฒด_์กฐํšŒํ•œ๋‹ค() { + // given + final var ๋ฐฐ๋„ˆ1 = ๋ฐฐ๋„ˆ1_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ2 = ๋ฐฐ๋„ˆ2_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ3 = ๋ฐฐ๋„ˆ3_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ4 = ๋ฐฐ๋„ˆ4_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ5 = ๋ฐฐ๋„ˆ5_์ƒ์„ฑ(); + ๋ณต์ˆ˜_๋ฐฐ๋„ˆ_์ €์žฅ(๋ฐฐ๋„ˆ1, ๋ฐฐ๋„ˆ2, ๋ฐฐ๋„ˆ3, ๋ฐฐ๋„ˆ4, ๋ฐฐ๋„ˆ5); + + // when + final var result = bannerService.getAllBanners(); + + // then + final var ๋ฐฐ๋„ˆ๋“ค = List.of(๋ฐฐ๋„ˆ5, ๋ฐฐ๋„ˆ4, ๋ฐฐ๋„ˆ3, ๋ฐฐ๋„ˆ2, ๋ฐฐ๋„ˆ1); + final var bannerResponses = ๋ฐฐ๋„ˆ๋“ค.stream() + .map(BannerResponse::toResponse) + .collect(Collectors.toList()); + + assertThat(result).usingRecursiveComparison() + .ignoringFields("id") + .isEqualTo(bannerResponses); + } + } +} diff --git a/backend/src/test/java/com/funeat/banner/persistence/BannerRepositoryTest.java b/backend/src/test/java/com/funeat/banner/persistence/BannerRepositoryTest.java new file mode 100644 index 000000000..34ef6e6b9 --- /dev/null +++ b/backend/src/test/java/com/funeat/banner/persistence/BannerRepositoryTest.java @@ -0,0 +1,39 @@ +package com.funeat.banner.persistence; + +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ1_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ2_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ3_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ4_์ƒ์„ฑ; +import static com.funeat.fixture.BannerFixture.๋ฐฐ๋„ˆ5_์ƒ์„ฑ; +import static org.assertj.core.api.Assertions.assertThat; + +import com.funeat.common.RepositoryTest; +import java.util.List; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("NonAsciiCharacters") +public class BannerRepositoryTest extends RepositoryTest { + + @Nested + class findAllByOrderByIdDesc_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฐฐ๋„ˆ๋Š”_์•„์ด๋””๊ฐ€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์กฐํšŒ๋œ๋‹ค() { + // given + final var ๋ฐฐ๋„ˆ1 = ๋ฐฐ๋„ˆ1_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ2 = ๋ฐฐ๋„ˆ2_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ3 = ๋ฐฐ๋„ˆ3_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ4 = ๋ฐฐ๋„ˆ4_์ƒ์„ฑ(); + final var ๋ฐฐ๋„ˆ5 = ๋ฐฐ๋„ˆ5_์ƒ์„ฑ(); + ๋ณต์ˆ˜_๋ฐฐ๋„ˆ_์ €์žฅ(๋ฐฐ๋„ˆ1, ๋ฐฐ๋„ˆ2, ๋ฐฐ๋„ˆ3, ๋ฐฐ๋„ˆ4, ๋ฐฐ๋„ˆ5); + + // when + final var bannersOrderByIdDesc = bannerRepository.findAllByOrderByIdDesc(); + + // then + assertThat(bannersOrderByIdDesc).usingRecursiveComparison() + .isEqualTo(List.of(๋ฐฐ๋„ˆ5, ๋ฐฐ๋„ˆ4, ๋ฐฐ๋„ˆ3, ๋ฐฐ๋„ˆ2, ๋ฐฐ๋„ˆ1)); + } + } +} diff --git a/backend/src/test/java/com/funeat/common/EventTest.java b/backend/src/test/java/com/funeat/common/EventTest.java new file mode 100644 index 000000000..aeb72d418 --- /dev/null +++ b/backend/src/test/java/com/funeat/common/EventTest.java @@ -0,0 +1,66 @@ +package com.funeat.common; + +import com.funeat.member.domain.Member; +import com.funeat.member.persistence.MemberRepository; +import com.funeat.product.domain.Category; +import com.funeat.product.domain.Product; +import com.funeat.product.persistence.CategoryRepository; +import com.funeat.product.persistence.ProductRepository; +import com.funeat.review.application.ReviewService; +import com.funeat.review.persistence.ReviewRepository; +import com.funeat.tag.persistence.TagRepository; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.event.ApplicationEvents; +import org.springframework.test.context.event.RecordApplicationEvents; + +@SpringBootTest +@RecordApplicationEvents +@SuppressWarnings("NonAsciiCharacters") +@DisplayNameGeneration(ReplaceUnderscores.class) +@ExtendWith({MockitoExtension.class, DataClearExtension.class}) +public class EventTest { + + @Autowired + protected ApplicationEvents events; + + @Autowired + protected ReviewService reviewService; + + @Autowired + protected ProductRepository productRepository; + + @Autowired + protected CategoryRepository categoryRepository; + + @Autowired + protected TagRepository tagRepository; + + @Autowired + protected MemberRepository memberRepository; + + @Autowired + protected ReviewRepository reviewRepository; + + @AfterEach + void tearDown() { + events.clear(); + } + + protected Long ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(final Product product) { + return productRepository.save(product).getId(); + } + + protected Long ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(final Category category) { + return categoryRepository.save(category).getId(); + } + + protected Long ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(final Member member) { + return memberRepository.save(member).getId(); + } +} diff --git a/backend/src/test/java/com/funeat/common/RepositoryTest.java b/backend/src/test/java/com/funeat/common/RepositoryTest.java index b438ca41b..1ae1fff62 100644 --- a/backend/src/test/java/com/funeat/common/RepositoryTest.java +++ b/backend/src/test/java/com/funeat/common/RepositoryTest.java @@ -1,11 +1,11 @@ package com.funeat.common; +import com.funeat.banner.domain.Banner; +import com.funeat.banner.persistence.BannerRepository; import com.funeat.member.domain.Member; import com.funeat.member.domain.favorite.RecipeFavorite; import com.funeat.member.domain.favorite.ReviewFavorite; import com.funeat.member.persistence.MemberRepository; -import com.funeat.member.persistence.ProductBookmarkRepository; -import com.funeat.member.persistence.RecipeBookMarkRepository; import com.funeat.member.persistence.RecipeFavoriteRepository; import com.funeat.member.persistence.ReviewFavoriteRepository; import com.funeat.product.domain.Category; @@ -42,12 +42,6 @@ public abstract class RepositoryTest { @Autowired protected MemberRepository memberRepository; - @Autowired - protected ProductBookmarkRepository productBookmarkRepository; - - @Autowired - protected RecipeBookMarkRepository recipeBookMarkRepository; - @Autowired protected RecipeFavoriteRepository recipeFavoriteRepository; @@ -78,6 +72,9 @@ public abstract class RepositoryTest { @Autowired protected TagRepository tagRepository; + @Autowired + protected BannerRepository bannerRepository; + protected Long ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(final Product product) { return productRepository.save(product).getId(); } @@ -195,4 +192,10 @@ public abstract class RepositoryTest { protected void ๋ ˆ์‹œํ”ผ_์ข‹์•„์š”_์ €์žฅ(final RecipeFavorite recipeFavorite) { recipeFavoriteRepository.save(recipeFavorite); } + + protected void ๋ณต์ˆ˜_๋ฐฐ๋„ˆ_์ €์žฅ(final Banner... bannerToSave) { + final List banners = List.of(bannerToSave); + + bannerRepository.saveAll(banners); + } } diff --git a/backend/src/test/java/com/funeat/common/ServiceTest.java b/backend/src/test/java/com/funeat/common/ServiceTest.java index f8b58e5a2..23ee634f5 100644 --- a/backend/src/test/java/com/funeat/common/ServiceTest.java +++ b/backend/src/test/java/com/funeat/common/ServiceTest.java @@ -1,12 +1,14 @@ package com.funeat.common; import com.funeat.auth.application.AuthService; +import com.funeat.banner.application.BannerService; +import com.funeat.banner.domain.Banner; +import com.funeat.banner.persistence.BannerRepository; +import com.funeat.comment.persistence.CommentRepository; import com.funeat.member.application.TestMemberService; import com.funeat.member.domain.Member; import com.funeat.member.domain.favorite.ReviewFavorite; import com.funeat.member.persistence.MemberRepository; -import com.funeat.member.persistence.ProductBookmarkRepository; -import com.funeat.member.persistence.RecipeBookMarkRepository; import com.funeat.member.persistence.RecipeFavoriteRepository; import com.funeat.member.persistence.ReviewFavoriteRepository; import com.funeat.product.application.CategoryService; @@ -48,12 +50,6 @@ public abstract class ServiceTest { @Autowired protected MemberRepository memberRepository; - @Autowired - protected ProductBookmarkRepository productBookmarkRepository; - - @Autowired - protected RecipeBookMarkRepository recipeBookMarkRepository; - @Autowired protected RecipeFavoriteRepository recipeFavoriteRepository; @@ -84,6 +80,12 @@ public abstract class ServiceTest { @Autowired protected TagRepository tagRepository; + @Autowired + protected BannerRepository bannerRepository; + + @Autowired + protected CommentRepository commentRepository; + @Autowired protected AuthService authService; @@ -105,6 +107,9 @@ public abstract class ServiceTest { @Autowired protected TagService tagService; + @Autowired + protected BannerService bannerService; + protected Long ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(final Product product) { return productRepository.save(product).getId(); } @@ -200,4 +205,10 @@ public abstract class ServiceTest { productRecipeRepository.saveAll(productRecipes); } + + protected void ๋ณต์ˆ˜_๋ฐฐ๋„ˆ_์ €์žฅ(final Banner... bannerToSave) { + final List banners = List.of(bannerToSave); + + bannerRepository.saveAll(banners); + } } diff --git a/backend/src/test/java/com/funeat/common/TestImageUploader.java b/backend/src/test/java/com/funeat/common/TestImageUploader.java index 58d4ab6f8..642da2176 100644 --- a/backend/src/test/java/com/funeat/common/TestImageUploader.java +++ b/backend/src/test/java/com/funeat/common/TestImageUploader.java @@ -30,6 +30,10 @@ public String upload(final MultipartFile image) { } } + @Override + public void delete(final String fileName) { + } + private void deleteDirectory(Path directory) throws IOException { // ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด๋ถ€ ํŒŒ์ผ ๋ฐ ๋””๋ ‰ํ† ๋ฆฌ ์‚ญ์ œ try (Stream pathStream = Files.walk(directory)) { diff --git a/backend/src/test/java/com/funeat/fixture/BannerFixture.java b/backend/src/test/java/com/funeat/fixture/BannerFixture.java new file mode 100644 index 000000000..9ab4443f5 --- /dev/null +++ b/backend/src/test/java/com/funeat/fixture/BannerFixture.java @@ -0,0 +1,26 @@ +package com.funeat.fixture; + +import com.funeat.banner.domain.Banner; + +public class BannerFixture { + + public static Banner ๋ฐฐ๋„ˆ1_์ƒ์„ฑ() { + return new Banner("๋ฐฐ๋„ˆ1๋งํฌ", "๋ฐฐ๋„ˆ1.jpeg"); + } + + public static Banner ๋ฐฐ๋„ˆ2_์ƒ์„ฑ() { + return new Banner("๋ฐฐ๋„ˆ2๋งํฌ", "๋ฐฐ๋„ˆ2.jpeg"); + } + + public static Banner ๋ฐฐ๋„ˆ3_์ƒ์„ฑ() { + return new Banner("๋ฐฐ๋„ˆ3๋งํฌ", "๋ฐฐ๋„ˆ3.jpeg"); + } + + public static Banner ๋ฐฐ๋„ˆ4_์ƒ์„ฑ() { + return new Banner("๋ฐฐ๋„ˆ4๋งํฌ", "๋ฐฐ๋„ˆ4.jpeg"); + } + + public static Banner ๋ฐฐ๋„ˆ5_์ƒ์„ฑ() { + return new Banner("๋ฐฐ๋„ˆ5๋งํฌ", "๋ฐฐ๋„ˆ5.jpeg"); + } +} diff --git a/backend/src/test/java/com/funeat/fixture/PageFixture.java b/backend/src/test/java/com/funeat/fixture/PageFixture.java index afae2d14a..773658f48 100644 --- a/backend/src/test/java/com/funeat/fixture/PageFixture.java +++ b/backend/src/test/java/com/funeat/fixture/PageFixture.java @@ -2,6 +2,7 @@ import com.funeat.common.dto.PageDto; import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; @@ -18,6 +19,7 @@ public class PageFixture { public static final String ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ = "rating,desc"; public static final String ๊ณผ๊ฑฐ์ˆœ = "createdAt,asc"; public static final String ์ตœ์‹ ์ˆœ = "createdAt,desc"; + public static final String ์•„์ด๋””_๋‚ด๋ฆผ์ฐจ์ˆœ = "id,desc"; public static final Long PAGE_SIZE = 10L; public static final Long FIRST_PAGE = 0L; @@ -45,6 +47,30 @@ public class PageFixture { return new PageDto(totalDataCount, totalPages, firstPage, lastPage, requestPage, requestSize); } + public static Pageable ํŽ˜์ด์ง€์š”์ฒญ_์ข‹์•„์š”_๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(final int page, final int size) { + final var sort = Sort.by(Direction.DESC, "favoriteCount"); + + return PageRequest.of(page, size, sort); + } + + public static Pageable ํŽ˜์ด์ง€์š”์ฒญ_์ตœ์‹ ์ˆœ_์ƒ์„ฑ(final int page, final int size) { + final var sort = Sort.by(Direction.DESC, "createdAt"); + + return PageRequest.of(page, size, sort); + } + + public static Pageable ํŽ˜์ด์ง€์š”์ฒญ_ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ_์ƒ์„ฑ(final int page, final int size) { + final var sort = Sort.by(Direction.ASC, "rating"); + + return PageRequest.of(page, size, sort); + } + + public static Pageable ํŽ˜์ด์ง€์š”์ฒญ_ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(final int page, final int size) { + final var sort = Sort.by(Direction.DESC, "rating"); + + return PageRequest.of(page, size, sort); + } + public static Long ์ด_๋ฐ์ดํ„ฐ_๊ฐœ์ˆ˜(final Long count) { return count; } diff --git a/backend/src/test/java/com/funeat/fixture/ProductFixture.java b/backend/src/test/java/com/funeat/fixture/ProductFixture.java index 15b2fa27e..6bb7da0d9 100644 --- a/backend/src/test/java/com/funeat/fixture/ProductFixture.java +++ b/backend/src/test/java/com/funeat/fixture/ProductFixture.java @@ -130,6 +130,22 @@ public class ProductFixture { return new Product("์• ํ”Œ๋ง๊ณ ", 3000L, "image.png", "๋ง›์žˆ๋Š” ์• ํ”Œ๋ง๊ณ ", 5.0, category); } + public static Product ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ5000์›_๋ฆฌ๋ทฐ0๊ฐœ_์ƒ์„ฑ(final Category category) { + return new Product("์‚ผ๊ฐ๊น€๋ฐฅ", 5000L, "image.png", "๋ง›์žˆ๋Š” ์‚ผ๊ฐ๊น€๋ฐฅ", category, 0L); + } + + public static Product ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_๋ฆฌ๋ทฐ1๊ฐœ_์ƒ์„ฑ(final Category category) { + return new Product("์‚ผ๊ฐ๊น€๋ฐฅ", 2000L, "image.png", "๋ง›์žˆ๋Š” ์‚ผ๊ฐ๊น€๋ฐฅ", category, 1L); + } + + public static Product ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_๋ฆฌ๋ทฐ3๊ฐœ_์ƒ์„ฑ(final Category category) { + return new Product("์‚ผ๊ฐ๊น€๋ฐฅ", 1000L, "image.png", "๋ง›์žˆ๋Š” ์‚ผ๊ฐ๊น€๋ฐฅ", category, 3L); + } + + public static Product ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_๋ฆฌ๋ทฐ5๊ฐœ_์ƒ์„ฑ(final Category category) { + return new Product("์‚ผ๊ฐ๊น€๋ฐฅ", 3000L, "image.png", "๋ง›์žˆ๋Š” ์‚ผ๊ฐ๊น€๋ฐฅ", category, 5L); + } + public static ProductRecipe ๋ ˆ์‹œํ”ผ_์•ˆ์—_๋“ค์–ด๊ฐ€๋Š”_์ƒํ’ˆ_์ƒ์„ฑ(final Product product, final Recipe recipe) { return new ProductRecipe(product, recipe); } diff --git a/backend/src/test/java/com/funeat/fixture/RecipeFixture.java b/backend/src/test/java/com/funeat/fixture/RecipeFixture.java index 2050727f3..2d3bb3deb 100644 --- a/backend/src/test/java/com/funeat/fixture/RecipeFixture.java +++ b/backend/src/test/java/com/funeat/fixture/RecipeFixture.java @@ -6,6 +6,7 @@ import com.funeat.recipe.domain.RecipeImage; import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeFavoriteRequest; +import java.time.LocalDateTime; import java.util.List; @SuppressWarnings("NonAsciiCharacters") @@ -33,6 +34,11 @@ public class RecipeFixture { return new Recipe("The most delicious recipes", "More rice, more rice, more rice.. Done!!", member, favoriteCount); } + public static Recipe ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(final Member member, final Long favoriteCount, final LocalDateTime createdAt) { + return new Recipe("The most delicious recipes", "More rice, more rice, more rice.. Done!!", + member, favoriteCount, createdAt); + } + public static RecipeFavorite ๋ ˆ์‹œํ”ผ_์ข‹์•„์š”_์ƒ์„ฑ(final Member member, final Recipe recipe, final Boolean favorite) { return new RecipeFavorite(member, recipe, favorite); } diff --git a/backend/src/test/java/com/funeat/fixture/ReviewFixture.java b/backend/src/test/java/com/funeat/fixture/ReviewFixture.java index 3ae53a3c7..fee2b0b7b 100644 --- a/backend/src/test/java/com/funeat/fixture/ReviewFixture.java +++ b/backend/src/test/java/com/funeat/fixture/ReviewFixture.java @@ -1,10 +1,17 @@ package com.funeat.fixture; +import static com.funeat.fixture.PageFixture.์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ; +import static com.funeat.fixture.PageFixture.์ตœ์‹ ์ˆœ; +import static com.funeat.fixture.PageFixture.ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ; +import static com.funeat.fixture.PageFixture.ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ; + import com.funeat.member.domain.Member; import com.funeat.product.domain.Product; import com.funeat.review.domain.Review; import com.funeat.review.dto.ReviewCreateRequest; import com.funeat.review.dto.ReviewFavoriteRequest; +import com.funeat.review.dto.SortingReviewRequest; +import java.time.LocalDateTime; import java.util.List; @SuppressWarnings("NonAsciiCharacters") @@ -21,6 +28,10 @@ public class ReviewFixture { public static final boolean ์žฌ๊ตฌ๋งคO = true; public static final boolean ์žฌ๊ตฌ๋งคX = false; + public static final Long ์ฒซ_๋ชฉ๋ก์„_๊ฐ€์ ธ์˜ด = 0L; + public static final boolean ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌO = true; + public static final boolean ๋‹ค์Œ_๋ฐ์ดํ„ฐ_์กด์žฌX = false; + public static Review ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(final Member member, final Product product, final Long count) { return new Review(member, product, "test1", 1L, "test", true, count); } @@ -65,6 +76,15 @@ public class ReviewFixture { return new Review(member, product, "test5", 5L, "test", false, count); } + public static Review ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(final Member member, final Product product, final Long count, + final LocalDateTime createdAt) { + return new Review(member, product, "test5", 5L, "test", false, count, createdAt); + } + + public static Review ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€์—†์Œ_ํ‰์ 1์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(final Member member, final Product product, final Long count) { + return new Review(member, product, "", 1L, "test", false, count); + } + public static ReviewCreateRequest ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์ƒ์„ฑ(final Long rating, final List tagIds, final String content, final Boolean rebuy) { return new ReviewCreateRequest(rating, tagIds, content, rebuy); @@ -81,4 +101,24 @@ public class ReviewFixture { public static ReviewFavoriteRequest ๋ฆฌ๋ทฐ์ข‹์•„์š”์š”์ฒญ_์ƒ์„ฑ(final Boolean favorite) { return new ReviewFavoriteRequest(favorite); } + + public static SortingReviewRequest ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(final Long lastReviewId) { + return new SortingReviewRequest(์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ, lastReviewId); + } + + public static SortingReviewRequest ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_์ตœ์‹ ์ˆœ_์ƒ์„ฑ(final Long lastReviewId) { + return new SortingReviewRequest(์ตœ์‹ ์ˆœ, lastReviewId); + } + + public static SortingReviewRequest ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ_์ƒ์„ฑ(final Long lastReviewId) { + return new SortingReviewRequest(ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ, lastReviewId); + } + + public static SortingReviewRequest ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(final Long lastReviewId) { + return new SortingReviewRequest(ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ, lastReviewId); + } + + public static SortingReviewRequest ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_์กด์žฌํ•˜์ง€์•Š๋Š”์ •๋ ฌ_์ƒ์„ฑ() { + return new SortingReviewRequest("test,test", 1L); + } } diff --git a/backend/src/test/java/com/funeat/member/domain/favorite/RecipeFavoriteTest.java b/backend/src/test/java/com/funeat/member/domain/favorite/RecipeFavoriteTest.java index 99f69ae56..4b2cc940b 100644 --- a/backend/src/test/java/com/funeat/member/domain/favorite/RecipeFavoriteTest.java +++ b/backend/src/test/java/com/funeat/member/domain/favorite/RecipeFavoriteTest.java @@ -10,23 +10,6 @@ class RecipeFavoriteTest { - @Nested - class create_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { - - @Test - void create๋ฅผ_ํ†ตํ•œ_์ƒ์„ฑ์‹œ_favorite์€_false๋กœ_์ดˆ๊ธฐํ™”๋œ๋‹ค() { - // given - final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var recipe = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member); - - // when - final var actual = RecipeFavorite.create(member, recipe); - - // then - assertThat(actual.getFavorite()).isFalse(); - } - } - @Nested class updateFavorite_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @@ -35,7 +18,7 @@ class updateFavorite_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { // given final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); final var recipe = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member); - final var recipeFavorite = RecipeFavorite.create(member, recipe); + final var recipeFavorite = RecipeFavorite.create(member, recipe, false); // when recipeFavorite.updateFavorite(true); @@ -55,8 +38,7 @@ class updateFavorite_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); final var recipe = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member); - final var recipeFavorite = RecipeFavorite.create(member, recipe); - recipeFavorite.updateFavorite(true); + final var recipeFavorite = RecipeFavorite.create(member, recipe, true); // when recipeFavorite.updateFavorite(false); @@ -76,8 +58,7 @@ class updateFavorite_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); final var recipe = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member); - final var recipeFavorite = RecipeFavorite.create(member, recipe); - recipeFavorite.updateFavorite(true); + final var recipeFavorite = RecipeFavorite.create(member, recipe, true); // when recipeFavorite.updateFavorite(true); @@ -97,7 +78,7 @@ class updateFavorite_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); final var recipe = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member); - final var recipeFavorite = RecipeFavorite.create(member, recipe); + final var recipeFavorite = RecipeFavorite.create(member, recipe, false); // when recipeFavorite.updateFavorite(false); diff --git a/backend/src/test/java/com/funeat/member/persistence/ReviewFavoriteRepositoryTest.java b/backend/src/test/java/com/funeat/member/persistence/ReviewFavoriteRepositoryTest.java index 73ed00553..fcb190d28 100644 --- a/backend/src/test/java/com/funeat/member/persistence/ReviewFavoriteRepositoryTest.java +++ b/backend/src/test/java/com/funeat/member/persistence/ReviewFavoriteRepositoryTest.java @@ -3,6 +3,7 @@ import static com.funeat.fixture.CategoryFixture.์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ; import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ; import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ; +import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; @@ -11,6 +12,7 @@ import com.funeat.common.RepositoryTest; import com.funeat.member.domain.favorite.ReviewFavorite; +import java.util.List; import java.util.NoSuchElementException; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -106,4 +108,77 @@ class findByMemberAndReview_์‹คํŒจ_ํ…Œ์ŠคํŠธ { .isInstanceOf(NoSuchElementException.class); } } + + @Nested + class deleteByReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ํ•ด๋‹น_๋ฆฌ๋ทฐ์—_๋‹ฌ๋ฆฐ_์ข‹์•„์š”๋ฅผ_์‚ญ์ œํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); + final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); + ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 0L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 0L); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var reviewFavorite1_1 = ReviewFavorite.create(member1, review1, true); + final var reviewFavorite1_2 = ReviewFavorite.create(member2, review1, true); + final var reviewFavorite1_3 = ReviewFavorite.create(member3, review1, true); + final var reviewFavorite2_1 = ReviewFavorite.create(member1, review2, true); + final var reviewFavorite2_2 = ReviewFavorite.create(member2, review2, true); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ข‹์•„์š”_์ €์žฅ(reviewFavorite1_1, reviewFavorite1_2, reviewFavorite1_3, reviewFavorite2_1, reviewFavorite2_2); + + final var expected = List.of(reviewFavorite2_1, reviewFavorite2_2); + + // when + reviewFavoriteRepository.deleteByReview(review1); + + // then + final var remainings = reviewFavoriteRepository.findAll(); + assertThat(remainings).usingRecursiveComparison() + .isEqualTo(expected); + } + } + + @Nested + class findByReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฆฌ๋ทฐ๋กœ_ํ•ด๋‹น_๋ฆฌ๋ทฐ์—_๋‹ฌ๋ฆฐ_์ข‹์•„์š”๋ฅผ_์กฐํšŒํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(review); + + final var reviewFavorite = ReviewFavorite.create(member, review, true); + ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ข‹์•„์š”_์ €์žฅ(reviewFavorite); + + final var expected = List.of(reviewFavorite); + + // when + final var actual = reviewFavoriteRepository.findByReview(review); + + // then + assertThat(actual).usingRecursiveComparison() + .ignoringExpectedNullFields() + .isEqualTo(expected); + } + } } diff --git a/backend/src/test/java/com/funeat/product/application/ProductServiceTest.java b/backend/src/test/java/com/funeat/product/application/ProductServiceTest.java index 5aa812dc6..9f5b88c5b 100644 --- a/backend/src/test/java/com/funeat/product/application/ProductServiceTest.java +++ b/backend/src/test/java/com/funeat/product/application/ProductServiceTest.java @@ -109,16 +109,16 @@ class ์ƒํ’ˆ_๊ฐœ์ˆ˜์—_๋Œ€ํ•œ_ํ…Œ์ŠคํŠธ { final var review1_4 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product1, 0L); final var review2_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product2, 0L); final var review2_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product2, 0L); - final var review3_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product2, 0L); - final var review4_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product2, 0L); - final var review4_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product2, 0L); - final var review4_3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product2, 0L); + final var review3_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product3, 0L); + final var review4_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product4, 0L); + final var review4_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product4, 0L); + final var review4_3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product4, 0L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1_1, review1_2, review1_3, review1_4, review2_1, review2_2, review3_1, review4_1, review4_2, review4_3); - final var rankingProductDto1 = RankingProductDto.toDto(product2); - final var rankingProductDto2 = RankingProductDto.toDto(product3); - final var rankingProductDto3 = RankingProductDto.toDto(product4); + final var rankingProductDto1 = RankingProductDto.toDto(product3); + final var rankingProductDto2 = RankingProductDto.toDto(product4); + final var rankingProductDto3 = RankingProductDto.toDto(product2); final var rankingProductDtos = List.of(rankingProductDto1, rankingProductDto2, rankingProductDto3); final var expected = RankingProductsResponse.toResponse(rankingProductDtos); diff --git a/backend/src/test/java/com/funeat/product/domain/ProductTest.java b/backend/src/test/java/com/funeat/product/domain/ProductTest.java index ddfeaa2c7..7e012dd22 100644 --- a/backend/src/test/java/com/funeat/product/domain/ProductTest.java +++ b/backend/src/test/java/com/funeat/product/domain/ProductTest.java @@ -1,7 +1,6 @@ package com.funeat.product.domain; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.SoftAssertions.assertSoftly; import org.junit.jupiter.api.DisplayNameGeneration; @@ -14,17 +13,17 @@ class ProductTest { @Nested - class updateAverageRating_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + class updateAverageRatingForInsert_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test void ํ‰๊ท _ํ‰์ ์„_์—…๋ฐ์ดํŠธ_ํ• _์ˆ˜_์žˆ๋‹ค() { // given final var product = new Product("testName", 1000L, "testImage", "testContent", null); - final var reviewRating = 4L; final var reviewCount = 1L; + final var reviewRating = 4L; // when - product.updateAverageRating(reviewRating, reviewCount); + product.updateAverageRatingForInsert(reviewCount, reviewRating); final var actual = product.getAverageRating(); // then @@ -35,16 +34,16 @@ class updateAverageRating_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { void ํ‰๊ท _ํ‰์ ์„_์—ฌ๋Ÿฌ๋ฒˆ_์—…๋ฐ์ดํŠธ_ํ• _์ˆ˜_์žˆ๋‹ค() { // given final var product = new Product("testName", 1000L, "testImage", "testContent", null); - final var reviewRating1 = 4L; - final var reviewRating2 = 2L; final var reviewCount1 = 1L; final var reviewCount2 = 2L; + final var reviewRating1 = 4L; + final var reviewRating2 = 2L; // when - product.updateAverageRating(reviewRating1, reviewCount1); + product.updateAverageRatingForInsert(reviewCount1, reviewRating1); final var actual1 = product.getAverageRating(); - product.updateAverageRating(reviewRating2, reviewCount2); + product.updateAverageRatingForInsert(reviewCount2, reviewRating2); final var actual2 = product.getAverageRating(); // then @@ -58,39 +57,34 @@ class updateAverageRating_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } @Nested - class updateAverageRating_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + class updateAverageRatingForDelete_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ๋ฆฌ๋ทฐ_ํ‰์ ์—_null_๊ฐ’์ด_๋“ค์–ด์˜ค๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + void ๋ฆฌ๋ทฐ๊ฐ€_ํ•˜๋‚˜์ธ_์ƒํ’ˆ์˜_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ•˜๋ฉด_ํ‰๊ท ํ‰์ ์€_0์ ์ด_๋œ๋‹ค() { // given - final var product = new Product("testName", 1000L, "testImage", "testContent", null); - final var reviewCount = 1L; + final var product = new Product("testName", 1000L, "testImage", "testContent", 4.0, null, 1L); + final var reviewRating = 4L; // when - assertThatThrownBy(() -> product.updateAverageRating(null, reviewCount)) - .isInstanceOf(NullPointerException.class); - } - - @Test - void ๋ฆฌ๋ทฐ_ํ‰์ ์ด_0์ ์ด๋ผ๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•ด์•ผํ•˜๋Š”๋ฐ_๊ด€๋ จ_๋กœ์ง์ด_์—†์–ด_ํ†ต๊ณผํ•˜๊ณ _์žˆ๋‹ค() { - // given - final var product = new Product("testName", 1000L, "testImage", "testContent", null); - final var reviewRating = 0L; - final var reviewCount = 1L; + product.updateAverageRatingForDelete(reviewRating); + final var actual = product.getAverageRating(); - // when - product.updateAverageRating(reviewRating, reviewCount); + // then + assertThat(actual).isEqualTo(0.0); } @Test - void ๋ฆฌ๋ทฐ_๊ฐœ์ˆ˜๊ฐ€_0๊ฐœ๋ผ๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•ด์•ผํ•˜๋Š”๋ฐ_calculatedRating๊ฐ’์ด_infinity๊ฐ€_๋‚˜์™€_ํ†ต๊ณผํ•˜๊ณ _์žˆ๋‹ค() { + void ๋ฆฌ๋ทฐ๊ฐ€_์—ฌ๋Ÿฌ๊ฐœ์ธ_์ƒํ’ˆ์˜_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ•˜๋ฉด_ํ‰๊ท ํ‰์ ์ด_๊ฐฑ์‹ ๋œ๋‹ค() { // given - final var product = new Product("testName", 1000L, "testImage", "testContent", null); - final var reviewRating = 3L; - final var reviewCount = 0L; + final var product = new Product("testName", 1000L, "testImage", "testContent", 4.0, null, 4L); + final var reviewRating = 5L; // when - product.updateAverageRating(reviewRating, reviewCount); + product.updateAverageRatingForDelete(reviewRating); + final var actual = product.getAverageRating(); + + // then + assertThat(actual).isEqualTo(3.7); } } diff --git a/backend/src/test/java/com/funeat/product/persistence/ProductRepositoryTest.java b/backend/src/test/java/com/funeat/product/persistence/ProductRepositoryTest.java index 887958516..107585475 100644 --- a/backend/src/test/java/com/funeat/product/persistence/ProductRepositoryTest.java +++ b/backend/src/test/java/com/funeat/product/persistence/ProductRepositoryTest.java @@ -4,37 +4,23 @@ import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ; import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ; import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ; -import static com.funeat.fixture.PageFixture.๊ฐ€๊ฒฉ_๋‚ด๋ฆผ์ฐจ์ˆœ; -import static com.funeat.fixture.PageFixture.๊ฐ€๊ฒฉ_์˜ค๋ฆ„์ฐจ์ˆœ; import static com.funeat.fixture.PageFixture.ํŽ˜์ด์ง€์š”์ฒญ_๊ธฐ๋ณธ_์ƒ์„ฑ; -import static com.funeat.fixture.PageFixture.ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ; -import static com.funeat.fixture.PageFixture.ํ‰๊ท _ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ; -import static com.funeat.fixture.PageFixture.ํ‰๊ท _ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_๋ง๊ณ ๋น™์ˆ˜_๊ฐ€๊ฒฉ5000์›_ํ‰์ 4์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 4์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 1์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 5์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 1์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 2์ _์ƒ์„ฑ; -import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ5000์›_ํ‰์ 1์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์• ํ”Œ๋ง๊ณ _๊ฐ€๊ฒฉ3000์›_ํ‰์ 5์ _์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; -import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; -import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; -import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static org.assertj.core.api.Assertions.assertThat; import com.funeat.common.RepositoryTest; -import com.funeat.product.dto.ProductInCategoryDto; import com.funeat.product.dto.ProductReviewCountDto; +import java.time.LocalDateTime; +import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -43,134 +29,18 @@ class ProductRepositoryTest extends RepositoryTest { @Nested - class findByAllCategory_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { - - @Test - void ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ์„_ํ‰์ ์ด_๋†’์€_์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() { - // given - final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); - ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - - final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); - final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); - final var product4 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); - final var product5 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(category); - ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3, product4, product5); - - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 3, ํ‰๊ท _ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ); - - final var productInCategoryDto1 = ProductInCategoryDto.toDto(product5, 0L); - final var productInCategoryDto2 = ProductInCategoryDto.toDto(product4, 0L); - final var productInCategoryDto3 = ProductInCategoryDto.toDto(product3, 0L); - final var expected = List.of(productInCategoryDto1, productInCategoryDto2, productInCategoryDto3); - - // when - final var actual = productRepository.findAllByCategory(category, page).getContent(); - - // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); - } - - @Test - void ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ์„_ํ‰์ ์ด_๋‚ฎ์€_์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() { - // given - final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); - ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - - final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); - final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); - final var product4 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); - final var product5 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(category); - ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3, product4, product5); - - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 3, ํ‰๊ท _ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ); - - final var productInCategoryDto1 = ProductInCategoryDto.toDto(product1, 0L); - final var productInCategoryDto2 = ProductInCategoryDto.toDto(product2, 0L); - final var productInCategoryDto3 = ProductInCategoryDto.toDto(product3, 0L); - final var expected = List.of(productInCategoryDto1, productInCategoryDto2, productInCategoryDto3); - - // when - final var actual = productRepository.findAllByCategory(category, page).getContent(); - - // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); - } - - @Test - void ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ์„_๊ฐ€๊ฒฉ์ด_๋†’์€_์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() { - // given - final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); - ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - - final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product4 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product5 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ5000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3, product4, product5); - - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 3, ๊ฐ€๊ฒฉ_๋‚ด๋ฆผ์ฐจ์ˆœ); - - final var productInCategoryDto1 = ProductInCategoryDto.toDto(product5, 0L); - final var productInCategoryDto2 = ProductInCategoryDto.toDto(product4, 0L); - final var productInCategoryDto3 = ProductInCategoryDto.toDto(product3, 0L); - final var expected = List.of(productInCategoryDto1, productInCategoryDto2, productInCategoryDto3); - - // when - final var actual = productRepository.findAllByCategory(category, page).getContent(); - - // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); - } - - @Test - void ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ์„_๊ฐ€๊ฒฉ์ด_๋‚ฎ์€_์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() { - // given - final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); - ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - - final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product4 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product5 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ5000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3, product4, product5); - - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 3, ๊ฐ€๊ฒฉ_์˜ค๋ฆ„์ฐจ์ˆœ); - - final var productInCategoryDto1 = ProductInCategoryDto.toDto(product1, 0L); - final var productInCategoryDto2 = ProductInCategoryDto.toDto(product2, 0L); - final var productInCategoryDto3 = ProductInCategoryDto.toDto(product3, 0L); - final var expected = List.of(productInCategoryDto1, productInCategoryDto2, productInCategoryDto3); - - // when - final var actual = productRepository.findAllByCategory(category, page).getContent(); - - // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); - } - } - - @Nested - class findAllByCategoryOrderByReviewCountDesc_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + class findAllByAverageRatingGreaterThan3_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„_์ƒํ’ˆ์„_๋ฆฌ๋ทฐ์ˆ˜๊ฐ€_๋งŽ์€_์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() { + void ํ‰์ ์ด_3๋ณด๋‹ค_ํฐ_๋ชจ๋“ _์ƒํ’ˆ๋“ค๊ณผ_๋ฆฌ๋ทฐ_์ˆ˜๋ฅผ_์กฐํšŒํ•œ๋‹ค() { // given final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); - final var product4 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); + final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 5์ _์ƒ์„ฑ(category); + final var product4 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3, product4); final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); @@ -178,65 +48,52 @@ class findAllByCategoryOrderByReviewCountDesc_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); - final var review1_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product1, 0L); - final var review1_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product1, 0L); - final var review2_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member3, product2, 0L); - final var review2_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product2, 0L); - final var review2_3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product2, 0L); - final var review3_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product3, 0L); + final var review1_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product1, 0L, LocalDateTime.now().minusDays(2L)); + final var review1_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member2, product1, 0L, LocalDateTime.now().minusDays(3L)); + final var review2_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product2, 0L, LocalDateTime.now().minusDays(10L)); + final var review2_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product2, 0L, LocalDateTime.now().minusDays(1L)); + final var review2_3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member2, product2, 0L, LocalDateTime.now().minusDays(9L)); + final var review3_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product3, 0L, LocalDateTime.now().minusDays(8L)); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1_1, review1_2, review2_1, review2_2, review2_3, review3_1); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_๊ธฐ๋ณธ_์ƒ์„ฑ(0, 3); - - final var productInCategoryDto1 = ProductInCategoryDto.toDto(product2, 3L); - final var productInCategoryDto2 = ProductInCategoryDto.toDto(product1, 2L); - final var productInCategoryDto3 = ProductInCategoryDto.toDto(product3, 1L); - final var expected = List.of(productInCategoryDto1, productInCategoryDto2, productInCategoryDto3); + final var productReviewCountDto1 = new ProductReviewCountDto(product2, 3L); + final var productReviewCountDto2 = new ProductReviewCountDto(product3, 1L); + final var expected = List.of(productReviewCountDto1, productReviewCountDto2); // when - final var actual = productRepository.findAllByCategoryOrderByReviewCountDesc(category, page) - .getContent(); + final var startDateTime = LocalDateTime.now().minusWeeks(2L); + final var endDateTime = LocalDateTime.now(); + final var actual = productRepository.findAllByAverageRatingGreaterThan3(startDateTime, endDateTime); // then assertThat(actual).usingRecursiveComparison() .isEqualTo(expected); } - } - - @Nested - class findAllByAverageRatingGreaterThan3_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ํ‰์ ์ด_3๋ณด๋‹ค_ํฐ_๋ชจ๋“ _์ƒํ’ˆ๋“ค๊ณผ_๋ฆฌ๋ทฐ_์ˆ˜๋ฅผ_์กฐํšŒํ•œ๋‹ค() { + void ๊ธฐ๊ฐ„_์•ˆ์—_๋ฆฌ๋ทฐ๊ฐ€_์กด์žฌํ•˜๋Š”_์ƒํ’ˆ์ด_์—†์œผ๋ฉด_๋นˆ_๋ฆฌ์ŠคํŠธ๋ฅผ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { // given final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); - final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 5์ _์ƒ์„ฑ(category); - final var product4 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ4000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); - ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3, product4); + ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2); final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2); - final var review1_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product1, 0L); - final var review1_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product1, 0L); - final var review2_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member3, product2, 0L); - final var review2_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product2, 0L); - final var review2_3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product2, 0L); - final var review3_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product3, 0L); - ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1_1, review1_2, review2_1, review2_2, review2_3, review3_1); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member1, product1, 0L, LocalDateTime.now().minusDays(15L)); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member2, product2, 0L, LocalDateTime.now().minusWeeks(3L)); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); - final var productReviewCountDto1 = new ProductReviewCountDto(product2, 3L); - final var productReviewCountDto2 = new ProductReviewCountDto(product3, 1L); - final var expected = List.of(productReviewCountDto1, productReviewCountDto2); + final var expected = Collections.emptyList(); // when - final var actual = productRepository.findAllByAverageRatingGreaterThan3(); + final var startDateTime = LocalDateTime.now().minusWeeks(2L); + final var endDateTime = LocalDateTime.now(); + final var actual = productRepository.findAllByAverageRatingGreaterThan3(startDateTime, endDateTime); // then assertThat(actual).usingRecursiveComparison() 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 fcd4e2f40..81badf4f6 100644 --- a/backend/src/test/java/com/funeat/recipe/application/RecipeServiceTest.java +++ b/backend/src/test/java/com/funeat/recipe/application/RecipeServiceTest.java @@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.SoftAssertions.assertSoftly; +import com.funeat.comment.domain.Comment; import com.funeat.common.ServiceTest; import com.funeat.common.dto.PageDto; import com.funeat.member.domain.Member; @@ -35,17 +36,24 @@ import com.funeat.product.domain.CategoryType; import com.funeat.product.domain.Product; import com.funeat.product.exception.ProductException.ProductNotFoundException; +import com.funeat.recipe.dto.RankingRecipeDto; +import com.funeat.recipe.dto.RankingRecipesResponse; +import com.funeat.recipe.dto.RecipeAuthorDto; +import com.funeat.recipe.dto.RecipeCommentCondition; +import com.funeat.recipe.dto.RecipeCommentCreateRequest; +import com.funeat.recipe.dto.RecipeCommentResponse; import com.funeat.recipe.dto.RecipeCreateRequest; import com.funeat.recipe.dto.RecipeDetailResponse; import com.funeat.recipe.dto.RecipeDto; import com.funeat.recipe.exception.RecipeException.RecipeNotFoundException; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; @SuppressWarnings("NonAsciiCharacters") class RecipeServiceTest extends ServiceTest { @@ -317,7 +325,7 @@ class getSortingRecipes_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } @Test - void ๊ฟ€์กฐํ•ฉ์„_์ตœ์‹ ์ˆœ์œผ๋กœ_์ •๋ ฌํ• _์ˆ˜_์žˆ๋‹ค() { + void ๊ฟ€์กฐํ•ฉ์„_์ตœ์‹ ์ˆœ์œผ๋กœ_์ •๋ ฌํ• _์ˆ˜_์žˆ๋‹ค() throws InterruptedException { // given final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); @@ -333,7 +341,9 @@ class getSortingRecipes_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3); final var recipe1_1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member1, 1L); + Thread.sleep(100); final var recipe1_2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member1, 3L); + Thread.sleep(100); final var recipe1_3 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member1, 2L); ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1_1, recipe1_2, recipe1_3); @@ -545,6 +555,342 @@ class likeRecipe_์‹คํŒจ_ํ…Œ์ŠคํŠธ { } } + @Nested + class getTop3Recipes_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Nested + class ๊ฟ€์กฐํ•ฉ_๊ฐœ์ˆ˜์—_๋Œ€ํ•œ_ํ…Œ์ŠคํŠธ { + + @Test + void ์ „์ฒด_๊ฟ€์กฐํ•ฉ์ด_ํ•˜๋‚˜๋„_์—†์–ด๋„_๋ฐ˜ํ™˜๊ฐ’์€_์žˆ์–ด์•ผํ•œ๋‹ค() { + // given + final var expected = RankingRecipesResponse.toResponse(Collections.emptyList()); + + // when + final var actual = recipeService.getTop3Recipes(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ๋žญํ‚น_์กฐ๊ฑด์—_๋ถ€ํ•ฉํ•˜๋Š”_๊ฟ€์กฐํ•ฉ์ด_1๊ฐœ๋ฉด_๊ฟ€์กฐํ•ฉ์ด_1๊ฐœ_๋ฐ˜ํ™˜๋œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var recipe = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 2L, now); + ๋‹จ์ผ_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe); + + final var author = RecipeAuthorDto.toDto(member); + final var rankingRecipeDto = RankingRecipeDto.toDto(recipe, Collections.emptyList(), author); + final var rankingRecipesDtos = Collections.singletonList(rankingRecipeDto); + final var expected = RankingRecipesResponse.toResponse(rankingRecipesDtos); + + // when + final var actual = recipeService.getTop3Recipes(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ๋žญํ‚น_์กฐ๊ฑด์—_๋ถ€ํ•ฉํ•˜๋Š”_๊ฟ€์กฐํ•ฉ์ด_2๊ฐœ๋ฉด_๊ฟ€์กฐํ•ฉ์ด_2๊ฐœ_๋ฐ˜ํ™˜๋œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var recipe1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 2L, now.minusDays(1L)); + final var recipe2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 2L, now); + ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1, recipe2); + + final var author = RecipeAuthorDto.toDto(member); + final var rankingRecipeDto1 = RankingRecipeDto.toDto(recipe1, Collections.emptyList(), author); + final var rankingRecipeDto2 = RankingRecipeDto.toDto(recipe2, Collections.emptyList(), author); + final var rankingRecipesDtos = List.of(rankingRecipeDto2, rankingRecipeDto1); + final var expected = RankingRecipesResponse.toResponse(rankingRecipesDtos); + + // when + final var actual = recipeService.getTop3Recipes(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ์ „์ฒด_๊ฟ€์กฐํ•ฉ_์ค‘_๋žญํ‚น์ด_๋†’์€_์ƒ์œ„_3๊ฐœ_๊ฟ€์กฐํ•ฉ์„_๊ตฌํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var recipe1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 4L, now.minusDays(10L)); + final var recipe2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 6L, now.minusDays(10L)); + final var recipe3 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 5L, now); + final var recipe4 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 6L, now); + ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1, recipe2, recipe3, recipe4); + + final var author = RecipeAuthorDto.toDto(member); + final var rankingRecipeDto1 = RankingRecipeDto.toDto(recipe1, Collections.emptyList(), author); + final var rankingRecipeDto2 = RankingRecipeDto.toDto(recipe2, Collections.emptyList(), author); + final var rankingRecipeDto3 = RankingRecipeDto.toDto(recipe3, Collections.emptyList(), author); + final var rankingRecipeDto4 = RankingRecipeDto.toDto(recipe4, Collections.emptyList(), author); + final var rankingRecipesDtos = List.of(rankingRecipeDto4, rankingRecipeDto3, rankingRecipeDto2); + final var expected = RankingRecipesResponse.toResponse(rankingRecipesDtos); + + // when + final var actual = recipeService.getTop3Recipes(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + } + + @Nested + class ๊ฟ€์กฐํ•ฉ_๋žญํ‚น_์ ์ˆ˜์—_๋Œ€ํ•œ_ํ…Œ์ŠคํŠธ { + + @Test + void ๊ฟ€์กฐํ•ฉ_์ข‹์•„์š”_์ˆ˜๊ฐ€_๊ฐ™์œผ๋ฉด_์ตœ๊ทผ_์ƒ์„ฑ๋œ_๊ฟ€์กฐํ•ฉ์˜_๋žญํ‚น์„_๋”_๋†’๊ฒŒ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var recipe1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 10L, now.minusDays(9L)); + final var recipe2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 10L, now.minusDays(4L)); + ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1, recipe2); + + final var author = RecipeAuthorDto.toDto(member); + final var rankingRecipeDto1 = RankingRecipeDto.toDto(recipe1, Collections.emptyList(), author); + final var rankingRecipeDto2 = RankingRecipeDto.toDto(recipe2, Collections.emptyList(), author); + final var rankingRecipesDtos = List.of(rankingRecipeDto2, rankingRecipeDto1); + final var expected = RankingRecipesResponse.toResponse(rankingRecipesDtos); + + // when + final var actual = recipeService.getTop3Recipes(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ๊ฟ€์กฐํ•ฉ_์ƒ์„ฑ_์ผ์ž๊ฐ€_๊ฐ™์œผ๋ฉด_์ข‹์•„์š”_์ˆ˜๊ฐ€_๋งŽ์€_๊ฟ€์กฐํ•ฉ์˜_๋žญํ‚น์„_๋”_๋†’๊ฒŒ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var recipe1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 2L, now.minusDays(1L)); + final var recipe2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 4L, now.minusDays(1L)); + ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1, recipe2); + + final var author = RecipeAuthorDto.toDto(member); + final var rankingRecipeDto1 = RankingRecipeDto.toDto(recipe1, Collections.emptyList(), author); + final var rankingRecipeDto2 = RankingRecipeDto.toDto(recipe2, Collections.emptyList(), author); + final var rankingRecipesDtos = List.of(rankingRecipeDto2, rankingRecipeDto1); + final var expected = RankingRecipesResponse.toResponse(rankingRecipesDtos); + + // when + final var actual = recipeService.getTop3Recipes(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + } + } + + @Nested + class writeCommentOfRecipe_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_์ž‘์„ฑํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3); + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + final var authorId = author.getId(); + + final var images = ์—ฌ๋Ÿฌ_์ด๋ฏธ์ง€_์ƒ์„ฑ(3); + + final var productIds = List.of(product1.getId(), product2.getId(), product3.getId()); + final var recipeCreateRequest = new RecipeCreateRequest("์ œ์ผ๋กœ ๋ง›์žˆ๋Š” ๋ ˆ์‹œํ”ผ", productIds, + "์šฐ์„  ๋ฐฅ์„ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์œผ๋ฉด.. ๋!!"); + + final var savedMemberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ()); + final var savedRecipeId = recipeService.create(authorId, images, recipeCreateRequest); + + // when + final var request = new RecipeCommentCreateRequest("๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์ด์—์š”"); + final var savedCommentId = recipeService.writeCommentOfRecipe(savedMemberId, savedRecipeId, request); + + // then + final var result = commentRepository.findById(savedCommentId).get(); + final var savedRecipe = recipeRepository.findById(savedRecipeId).get(); + final var savedMember = memberRepository.findById(savedMemberId).get(); + + assertThat(result).usingRecursiveComparison() + .ignoringFields("id", "createdAt") + .isEqualTo(new Comment(savedRecipe, savedMember, request.getComment())); + } + } + + @Nested + class writeCommentOfRecipe_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @Test + void ์กด์žฌํ•˜์ง€_์•Š์€_๋ฉค๋ฒ„๊ฐ€_๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_์ž‘์„ฑํ•˜๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3); + final var author = new Member("author", "image.png", "1"); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + final var authorId = author.getId(); + + final var images = ์—ฌ๋Ÿฌ_์ด๋ฏธ์ง€_์ƒ์„ฑ(3); + + final var productIds = List.of(product1.getId(), product2.getId(), product3.getId()); + final var recipeCreateRequest = new RecipeCreateRequest("์ œ์ผ๋กœ ๋ง›์žˆ๋Š” ๋ ˆ์‹œํ”ผ", productIds, + "์šฐ์„  ๋ฐฅ์„ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์œผ๋ฉด.. ๋!!"); + + final var notExistMemberId = 999999999L; + final var savedRecipeId = recipeService.create(authorId, images, recipeCreateRequest); + final var request = new RecipeCommentCreateRequest("๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์ด์—์š”"); + + // when then + assertThatThrownBy(() -> recipeService.writeCommentOfRecipe(notExistMemberId, savedRecipeId, request)) + .isInstanceOf(MemberNotFoundException.class); + } + + @Test + void ์กด์žฌํ•˜์ง€_์•Š์€_๊ฟ€์กฐํ•ฉ์—_๋Œ“๊ธ€์„_์ž‘์„ฑํ•˜๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ()); + final var request = new RecipeCommentCreateRequest("๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์ด์—์š”"); + final var notExistRecipeId = 999999999L; + + // when then + assertThatThrownBy(() -> recipeService.writeCommentOfRecipe(memberId, notExistRecipeId, request)) + .isInstanceOf(RecipeNotFoundException.class); + } + } + + @Nested + class getCommentsOfRecipe_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๊ฟ€์กฐํ•ฉ์—_๋‹ฌ๋ฆฐ_๋Œ“๊ธ€๋“ค์„_์ปค์„œํŽ˜์ด์ง•์„_ํ†ตํ•ด_์กฐํšŒํ• _์ˆ˜_์žˆ๋‹ค_์ด_๋Œ“๊ธ€_15๊ฐœ_์ค‘_์ฒซํŽ˜์ด์ง€_๋Œ“๊ธ€_10๊ฐœ์กฐํšŒ() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3); + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + final var authorId = author.getId(); + + final var images = ์—ฌ๋Ÿฌ_์ด๋ฏธ์ง€_์ƒ์„ฑ(3); + + final var productIds = List.of(product1.getId(), product2.getId(), product3.getId()); + final var recipeCreateRequest = new RecipeCreateRequest("์ œ์ผ๋กœ ๋ง›์žˆ๋Š” ๋ ˆ์‹œํ”ผ", productIds, + "์šฐ์„  ๋ฐฅ์„ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์œผ๋ฉด.. ๋!!"); + + final var savedMemberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ()); + final var savedRecipeId = recipeService.create(authorId, images, recipeCreateRequest); + + for (int i = 1; i <= 15; i++) { + final var request = new RecipeCommentCreateRequest("๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์ด์—์š”" + i); + recipeService.writeCommentOfRecipe(savedMemberId, savedRecipeId, request); + } + + // when + final var result = recipeService.getCommentsOfRecipe(savedRecipeId, + new RecipeCommentCondition(null, null)); + + // + final var savedRecipe = recipeRepository.findById(savedRecipeId).get(); + final var savedMember = memberRepository.findById(savedMemberId).get(); + + final var expectedCommentResponses = new ArrayList<>(); + for (int i = 0; i < result.getComments().size(); i++) { + expectedCommentResponses.add(RecipeCommentResponse.toResponse( + new Comment(savedRecipe, savedMember, "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์ด์—์š”" + (15 - i)))); + } + + assertThat(result.getHasNext()).isTrue(); + assertThat(result.getTotalElements()).isEqualTo(15); + assertThat(result.getComments()).hasSize(10); + assertThat(result.getComments()).usingRecursiveComparison() + .ignoringFields("id", "createdAt") + .isEqualTo(expectedCommentResponses); + } + + @Test + void ๊ฟ€์กฐํ•ฉ์—_๋‹ฌ๋ฆฐ_๋Œ“๊ธ€๋“ค์„_์ปค์„œํŽ˜์ด์ง•์„_ํ†ตํ•ด_์กฐํšŒํ• _์ˆ˜_์žˆ๋‹ค_์ด_๋Œ“๊ธ€_15๊ฐœ_์ค‘_๋งˆ์ง€๋ง‰ํŽ˜์ด์ง€_๋Œ“๊ธ€_5๊ฐœ์กฐํšŒ() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + final var product3 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3); + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + final var authorId = author.getId(); + + final var images = ์—ฌ๋Ÿฌ_์ด๋ฏธ์ง€_์ƒ์„ฑ(3); + + final var productIds = List.of(product1.getId(), product2.getId(), product3.getId()); + final var recipeCreateRequest = new RecipeCreateRequest("์ œ์ผ๋กœ ๋ง›์žˆ๋Š” ๋ ˆ์‹œํ”ผ", productIds, + "์šฐ์„  ๋ฐฅ์„ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์–ด์š”. ๊ทธ๋ฆฌ๊ณ  ๋ฐฅ์„ ๋˜ ๋„ฃ์œผ๋ฉด.. ๋!!"); + + final var savedMemberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ()); + final var savedRecipeId = recipeService.create(authorId, images, recipeCreateRequest); + + for (int i = 1; i <= 15; i++) { + final var request = new RecipeCommentCreateRequest("๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์ด์—์š”" + i); + recipeService.writeCommentOfRecipe(savedMemberId, savedRecipeId, request); + } + + // when + final var result = recipeService.getCommentsOfRecipe(savedRecipeId, + new RecipeCommentCondition(6L, 15L)); + + // + final var savedRecipe = recipeRepository.findById(savedRecipeId).get(); + final var savedMember = memberRepository.findById(savedMemberId).get(); + + final var expectedCommentResponses = new ArrayList<>(); + for (int i = 0; i < result.getComments().size(); i++) { + expectedCommentResponses.add(RecipeCommentResponse.toResponse( + new Comment(savedRecipe, savedMember, "๊ฟ€์กฐํ•ฉ ๋Œ“๊ธ€์ด์—์š”" + (5 - i)))); + } + + assertThat(result.getHasNext()).isFalse(); + assertThat(result.getTotalElements()).isEqualTo(15); + assertThat(result.getComments()).hasSize(5); + assertThat(result.getComments()).usingRecursiveComparison() + .ignoringFields("id", "createdAt") + .isEqualTo(expectedCommentResponses); + } + } + private void ํ•ด๋‹น๋ฉค๋ฒ„์˜_๊ฟ€์กฐํ•ฉ๊ณผ_ํŽ˜์ด์ง•_๊ฒฐ๊ณผ๋ฅผ_๊ฒ€์ฆํ•œ๋‹ค(final MemberRecipesResponse actual, final List expectedRecipesDtos, final PageDto expectedPage) { assertSoftly(soft -> { diff --git a/backend/src/test/java/com/funeat/recipe/domain/RecipeTest.java b/backend/src/test/java/com/funeat/recipe/domain/RecipeTest.java new file mode 100644 index 000000000..7a0d28030 --- /dev/null +++ b/backend/src/test/java/com/funeat/recipe/domain/RecipeTest.java @@ -0,0 +1,36 @@ +package com.funeat.recipe.domain; + +import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ; +import static com.funeat.fixture.RecipeFixture.๋ ˆ์‹œํ”ผ_์ƒ์„ฑ; +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.LocalDateTime; +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("NonAsciiCharacters") +@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +class RecipeTest { + + @Nested + class calculateRankingScore_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๊ฟ€์กฐํ•ฉ_์ข‹์•„์š”_์ˆ˜์™€_๊ฟ€์กฐํ•ฉ_์ƒ์„ฑ_์‹œ๊ฐ„์œผ๋กœ_ํ•ด๋‹น_๊ฟ€์กฐํ•ฉ์˜_๋žญํ‚น_์ ์ˆ˜๋ฅผ_๊ตฌํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var favoriteCount = 4L; + final var recipe = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, favoriteCount, LocalDateTime.now().minusDays(1L)); + + final var expected = favoriteCount / Math.pow(2.0, 0.1); + + // when + final var actual = recipe.calculateRankingScore(); + + // then + assertThat(actual).isEqualTo(expected); + } + } +} diff --git a/backend/src/test/java/com/funeat/recipe/persistence/RecipeRepositoryTest.java b/backend/src/test/java/com/funeat/recipe/persistence/RecipeRepositoryTest.java index c7130d2ce..9c53177db 100644 --- a/backend/src/test/java/com/funeat/recipe/persistence/RecipeRepositoryTest.java +++ b/backend/src/test/java/com/funeat/recipe/persistence/RecipeRepositoryTest.java @@ -21,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; import com.funeat.common.RepositoryTest; +import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -119,7 +120,7 @@ class findAllRecipes_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } @Test - void ๊ฟ€์กฐํ•ฉ์„_์ตœ์‹ ์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() { + void ๊ฟ€์กฐํ•ฉ์„_์ตœ์‹ ์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() throws InterruptedException { // given final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); @@ -135,7 +136,9 @@ class findAllRecipes_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2, product3); final var recipe1_1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member1, 1L); + Thread.sleep(100); final var recipe1_2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member1, 3L); + Thread.sleep(100); final var recipe1_3 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member1, 2L); ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1_1, recipe1_2, recipe1_3); @@ -257,25 +260,44 @@ class findRecipesByProduct_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } @Nested - class findRecipesByOrderByFavoriteCountDesc_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + class findRecipesByFavoriteCountGreaterThanEqual_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ์ข‹์•„์š”์ˆœ์œผ๋กœ_์ƒ์œ„_3๊ฐœ์˜_๋ ˆ์‹œํ”ผ๋“ค์„_์กฐํšŒํ•œ๋‹ค() { + void ํŠน์ •_์ข‹์•„์š”_์ˆ˜_์ด์ƒ์ธ_๋ชจ๋“ _๊ฟ€์กฐํ•ฉ๋“ค์„_์กฐํšŒํ•œ๋‹ค() { // given final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); - final var recipe1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 1L); - final var recipe2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 2L); - final var recipe3 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 3L); - final var recipe4 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 4L); + final var recipe1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 0L); + final var recipe2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 1L); + final var recipe3 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 10L); + final var recipe4 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 100L); ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1, recipe2, recipe3, recipe4); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_๊ธฐ๋ณธ_์ƒ์„ฑ(0, 3); - final var expected = List.of(recipe4, recipe3, recipe2); + final var expected = List.of(recipe2, recipe3, recipe4); + + // when + final var actual = recipeRepository.findRecipesByFavoriteCountGreaterThanEqual(1L); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ํŠน์ •_์ข‹์•„์š”_์ˆ˜_์ด์ƒ์ธ_๊ฟ€์กฐํ•ฉ์ด_์—†์œผ๋ฉด_๋นˆ_๋ฆฌ์ŠคํŠธ๋ฅผ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var recipe1 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 0L); + final var recipe2 = ๋ ˆ์‹œํ”ผ_์ƒ์„ฑ(member, 0L); + ๋ณต์ˆ˜_๊ฟ€์กฐํ•ฉ_์ €์žฅ(recipe1, recipe2); + + final var expected = Collections.emptyList(); // when - final var actual = recipeRepository.findRecipesByOrderByFavoriteCountDesc(page); + final var actual = recipeRepository.findRecipesByFavoriteCountGreaterThanEqual(1L); // then assertThat(actual).usingRecursiveComparison() diff --git a/backend/src/test/java/com/funeat/review/application/ReviewDeleteEventListenerTest.java b/backend/src/test/java/com/funeat/review/application/ReviewDeleteEventListenerTest.java new file mode 100644 index 000000000..1349eaa37 --- /dev/null +++ b/backend/src/test/java/com/funeat/review/application/ReviewDeleteEventListenerTest.java @@ -0,0 +1,110 @@ +package com.funeat.review.application; + +import static com.funeat.fixture.CategoryFixture.์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ; +import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ; +import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ; +import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doThrow; + +import com.funeat.common.EventTest; +import com.funeat.common.ImageUploader; +import com.funeat.common.exception.CommonException.S3DeleteFailException; +import com.funeat.exception.CommonErrorCode; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.mock.mockito.MockBean; + +@SuppressWarnings("NonAsciiCharacters") +class ReviewDeleteEventListenerTest extends EventTest { + + @MockBean + private ImageUploader uploader; + + @Nested + class ๋ฆฌ๋ทฐ_์‚ญ์ œ_์ด๋ฒคํŠธ_๋ฐœํ–‰ { + + @Test + void ๋ฆฌ๋ทฐ_์ž‘์„ฑ์ž๊ฐ€_๋ฆฌ๋ทฐ_์‚ญ์ œ_์‹œ๋„์‹œ_๋ฆฌ๋ทฐ_์‚ญ์ œ_์ด๋ฒคํŠธ๊ฐ€_๋ฐœํ–‰๋œ๋‹ค() { + // given + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var authorId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review = reviewRepository.save(๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(author, product, 0L)); + + // when + reviewService.deleteReview(review.getId(), authorId); + + // then + final var count = events.stream(ReviewDeleteEvent.class).count(); + assertThat(count).isEqualTo(1); + } + + @Test + void ๋ฆฌ๋ทฐ_์ž‘์„ฑ์ž๊ฐ€_์•„๋‹Œ_์‚ฌ๋žŒ์ด_๋ฆฌ๋ทฐ_์‚ญ์ œ_์‹œ๋„์‹œ_๋ฆฌ๋ทฐ_์‚ญ์ œ_์ด๋ฒคํŠธ๊ฐ€_๋ฐœํ–‰๋˜์ง€_์•Š๋Š”๋‹ค() { + // given + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var authorId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review = reviewRepository.save(๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(author, product, 0L)); + + // when + try { + reviewService.deleteReview(review.getId(), memberId); + } catch (Exception ignored) { + } + + // then + final var count = events.stream(ReviewDeleteEvent.class).count(); + assertThat(count).isEqualTo(0); + } + } + + @Nested + class ์ด๋ฏธ์ง€_์‚ญ์ œ_๋กœ์ง_์ž‘๋™ { + + @Test + void ์ด๋ฏธ์ง€_์‚ญ์ œ_๋กœ์ง์ด_์‹คํŒจํ•ด๋„_๋ฉ”์ธ๋กœ์ง๊นŒ์ง€_๋กค๋ฐฑ๋˜์–ด์„œ๋Š”_์•ˆ๋œ๋‹ค() { + // given + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var authorId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review = reviewRepository.save(๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(author, product, 0L)); + + doThrow(new S3DeleteFailException(CommonErrorCode.UNKNOWN_SERVER_ERROR_CODE)) + .when(uploader) + .delete(any()); + + // when + reviewService.deleteReview(review.getId(), authorId); + + // then + assertThat(reviewRepository.findById(review.getId())).isEmpty(); + } + } +} 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 aa2a0b33e..93fd0e046 100644 --- a/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java +++ b/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java @@ -1,18 +1,15 @@ package com.funeat.review.application; +import static com.funeat.fixture.CategoryFixture.์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ; 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_์ƒ์„ฑ; -import static com.funeat.fixture.PageFixture.์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ; import static com.funeat.fixture.PageFixture.์ตœ์‹ ์ˆœ; -import static com.funeat.fixture.PageFixture.ํŽ˜์ด์ง€์š”์ฒญ_๊ธฐ๋ณธ_์ƒ์„ฑ; import static com.funeat.fixture.PageFixture.ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ; -import static com.funeat.fixture.PageFixture.ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ; -import static com.funeat.fixture.PageFixture.ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ; +import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 1์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ; @@ -23,7 +20,12 @@ import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€์—†์Œ_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_์ตœ์‹ ์ˆœ_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ข‹์•„์š”์š”์ฒญ_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; import static com.funeat.fixture.TagFixture.ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ; @@ -38,10 +40,18 @@ 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.MostFavoriteReviewResponse; +import com.funeat.review.dto.RankingReviewDto; +import com.funeat.review.dto.RankingReviewsResponse; +import com.funeat.review.dto.ReviewDetailResponse; import com.funeat.review.dto.SortingReviewDto; +import com.funeat.review.exception.ReviewException.NotAuthorOfReviewException; import com.funeat.review.exception.ReviewException.ReviewNotFoundException; import com.funeat.tag.domain.Tag; +import java.time.LocalDateTime; +import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; import org.junit.jupiter.api.Nested; @@ -338,44 +348,36 @@ class sortingReviews_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test void ์ข‹์•„์š”_๊ธฐ์ค€์œผ๋กœ_๋‚ด๋ฆผ์ฐจ์ˆœ_์ •๋ ฌ์„_ํ• _์ˆ˜_์žˆ๋‹ค() { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 351L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product, 24L); - final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product, 130L); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 24L); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 130L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 2, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ); - final var member1Id = member1.getId(); + final var request = ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(0L); - final var expected = Stream.of(review1, review3) - .map(review -> SortingReviewDto.toDto(review, member1)) - .collect(Collectors.toList()); + final var expected = List.of(review1.getId(), review3.getId(), review2.getId()); // when - final var actual = reviewService.sortingReviews(productId, page, member1Id).getReviews(); + final var actual = reviewService.sortingReviews(productId, memberId, request).getReviews(); // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); + assertThat(actual).extracting(SortingReviewDto::getId) + .containsExactlyElementsOf(expected); } @Test - void ํ‰์ _๊ธฐ์ค€์œผ๋กœ_์˜ค๋ฆ„์ฐจ์ˆœ_์ •๋ ฌ์„_ํ• _์ˆ˜_์žˆ๋‹ค() { + void ์ตœ์‹ ์ˆœ์œผ๋กœ_์ •๋ ฌ์„_ํ• _์ˆ˜_์žˆ๋‹ค() throws InterruptedException { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); @@ -383,33 +385,30 @@ class sortingReviews_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 351L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product, 24L); - final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product, 130L); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + Thread.sleep(100); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 24L); + Thread.sleep(100); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 130L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 2, ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ); - final var member1Id = member1.getId(); + final var request = ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_์ตœ์‹ ์ˆœ_์ƒ์„ฑ(3L); - final var expected = Stream.of(review1, review3) - .map(review -> SortingReviewDto.toDto(review, member1)) - .collect(Collectors.toList()); + final var expected = List.of(review2.getId(), review1.getId()); // when - final var actual = reviewService.sortingReviews(productId, page, member1Id).getReviews(); + final var actual = reviewService.sortingReviews(productId, memberId, request).getReviews(); // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); + assertThat(actual).extracting(SortingReviewDto::getId) + .containsExactlyElementsOf(expected); } @Test - void ํ‰์ _๊ธฐ์ค€์œผ๋กœ_๋‚ด๋ฆผ์ฐจ์ˆœ_์ •๋ ฌ์„_ํ• _์ˆ˜_์žˆ๋‹ค() { + void ํ‰์ _๊ธฐ์ค€์œผ๋กœ_์˜ค๋ฆ„์ฐจ์ˆœ_์ •๋ ฌ์„_ํ• _์ˆ˜_์žˆ๋‹ค() { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); @@ -417,33 +416,28 @@ class sortingReviews_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 351L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product, 24L); - final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product, 130L); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 24L); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 130L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 2, ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ); - final var member1Id = member1.getId(); + final var request = ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _์˜ค๋ฆ„์ฐจ์ˆœ_์ƒ์„ฑ(0L); - final var expected = Stream.of(review2, review3) - .map(review -> SortingReviewDto.toDto(review, member1)) - .collect(Collectors.toList()); + final var expected = List.of(review1.getId(), review3.getId(), review2.getId()); // when - final var actual = reviewService.sortingReviews(productId, page, member1Id).getReviews(); + final var actual = reviewService.sortingReviews(productId, memberId, request).getReviews(); // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); + assertThat(actual).extracting(SortingReviewDto::getId) + .containsExactlyElementsOf(expected); } @Test - void ์ตœ์‹ ์ˆœ์œผ๋กœ_์ •๋ ฌ์„_ํ• _์ˆ˜_์žˆ๋‹ค() { + void ํ‰์ _๊ธฐ์ค€์œผ๋กœ_๋‚ด๋ฆผ์ฐจ์ˆœ_์ •๋ ฌ์„_ํ• _์ˆ˜_์žˆ๋‹ค() { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); @@ -451,24 +445,21 @@ class sortingReviews_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 351L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product, 24L); - final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product, 130L); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 5L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 24L); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 13L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 2, ์ตœ์‹ ์ˆœ); - final var member1Id = member1.getId(); + final var request = ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(1L); - final var expected = Stream.of(review3, review2) - .map(review -> SortingReviewDto.toDto(review, member1)) - .collect(Collectors.toList()); + final var expected = List.of(review3.getId(), review2.getId()); // when - final var actual = reviewService.sortingReviews(productId, page, member1Id).getReviews(); + final var actual = reviewService.sortingReviews(productId, memberId, request).getReviews(); // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); + assertThat(actual).extracting(SortingReviewDto::getId) + .containsExactlyElementsOf(expected); } } @@ -478,10 +469,8 @@ class sortingReviews_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @Test void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฉค๋ฒ„๊ฐ€_์ƒํ’ˆ์—_์žˆ๋Š”_๋ฆฌ๋ทฐ๋“ค์„_์ •๋ ฌํ•˜๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var wrongMemberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member) + 3L; final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); @@ -489,26 +478,23 @@ class sortingReviews_์‹คํŒจ_ํ…Œ์ŠคํŠธ { final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 351L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product, 24L); - final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product, 130L); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 24L); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 130L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_๊ธฐ๋ณธ_์ƒ์„ฑ(0, 2); - final var wrongMemberId = member1.getId() + 3L; + final var request = ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(1L); // when & then - assertThatThrownBy(() -> reviewService.sortingReviews(productId, page, wrongMemberId)) + assertThatThrownBy(() -> reviewService.sortingReviews(productId, wrongMemberId, request)) .isInstanceOf(MemberNotFoundException.class); } @Test void ๋ฉค๋ฒ„๊ฐ€_์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ์—_์žˆ๋Š”_๋ฆฌ๋ทฐ๋“ค์„_์ •๋ ฌํ•˜๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); @@ -516,16 +502,15 @@ class sortingReviews_์‹คํŒจ_ํ…Œ์ŠคํŠธ { final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); final var wrongProductId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product) + 1L; - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 351L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product, 24L); - final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product, 130L); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 24L); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 130L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); - final var page = ํŽ˜์ด์ง€์š”์ฒญ_๊ธฐ๋ณธ_์ƒ์„ฑ(0, 2); - final var member1Id = member1.getId(); + final var request = ๋ฆฌ๋ทฐ์ •๋ ฌ์š”์ฒญ_ํ‰์ _๋‚ด๋ฆผ์ฐจ์ˆœ_์ƒ์„ฑ(1L); // when & then - assertThatThrownBy(() -> reviewService.sortingReviews(wrongProductId, page, member1Id)) + assertThatThrownBy(() -> reviewService.sortingReviews(wrongProductId, memberId, request)) .isInstanceOf(ProductNotFoundException.class); } } @@ -612,7 +597,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var expected = review.getImage(); // when - reviewService.updateProductImage(reviewId); + reviewService.updateProductImage(product.getId()); final var actual = product.getImage(); // then @@ -641,7 +626,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var expected = secondReview.getImage(); // when - reviewService.updateProductImage(secondReviewId); + reviewService.updateProductImage(product.getId()); final var actual = product.getImage(); // then @@ -670,7 +655,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var expected = firstReview.getImage(); // when - reviewService.updateProductImage(secondReviewId); + reviewService.updateProductImage(product.getId()); final var actual = product.getImage(); // then @@ -699,7 +684,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var expected = secondReview.getImage(); // when - reviewService.updateProductImage(secondReviewId); + reviewService.updateProductImage(product.getId()); final var actual = product.getImage(); // then @@ -720,11 +705,11 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var firstReview = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€์—†์Œ_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 3L); final var firstReviewId = ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(firstReview); - reviewService.updateProductImage(firstReviewId); + reviewService.updateProductImage(product.getId()); final var secondReview = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€์—†์Œ_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 2L); final var secondReviewId = ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(secondReview); - reviewService.updateProductImage(secondReviewId); + reviewService.updateProductImage(product.getId()); final var thirdReview = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 1L); final var thirdReviewId = ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(thirdReview); @@ -732,7 +717,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var expected = thirdReview.getImage(); // when - reviewService.updateProductImage(thirdReviewId); + reviewService.updateProductImage(product.getId()); final var actual = product.getImage(); // then @@ -753,7 +738,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var firstReview = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€์—†์Œ_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 3L); final var firstReviewId = ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(firstReview); - reviewService.updateProductImage(firstReviewId); + reviewService.updateProductImage(product.getId()); final var secondReview = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€์—†์Œ_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 2L); final var secondReviewId = ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(secondReview); @@ -761,7 +746,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { final var expected = secondReview.getImage(); // when - reviewService.updateProductImage(secondReviewId); + reviewService.updateProductImage(product.getId()); final var actual = product.getImage(); // then @@ -773,7 +758,7 @@ class updateProductImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { class updateProductImage_์‹คํŒจ_ํ…Œ์ŠคํŠธ { @Test - void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฆฌ๋ทฐ๋กœ_์ƒํ’ˆ_์—…๋ฐ์ดํŠธ๋ฅผ_์‹œ๋„ํ•˜๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ์œผ๋กœ_์ƒํ’ˆ_์—…๋ฐ์ดํŠธ๋ฅผ_์‹œ๋„ํ•˜๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { // given final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); @@ -784,14 +769,452 @@ class updateProductImage_์‹คํŒจ_ํ…Œ์ŠคํŠธ { final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var review = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); - final var wrongReviewId = ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(review) + 1L; + final var wrongProductId = 999L; + + // when & then + assertThatThrownBy(() -> reviewService.updateProductImage(wrongProductId)) + .isInstanceOf(ProductNotFoundException.class); + } + } + + @Nested + class deleteReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ์ž์‹ ์ด_์ž‘์„ฑํ•œ_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var authorId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var tag1 = ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ(); + final var tag2 = ํƒœ๊ทธ_์•„์นจ์‹์‚ฌ_ETC_์ƒ์„ฑ(); + ๋ณต์ˆ˜_ํƒœ๊ทธ_์ €์žฅ(tag1, tag2); + + final var tagIds = ํƒœ๊ทธ_์•„์ด๋””_๋ณ€ํ™˜(tag1, tag2); + final var image = ์ด๋ฏธ์ง€_์ƒ์„ฑ(); + final var reviewCreateRequest1 = ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(2L, tagIds); + final var reviewCreateRequest2 = ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(4L, tagIds); + + reviewService.create(productId, authorId, image, reviewCreateRequest1); + reviewService.create(productId, authorId, image, reviewCreateRequest2); + + final var reviews = reviewRepository.findAll(); + final var rating2_review = reviews.stream() + .filter(it -> it.getRating() == 2L) + .findFirst() + .get(); + + final var favoriteRequest = ๋ฆฌ๋ทฐ์ข‹์•„์š”์š”์ฒญ_์ƒ์„ฑ(true); + reviewService.likeReview(rating2_review.getId(), authorId, favoriteRequest); + reviewService.likeReview(rating2_review.getId(), memberId, favoriteRequest); + + // when + reviewService.deleteReview(rating2_review.getId(), authorId); + + // then + final var tags = reviewTagRepository.findByReview(rating2_review); + final var favorites = reviewFavoriteRepository.findByReview(rating2_review); + final var findReview = reviewRepository.findById(rating2_review.getId()); + final var findProduct = productRepository.findById(productId).get(); + + assertSoftly(soft -> { + soft.assertThat(tags).isEmpty(); + soft.assertThat(favorites).isEmpty(); + soft.assertThat(findReview).isEmpty(); + soft.assertThat(findProduct.getAverageRating()).isEqualTo(4.0); + soft.assertThat(findProduct.getReviewCount()).isEqualTo(1); + }); + } + } + + @Nested + class deleteReview_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @Test + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_์‚ฌ์šฉ์ž๊ฐ€_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ•˜๋ คํ•˜๋ฉด_์—๋Ÿฌ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var authorId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var tag1 = ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ(); + final var tag2 = ํƒœ๊ทธ_์•„์นจ์‹์‚ฌ_ETC_์ƒ์„ฑ(); + ๋ณต์ˆ˜_ํƒœ๊ทธ_์ €์žฅ(tag1, tag2); + + final var tagIds = ํƒœ๊ทธ_์•„์ด๋””_๋ณ€ํ™˜(tag1, tag2); + final var image = ์ด๋ฏธ์ง€_์ƒ์„ฑ(); + final var reviewCreateRequest = ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(4L, tagIds); + reviewService.create(productId, authorId, image, reviewCreateRequest); + + final var review = reviewRepository.findAll().get(0); + final var reviewId = review.getId(); + + final var wrongMemberId = 999L; + + // when & then + assertThatThrownBy(() -> reviewService.deleteReview(reviewId, wrongMemberId)) + .isInstanceOf(MemberNotFoundException.class); + } + + @Test + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ•˜๋ คํ•˜๋ฉด_์—๋Ÿฌ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var authorId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var tag1 = ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ(); + final var tag2 = ํƒœ๊ทธ_์•„์นจ์‹์‚ฌ_ETC_์ƒ์„ฑ(); + ๋ณต์ˆ˜_ํƒœ๊ทธ_์ €์žฅ(tag1, tag2); + + final var tagIds = ํƒœ๊ทธ_์•„์ด๋””_๋ณ€ํ™˜(tag1, tag2); + final var image = ์ด๋ฏธ์ง€_์ƒ์„ฑ(); + final var reviewCreateRequest = ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(4L, tagIds); + reviewService.create(productId, authorId, image, reviewCreateRequest); + + final var wrongReviewId = 999L; + + // when & then + assertThatThrownBy(() -> reviewService.deleteReview(wrongReviewId, authorId)) + .isInstanceOf(ReviewNotFoundException.class); + } + + @Test + void ์ž์‹ ์ด_์ž‘์„ฑํ•˜์ง€_์•Š์€_๋ฆฌ๋ทฐ๋ฅผ_์‚ญ์ œํ•˜๋ คํ•˜๋ฉด_์—๋Ÿฌ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var author = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var authorId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(author); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); + final var memberId = ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var tag1 = ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ(); + final var tag2 = ํƒœ๊ทธ_์•„์นจ์‹์‚ฌ_ETC_์ƒ์„ฑ(); + ๋ณต์ˆ˜_ํƒœ๊ทธ_์ €์žฅ(tag1, tag2); + + final var tagIds = ํƒœ๊ทธ_์•„์ด๋””_๋ณ€ํ™˜(tag1, tag2); + final var image = ์ด๋ฏธ์ง€_์ƒ์„ฑ(); + final var reviewCreateRequest = ๋ฆฌ๋ทฐ์ถ”๊ฐ€์š”์ฒญ_์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(4L, tagIds); + reviewService.create(productId, authorId, image, reviewCreateRequest); + + final var review = reviewRepository.findAll().get(0); + final var reviewId = review.getId(); // when & then - assertThatThrownBy(() -> reviewService.updateProductImage(wrongReviewId)) + assertThatThrownBy(() -> reviewService.deleteReview(reviewId, memberId)) + .isInstanceOf(NotAuthorOfReviewException.class); + } + } + + @Nested + class getMostFavoriteReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฆฌ๋ทฐ๊ฐ€_์—ฌ๋Ÿฌ๊ฐœ_์กด์žฌํ•˜๋ฉด_์ข‹์•„์š”๋ฅผ_๊ฐ€์žฅ_๋งŽ์ด_๋ฐ›์€_๋ฆฌ๋ทฐ๋ฅผ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 24L); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var expected = MostFavoriteReviewResponse.toResponse(Optional.of(review1)); + + // when + final var actual = reviewService.getMostFavoriteReview(productId); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ์ข‹์•„์š”_์ˆ˜๊ฐ€_๊ฐ™์€_๋ฆฌ๋ทฐ๊ฐ€_์—ฌ๋Ÿฌ๊ฐœ_์กด์žฌํ•˜๋ฉด_๊ฐ€์žฅ_์ตœ๊ทผ_์ž‘์„ฑ๋œ_๋ฆฌ๋ทฐ๋ฅผ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 351L); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var expected = MostFavoriteReviewResponse.toResponse(Optional.of(review2)); + + // when + final var actual = reviewService.getMostFavoriteReview(productId); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ๋ฆฌ๋ทฐ๊ฐ€_์กด์žฌํ•˜์ง€_์•Š์œผ๋ฉด_Optional_empty๋ฅผ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var expected = Optional.empty(); + + // when + final var actual = reviewService.getMostFavoriteReview(productId); + + // then + assertThat(actual).isEqualTo(expected); + } + } + + @Nested + class getMostFavoriteReview_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @Test + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_์ƒํ’ˆ์—_๊ฐ€์žฅ_๋งŽ์€_์ข‹์•„์š”๋ฅผ_๋ฐ›์€_๋ฆฌ๋ทฐ๋ฅผ_์ฐพ์œผ๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var wrongProductId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product) + 1L; + + // when & then + assertThatThrownBy(() -> reviewService.getMostFavoriteReview(wrongProductId)) + .isInstanceOf(ProductNotFoundException.class); + } + } + + @Nested + class getReviewDetail_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฆฌ๋ทฐ_์ƒ์„ธ_์ •๋ณด๋ฅผ_์กฐํšŒํ•œ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 5์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test2_ํ‰์ 2์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 0L); + ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(review); + + // when + final var actual = reviewService.getReviewDetail(review.getId()); + + // then + final var expected = ReviewDetailResponse.toResponse(review); + + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + } + + @Nested + class getReviewDetail_์‹คํŒจ_ํ…Œ์ŠคํŠธ { + + @Test + void ์กด์žฌํ•˜์ง€_์•Š๋Š”_๋ฆฌ๋ทฐ๋ฅผ_์กฐํšŒํ• ๋•Œ_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค() { + // given + final var notExistReviewId = 999999L; + + // when & then + assertThatThrownBy(() -> reviewService.getReviewDetail(notExistReviewId)) .isInstanceOf(ReviewNotFoundException.class); } } + + @Nested + class getTopReviews_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Nested + class ๋ฆฌ๋ทฐ_๊ฐœ์ˆ˜์—_๋Œ€ํ•œ_ํ…Œ์ŠคํŠธ { + + @Test + void ์ „์ฒด_๋ฆฌ๋ทฐ๊ฐ€_ํ•˜๋‚˜๋„_์—†์–ด๋„_๋ฐ˜ํ™˜๊ฐ’์€_์žˆ์–ด์•ผํ•œ๋‹ค() { + // given + final var expected = RankingReviewsResponse.toResponse(Collections.emptyList()); + + // when + final var actual = reviewService.getTopReviews(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ์ „์ฒด_๋ฆฌ๋ทฐ๊ฐ€_1๊ฐœ_์ด์ƒ_3๊ฐœ_๋ฏธ๋งŒ์ด๋ผ๋„_๋ฆฌ๋ทฐ๊ฐ€_๋‚˜์™€์•ผํ•œ๋‹ค() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 2L, now.minusDays(1L)); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 2L, now); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var rankingReviewDto1 = RankingReviewDto.toDto(review1); + final var rankingReviewDto2 = RankingReviewDto.toDto(review2); + final var rankingReviewDtos = List.of(rankingReviewDto2, rankingReviewDto1); + final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos); + + // when + final var actual = reviewService.getTopReviews(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ์ „์ฒด_๋ฆฌ๋ทฐ_์ค‘_๋žญํ‚น์ด_๋†’์€_์ƒ์œ„_3๊ฐœ_๋ฆฌ๋ทฐ๋ฅผ_๊ตฌํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 4L, now.minusDays(3L)); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 6L, now.minusDays(2L)); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 4L, now); + final var review4 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 5L, now); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3, review4); + + final var rankingReviewDto1 = RankingReviewDto.toDto(review1); + final var rankingReviewDto2 = RankingReviewDto.toDto(review2); + final var rankingReviewDto3 = RankingReviewDto.toDto(review3); + final var rankingReviewDto4 = RankingReviewDto.toDto(review4); + final var rankingReviewDtos = List.of(rankingReviewDto4, rankingReviewDto3, rankingReviewDto2); + final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos); + + // when + final var actual = reviewService.getTopReviews(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + } + + @Nested + class ๋ฆฌ๋ทฐ_๋žญํ‚น_์ ์ˆ˜์—_๋Œ€ํ•œ_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฆฌ๋ทฐ_์ข‹์•„์š”_์ˆ˜๊ฐ€_๊ฐ™์œผ๋ฉด_์ตœ๊ทผ_์ƒ์„ฑ๋œ_๋ฆฌ๋ทฐ์˜_๋žญํ‚น์„_๋”_๋†’๊ฒŒ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 10L, now.minusDays(9L)); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 10L, now.minusDays(4L)); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var rankingReviewDto1 = RankingReviewDto.toDto(review1); + final var rankingReviewDto2 = RankingReviewDto.toDto(review2); + final var rankingReviewDtos = List.of(rankingReviewDto2, rankingReviewDto1); + final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos); + + // when + final var actual = reviewService.getTopReviews(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ๋ฆฌ๋ทฐ_์ƒ์„ฑ_์ผ์ž๊ฐ€_๊ฐ™์œผ๋ฉด_์ข‹์•„์š”_์ˆ˜๊ฐ€_๋งŽ์€_๋ฆฌ๋ทฐ์˜_๋žญํ‚น์„_๋”_๋†’๊ฒŒ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 4์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var now = LocalDateTime.now(); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 2L, now.minusDays(1L)); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 4L, now.minusDays(1L)); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var rankingReviewDto1 = RankingReviewDto.toDto(review1); + final var rankingReviewDto2 = RankingReviewDto.toDto(review2); + final var rankingReviewDtos = List.of(rankingReviewDto2, rankingReviewDto1); + final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos); + + // when + final var actual = reviewService.getTopReviews(); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + } + } private List ํƒœ๊ทธ_์•„์ด๋””_๋ณ€ํ™˜(final Tag... tags) { return Stream.of(tags) diff --git a/backend/src/test/java/com/funeat/review/domain/ReviewTest.java b/backend/src/test/java/com/funeat/review/domain/ReviewTest.java new file mode 100644 index 000000000..a9b02876b --- /dev/null +++ b/backend/src/test/java/com/funeat/review/domain/ReviewTest.java @@ -0,0 +1,40 @@ +package com.funeat.review.domain; + +import static com.funeat.fixture.CategoryFixture.์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ; +import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ; +import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ; +import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.LocalDateTime; +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("NonAsciiCharacters") +@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +class ReviewTest { + + @Nested + class calculateRankingScore_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ๋ฆฌ๋ทฐ_์ข‹์•„์š”_์ˆ˜์™€_๋ฆฌ๋ทฐ_์ƒ์„ฑ_์‹œ๊ฐ„์œผ๋กœ_ํ•ด๋‹น_๋ฆฌ๋ทฐ์˜_๋žญํ‚น_์ ์ˆ˜๋ฅผ_๊ตฌํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); + final var favoriteCount = 4L; + final var review = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, favoriteCount, LocalDateTime.now().minusDays(1L)); + + final var expected = favoriteCount / Math.pow(2.0, 0.5); + + // when + final var actual = review.calculateRankingScore(); + + // then + assertThat(actual).isEqualTo(expected); + } + } +} diff --git a/backend/src/test/java/com/funeat/review/persistence/ReviewRepositoryTest.java b/backend/src/test/java/com/funeat/review/persistence/ReviewRepositoryTest.java index c076fe6b6..46e4645f4 100644 --- a/backend/src/test/java/com/funeat/review/persistence/ReviewRepositoryTest.java +++ b/backend/src/test/java/com/funeat/review/persistence/ReviewRepositoryTest.java @@ -5,21 +5,18 @@ import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ; import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ; import static com.funeat.fixture.MemberFixture.๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ; -import static com.funeat.fixture.PageFixture.์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ; -import static com.funeat.fixture.PageFixture.ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ; import static com.funeat.fixture.ProductFixture.์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; -import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ; import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; -import static com.funeat.fixture.ReviewFixture.๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.SoftAssertions.assertSoftly; import com.funeat.common.RepositoryTest; +import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -67,145 +64,158 @@ class countByProduct_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } @Nested - class findReviewsByProduct_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + class findPopularReviewWithImage_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ํŠน์ •_์ƒํ’ˆ์—_๋Œ€ํ•œ_์ข‹์•„์š”_๊ธฐ์ค€_๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ_์ •๋ ฌํ•œ๋‹ค() { + void ๋ฆฌ๋ทฐ๊ฐ€_์กด์žฌํ•˜์ง€_์•Š์œผ๋ฉด_๋นˆ_๊ฐ’์„_๋ฐ˜ํ™˜ํ•˜๋‹ค() { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); - - final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); - ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product, 351L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product, 24L); - final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product, 130L); - ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); - - final var page = ํŽ˜์ด์ง€์š”์ฒญ_์ƒ์„ฑ(0, 2, ์ข‹์•„์š”์ˆ˜_๋‚ด๋ฆผ์ฐจ์ˆœ); + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var expected = List.of(review1, review3); + final var pageable = PageRequest.of(0, 1); // when - final var actual = reviewRepository.findReviewsByProduct(page, product).getContent(); + final var actual = reviewRepository.findPopularReviewWithImage(productId, pageable); // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); + assertThat(actual).isEmpty(); } - } - - @Nested - class findTop3ByOrderByFavoriteCountDesc_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ์ „์ฒด_๋ฆฌ๋ทฐ_๋ชฉ๋ก์—์„œ_๊ฐ€์žฅ_์ข‹์•„์š”๊ฐ€_๋†’์€_์ƒ์œ„_3๊ฐœ์˜_๋ฆฌ๋ทฐ๋ฅผ_๊ฐ€์ ธ์˜จ๋‹ค() { + void ๋ฆฌ๋ทฐ๊ฐ€_์กด์žฌํ•˜๋ฉด_์ข‹์•„์š”_์ˆ˜๊ฐ€_๋ช‡๊ฐœ์ด๋“ _๋ฆฌ๋ทฐ๋ฅผ_๋ฐ˜ํ™˜ํ•˜๋‹ค() { // given - final var member1 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); - final var member2 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„2_์ƒ์„ฑ(); - final var member3 = ๋ฉค๋ฒ„_๋ฉค๋ฒ„3_์ƒ์„ฑ(); - ๋ณต์ˆ˜_๋ฉค๋ฒ„_์ €์žฅ(member1, member2, member3); - - final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - final var product1 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); - final var product2 = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ2000์›_ํ‰์ 3์ _์ƒ์„ฑ(category); - ๋ณต์ˆ˜_์ƒํ’ˆ_์ €์žฅ(product1, product2); + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); - final var review1_1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member1, product1, 5L); - final var review1_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product1, 351L); - final var review1_3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product1, 130L); - final var review2_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member2, product2, 247L); - final var review3_2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member3, product2, 83L); - ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1_1, review1_2, review1_3, review2_2, review3_2); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); - final var expected = List.of(review1_2, review2_2, review1_3); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 2L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 1L); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var pageable = PageRequest.of(0, 1); // when - final var actual = reviewRepository.findTop3ByOrderByFavoriteCountDesc(); + final var actual = reviewRepository.findPopularReviewWithImage(productId, pageable).get(0); // then - assertThat(actual).usingRecursiveComparison() - .isEqualTo(expected); + assertThat(actual).usingRecursiveComparison().isEqualTo(review1); } - } - - @Nested - class findTopByProductOrderByFavoriteCountDesc_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ๋ฆฌ๋ทฐ๊ฐ€_์กด์žฌํ•˜์ง€_์•Š์œผ๋ฉด_๋นˆ_๊ฐ’์„_๋ฐ˜ํ™˜ํ•˜๋‹ค() { + void ์ข‹์•„์š”_์ˆ˜๊ฐ€_๊ฐ™์œผ๋ฉด_์ตœ์‹ _๋ฆฌ๋ทฐ๋ฅผ_๋ฐ˜ํ™˜ํ•˜๋‹ค() { // given final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); - final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 1์ _์ƒ์„ฑ(category); + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + final var pageable = PageRequest.of(0, 1); // when - final var actual = reviewRepository.findPopularReviewWithImage(productId, pageable); + final var actual = reviewRepository.findPopularReviewWithImage(productId, pageable).get(0); // then - assertThat(actual).isEmpty(); + assertThat(actual).usingRecursiveComparison().isEqualTo(review2); } + } + + @Nested + class findTopByProductOrderByFavoriteCountDescIdDesc_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ๋ฆฌ๋ทฐ๊ฐ€_์กด์žฌํ•˜๋ฉด_์ข‹์•„์š”_์ˆ˜๊ฐ€_๋ช‡๊ฐœ์ด๋“ _๋ฆฌ๋ทฐ๋ฅผ_๋ฐ˜ํ™˜ํ•˜๋‹ค() { + void ์ข‹์•„์š”๊ฐ€_๊ฐ€์žฅ_๋งŽ์€_๋ฆฌ๋ทฐ๋ฅผ_๋ฐ˜ํ™˜ํ•˜๋‹ค() { // given final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); - final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 2L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 1L); + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 4L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); - final var pageable = PageRequest.of(0, 1); - // when - final var actual = reviewRepository.findPopularReviewWithImage(productId, pageable).get(0); + final var actual = reviewRepository.findTopByProductOrderByFavoriteCountDescIdDesc(product); // then - assertThat(actual).usingRecursiveComparison().isEqualTo(review1); + assertThat(actual.get()).isEqualTo(review2); } + } + + @Nested + class findReviewsByFavoriteCountGreaterThanEqual_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { @Test - void ์ข‹์•„์š”_์ˆ˜๊ฐ€_๊ฐ™์œผ๋ฉด_์ตœ์‹ _๋ฆฌ๋ทฐ๋ฅผ_๋ฐ˜ํ™˜ํ•˜๋‹ค() { + void ํŠน์ •_์ข‹์•„์š”_์ˆ˜_์ด์ƒ์ธ_๋ชจ๋“ _๋ฆฌ๋ทฐ๋“ค์„_์กฐํšŒํ•œ๋‹ค() { // given - final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); - final var productId = ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 1L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + final var review3 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 100L); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2, review3); + + final var expected = List.of(review1, review3); + // when + final var actual = reviewRepository.findReviewsByFavoriteCountGreaterThanEqual(1L); + + // then + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); + } + + @Test + void ํŠน์ •_์ข‹์•„์š”_์ˆ˜_์ด์ƒ์ธ_๋ฆฌ๋ทฐ๊ฐ€_์—†์œผ๋ฉด_๋นˆ_๋ฆฌ์ŠคํŠธ๋ฅผ_๋ฐ˜ํ™˜ํ•œ๋‹ค() { + // given final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); - final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test1_ํ‰์ 1์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); - final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_๊ฐ„ํŽธ์‹์‚ฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ1000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test4_ํ‰์ 4์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); - final var pageable = PageRequest.of(0, 1); + final var expected = Collections.emptyList(); // when - final var actual = reviewRepository.findPopularReviewWithImage(productId, pageable).get(0); + final var actual = reviewRepository.findReviewsByFavoriteCountGreaterThanEqual(1L); // then - assertThat(actual).usingRecursiveComparison().isEqualTo(review2); + assertThat(actual).usingRecursiveComparison() + .isEqualTo(expected); } } } diff --git a/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java b/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java index baab6abdb..4f5bbf152 100644 --- a/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java +++ b/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java @@ -72,6 +72,80 @@ class findTop3TagsByReviewIn_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { } } + @Nested + class deleteByReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ํ•ด๋‹น_๋ฆฌ๋ทฐ์—_๋‹ฌ๋ฆฐ_ํƒœ๊ทธ๋ฅผ_์‚ญ์ œํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var tag1 = ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ(); + ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(tag1); + + final var review1 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + final var review2 = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test3_ํ‰์ 3์ _์žฌ๊ตฌ๋งคX_์ƒ์„ฑ(member, product, 0L); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_์ €์žฅ(review1, review2); + + final var reviewTag1_1 = ๋ฆฌ๋ทฐ_ํƒœ๊ทธ_์ƒ์„ฑ(review1, tag1); + final var reviewTag2_1 = ๋ฆฌ๋ทฐ_ํƒœ๊ทธ_์ƒ์„ฑ(review2, tag1); + ๋ณต์ˆ˜_๋ฆฌ๋ทฐ_ํƒœ๊ทธ_์ €์žฅ(reviewTag1_1, reviewTag2_1); + + final var expected = List.of(reviewTag2_1); + + // when + reviewTagRepository.deleteByReview(review1); + + // then + final var remainings = reviewTagRepository.findAll(); + assertThat(remainings).usingRecursiveComparison() + .isEqualTo(expected); + } + } + + @Nested + class findByReview_์„ฑ๊ณต_ํ…Œ์ŠคํŠธ { + + @Test + void ํ•ด๋‹น_๋ฆฌ๋ทฐ์—_๋‹ฌ๋ฆฐ_ํƒœ๊ทธ๋ฅผ_ํ™•์ธํ• _์ˆ˜_์žˆ๋‹ค() { + // given + final var member = ๋ฉค๋ฒ„_๋ฉค๋ฒ„1_์ƒ์„ฑ(); + ๋‹จ์ผ_๋ฉค๋ฒ„_์ €์žฅ(member); + + final var category = ์นดํ…Œ๊ณ ๋ฆฌ_์ฆ‰์„์กฐ๋ฆฌ_์ƒ์„ฑ(); + ๋‹จ์ผ_์นดํ…Œ๊ณ ๋ฆฌ_์ €์žฅ(category); + + final var product = ์ƒํ’ˆ_์‚ผ๊ฐ๊น€๋ฐฅ_๊ฐ€๊ฒฉ3000์›_ํ‰์ 2์ _์ƒ์„ฑ(category); + ๋‹จ์ผ_์ƒํ’ˆ_์ €์žฅ(product); + + final var tag1 = ํƒœ๊ทธ_๋ง›์žˆ์–ด์š”_TASTE_์ƒ์„ฑ(); + ๋‹จ์ผ_ํƒœ๊ทธ_์ €์žฅ(tag1); + + final var review = ๋ฆฌ๋ทฐ_์ด๋ฏธ์ง€test5_ํ‰์ 5์ _์žฌ๊ตฌ๋งคO_์ƒ์„ฑ(member, product, 0L); + ๋‹จ์ผ_๋ฆฌ๋ทฐ_์ €์žฅ(review); + + final var reviewTag = ๋ฆฌ๋ทฐ_ํƒœ๊ทธ_์ƒ์„ฑ(review, tag1); + ๋‹จ์ผ_๋ฆฌ๋ทฐ_ํƒœ๊ทธ_์ €์žฅ(reviewTag); + + final var expected = List.of(reviewTag); + + // when + final var actual = reviewTagRepository.findByReview(review); + + // then + assertThat(actual).usingRecursiveComparison() + .ignoringExpectedNullFields() + .isEqualTo(expected); + } + } + private ReviewTag ๋ฆฌ๋ทฐ_ํƒœ๊ทธ_์ƒ์„ฑ(final Review review, final Tag tag) { return ReviewTag.createReviewTag(review, tag); } diff --git a/backend/src/test/resources/application.yml b/backend/src/test/resources/application.yml index b4dda6f4f..5d2dd0387 100644 --- a/backend/src/test/resources/application.yml +++ b/backend/src/test/resources/application.yml @@ -15,16 +15,13 @@ spring: format_sql: true show_sql: true + session: + store-type: none + logging: level: org.hibernate.type.descriptor.sql: trace -server: - servlet: - session: - cookie: - name: FUNEAT - cloud: aws: region: @@ -33,3 +30,16 @@ cloud: bucket: testBucket folder: testFolder cloudfrontPath: testCloudfrontPath + image: + food: foodimage + store: storeimage + +back-office: + id: test + key: test + +server: + servlet: + session: + cookie: + name: SESSION diff --git a/frontend/.storybook/preview-body.html b/frontend/.storybook/preview-body.html index 9ce666761..a37b26cbd 100644 --- a/frontend/.storybook/preview-body.html +++ b/frontend/.storybook/preview-body.html @@ -100,5 +100,30 @@ d="M3 4V1h2v3h3v2H5v3H3V6H0V4m6 6V7h3V4h7l1.8 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10m10 9c4.45 0 6.69-5.38 3.54-8.54C13.39 7.31 8 9.55 8 14c0 2.76 2.24 5 5 5m-3.2-5c0 2.85 3.45 4.28 5.46 2.26c2.02-2.01.59-5.46-2.26-5.46A3.21 3.21 0 0 0 9.8 14Z" /> + + + + + + + + + + + + + + +
+
+ diff --git a/frontend/package.json b/frontend/package.json index ddc1de60a..358f1fe4b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,9 +13,10 @@ "test:coverage": "jest --watchAll --coverage" }, "dependencies": { - "@fun-eat/design-system": "^0.3.12", + "@fun-eat/design-system": "^0.3.18", "@tanstack/react-query": "^4.32.6", "@tanstack/react-query-devtools": "^4.32.6", + "browser-image-compression": "^2.0.2", "dayjs": "^1.11.9", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/frontend/public/index.html b/frontend/public/index.html index bb66bebda..36782ea87 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -27,5 +27,7 @@
+
+
diff --git a/frontend/public/mockServiceWorker.js b/frontend/public/mockServiceWorker.js index d8bc3ace3..51d85eeeb 100644 --- a/frontend/public/mockServiceWorker.js +++ b/frontend/public/mockServiceWorker.js @@ -2,7 +2,7 @@ /* tslint:disable */ /** - * Mock Service Worker (1.3.0). + * Mock Service Worker (1.3.2). * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. diff --git a/frontend/src/apis/index.ts b/frontend/src/apis/index.ts index 73d9e4928..c258c1615 100644 --- a/frontend/src/apis/index.ts +++ b/frontend/src/apis/index.ts @@ -9,3 +9,5 @@ export const memberApi = new ApiClient('/members'); export const recipeApi = new ApiClient('/recipes'); export const searchApi = new ApiClient('/search'); export const logoutApi = new ApiClient('/logout'); +export const reviewApi = new ApiClient('/reviews'); +export const bannerApi = new ApiClient('/banners'); diff --git a/frontend/src/components/Common/Banner/Banner.tsx b/frontend/src/components/Common/Banner/Banner.tsx new file mode 100644 index 000000000..89af08c6c --- /dev/null +++ b/frontend/src/components/Common/Banner/Banner.tsx @@ -0,0 +1,26 @@ +import { Link } from '@fun-eat/design-system'; +import styled from 'styled-components'; + +import { useBannerQuery } from '@/hooks/queries/banner'; + +const Banner = () => { + const { data: banners } = useBannerQuery(); + const { link, image } = banners[Math.floor(Math.random() * banners.length)]; + + if (!link) { + return ; + } + + return ( + + + + ); +}; + +export default Banner; + +const BannerImage = styled.img` + width: 100%; + height: auto; +`; diff --git a/frontend/src/components/Common/Carousel/Carousel.tsx b/frontend/src/components/Common/Carousel/Carousel.tsx index 5f7c3ad23..038b5cefa 100644 --- a/frontend/src/components/Common/Carousel/Carousel.tsx +++ b/frontend/src/components/Common/Carousel/Carousel.tsx @@ -31,8 +31,11 @@ const Carousel = ({ carouselList }: CarouselProps) => { transition: currentIndex === length - 1 ? '' : 'all 0.5s ease-in-out', }} > - {extendedCarouselList.map(({ id, children }) => ( - + {extendedCarouselList.map(({ id, children }, index) => ( + {children} ))} diff --git a/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.stories.tsx b/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.stories.tsx index e597dc53c..25de7b811 100644 --- a/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.stories.tsx +++ b/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.stories.tsx @@ -2,9 +2,18 @@ import type { Meta, StoryObj } from '@storybook/react'; import CategoryFoodList from './CategoryFoodList'; +import CategoryProvider from '@/contexts/CategoryContext'; + const meta: Meta = { title: 'common/CategoryFoodList', component: CategoryFoodList, + decorators: [ + (Story) => ( + + + + ), + ], }; export default meta; diff --git a/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.tsx b/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.tsx index 46464b231..921584b8f 100644 --- a/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.tsx +++ b/frontend/src/components/Common/CategoryFoodList/CategoryFoodList.tsx @@ -1,42 +1,21 @@ -import { Link } from '@fun-eat/design-system'; -import { Link as RouterLink } from 'react-router-dom'; import styled from 'styled-components'; import CategoryItem from '../CategoryItem/CategoryItem'; import { CATEGORY_TYPE } from '@/constants'; -import { useGA } from '@/hooks/common'; import { useCategoryFoodQuery } from '@/hooks/queries/product'; -const category = CATEGORY_TYPE.FOOD; +const categoryType = CATEGORY_TYPE.FOOD; const CategoryFoodList = () => { - const { data: categories } = useCategoryFoodQuery(category); - const { gaEvent } = useGA(); - - const handleHomeCategoryLinkClick = (categoryName: string) => { - gaEvent({ - category: 'link', - action: `${categoryName} ์นดํ…Œ๊ณ ๋ฆฌ ๋งํฌ ํด๋ฆญ`, - label: '์นดํ…Œ๊ณ ๋ฆฌ', - }); - }; + const { data: categories } = useCategoryFoodQuery(categoryType); return ( -
- - {categories.map((menu) => ( - handleHomeCategoryLinkClick(menu.name)} - > - - - ))} - -
+ + {categories.map(({ id, name, image }) => ( + + ))} + ); }; diff --git a/frontend/src/components/Common/CategoryFoodTab/CategoryFoodTab.tsx b/frontend/src/components/Common/CategoryFoodTab/CategoryFoodTab.tsx index 6b6a734bc..56817526e 100644 --- a/frontend/src/components/Common/CategoryFoodTab/CategoryFoodTab.tsx +++ b/frontend/src/components/Common/CategoryFoodTab/CategoryFoodTab.tsx @@ -1,6 +1,4 @@ import { Button, theme } from '@fun-eat/design-system'; -import { useEffect } from 'react'; -import { useLocation } from 'react-router-dom'; import styled from 'styled-components'; import { CATEGORY_TYPE } from '@/constants'; @@ -9,29 +7,20 @@ import { useCategoryActionContext, useCategoryValueContext } from '@/hooks/conte import { useCategoryFoodQuery } from '@/hooks/queries/product/useCategoryQuery'; import { getTargetCategoryName } from '@/utils/category'; -const category = CATEGORY_TYPE.FOOD; +const categoryType = CATEGORY_TYPE.FOOD; const CategoryFoodTab = () => { - const { data: categories } = useCategoryFoodQuery(category); + const { data: categories } = useCategoryFoodQuery(categoryType); const { categoryIds } = useCategoryValueContext(); const { selectCategory } = useCategoryActionContext(); - const currentCategoryId = categoryIds[category]; - const location = useLocation(); - const queryParams = new URLSearchParams(location.search); - const categoryIdFromURL = queryParams.get('category'); + const currentCategoryId = categoryIds[categoryType]; const { gaEvent } = useGA(); - useEffect(() => { - if (categoryIdFromURL) { - selectCategory(category, parseInt(categoryIdFromURL)); - } - }, [category]); - const handleCategoryButtonClick = (menuId: number) => { - selectCategory(category, menuId); + selectCategory(categoryType, menuId); gaEvent({ category: 'button', action: `${getTargetCategoryName(categories, menuId)} ์นดํ…Œ๊ณ ๋ฆฌ ๋ฒ„ํŠผ ํด๋ฆญ`, @@ -41,10 +30,10 @@ const CategoryFoodTab = () => { return ( - {categories.map((menu) => { - const isSelected = menu.id === currentCategoryId; + {categories.map(({ id, name }) => { + const isSelected = id === currentCategoryId; return ( -
  • +
  • { weight="bold" variant={isSelected ? 'filled' : 'outlined'} isSelected={isSelected} - onClick={() => handleCategoryButtonClick(menu.id)} + onClick={() => handleCategoryButtonClick(id)} aria-pressed={isSelected} > - {menu.name} + {name}
  • ); @@ -81,10 +70,9 @@ const CategoryMenuContainer = styled.ul` const CategoryButton = styled(Button)<{ isSelected: boolean }>` padding: 6px 12px; ${({ isSelected }) => - isSelected - ? ` + isSelected && + ` background: ${theme.colors.gray5}; color: ${theme.textColors.white}; - ` - : ''} + `} `; diff --git a/frontend/src/components/Common/CategoryItem/CategoryItem.stories.tsx b/frontend/src/components/Common/CategoryItem/CategoryItem.stories.tsx index b6158f5b6..3dc17ddf1 100644 --- a/frontend/src/components/Common/CategoryItem/CategoryItem.stories.tsx +++ b/frontend/src/components/Common/CategoryItem/CategoryItem.stories.tsx @@ -2,12 +2,23 @@ import type { Meta, StoryObj } from '@storybook/react'; import CategoryItem from './CategoryItem'; +import CategoryProvider from '@/contexts/CategoryContext'; + const meta: Meta = { title: 'common/CategoryItem', component: CategoryItem, + decorators: [ + (Story) => ( + + + + ), + ], args: { + categoryId: 1, name: '์ฆ‰์„ ์‹ํ’ˆ', image: 'https://tqklhszfkvzk6518638.cdn.ntruss.com/product/8801771029052.jpg', + categoryType: 'food', }, }; diff --git a/frontend/src/components/Common/CategoryItem/CategoryItem.tsx b/frontend/src/components/Common/CategoryItem/CategoryItem.tsx index 4ce54ce72..051c97073 100644 --- a/frontend/src/components/Common/CategoryItem/CategoryItem.tsx +++ b/frontend/src/components/Common/CategoryItem/CategoryItem.tsx @@ -1,30 +1,47 @@ import { Button } from '@fun-eat/design-system'; +import { useNavigate } from 'react-router-dom'; import styled from 'styled-components'; +import { PATH } from '@/constants/path'; +import { useGA } from '@/hooks/common'; +import { useCategoryActionContext } from '@/hooks/context'; + interface CategoryItemProps { + categoryId: number; name: string; image: string; + categoryType: 'food' | 'store'; } -const CategoryItem = ({ name, image }: CategoryItemProps) => { +const CategoryItem = ({ categoryId, name, image, categoryType }: CategoryItemProps) => { + const navigate = useNavigate(); + const { selectCategory } = useCategoryActionContext(); + + const { gaEvent } = useGA(); + + const handleCategoryItemClick = (categoryId: number) => { + selectCategory(categoryType, categoryId); + navigate(PATH.PRODUCT_LIST + '/' + categoryType); + + gaEvent({ + category: 'button', + action: `${name} ์นดํ…Œ๊ณ ๋ฆฌ ๋งํฌ ํด๋ฆญ`, + label: '์นดํ…Œ๊ณ ๋ฆฌ', + }); + }; + return ( - + ); }; export default CategoryItem; -const CategoryItemContainer = styled(Button)` - width: 60px; - height: 100px; - text-align: center; -`; - const ImageWrapper = styled.div` display: flex; justify-content: center; diff --git a/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.stories.tsx b/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.stories.tsx index 2592fe4c9..d26be6f49 100644 --- a/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.stories.tsx +++ b/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.stories.tsx @@ -2,9 +2,18 @@ import type { Meta, StoryObj } from '@storybook/react'; import CategoryStoreList from './CategoryStoreList'; +import CategoryProvider from '@/contexts/CategoryContext'; + const meta: Meta = { title: 'common/CategoryStoreList', component: CategoryStoreList, + decorators: [ + (Story) => ( + + + + ), + ], }; export default meta; diff --git a/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.tsx b/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.tsx index 9ce856fa1..6bf2c36ae 100644 --- a/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.tsx +++ b/frontend/src/components/Common/CategoryStoreList/CategoryStoreList.tsx @@ -1,42 +1,21 @@ -import { Link } from '@fun-eat/design-system'; -import { Link as RouterLink } from 'react-router-dom'; import styled from 'styled-components'; import CategoryItem from '../CategoryItem/CategoryItem'; import { CATEGORY_TYPE } from '@/constants'; -import { useGA } from '@/hooks/common'; import { useCategoryStoreQuery } from '@/hooks/queries/product'; -const category = CATEGORY_TYPE.STORE; +const categoryType = CATEGORY_TYPE.STORE; const CategoryStoreList = () => { - const { data: categories } = useCategoryStoreQuery(category); - const { gaEvent } = useGA(); - - const handleHomeCategoryLinkClick = (categoryName: string) => { - gaEvent({ - category: 'link', - action: `${categoryName} ์นดํ…Œ๊ณ ๋ฆฌ ๋งํฌ ํด๋ฆญ`, - label: '์นดํ…Œ๊ณ ๋ฆฌ', - }); - }; + const { data: categories } = useCategoryStoreQuery(categoryType); return ( -
    - - {categories.map((menu) => ( - handleHomeCategoryLinkClick(menu.name)} - > - - - ))} - -
    + + {categories.map(({ id, name, image }) => ( + + ))} + ); }; diff --git a/frontend/src/components/Common/CategoryStoreTab/CategoryStoreTab.tsx b/frontend/src/components/Common/CategoryStoreTab/CategoryStoreTab.tsx index a83fa501f..b75abb7b7 100644 --- a/frontend/src/components/Common/CategoryStoreTab/CategoryStoreTab.tsx +++ b/frontend/src/components/Common/CategoryStoreTab/CategoryStoreTab.tsx @@ -1,6 +1,4 @@ import { Button, theme } from '@fun-eat/design-system'; -import { useEffect } from 'react'; -import { useLocation } from 'react-router-dom'; import styled from 'styled-components'; import { CATEGORY_TYPE } from '@/constants'; @@ -9,29 +7,19 @@ import { useCategoryActionContext, useCategoryValueContext } from '@/hooks/conte import { useCategoryStoreQuery } from '@/hooks/queries/product/useCategoryQuery'; import { getTargetCategoryName } from '@/utils/category'; -const category = CATEGORY_TYPE.STORE; +const categoryType = CATEGORY_TYPE.STORE; const CategoryStoreTab = () => { - const { data: categories } = useCategoryStoreQuery(category); + const { data: categories } = useCategoryStoreQuery(categoryType); const { categoryIds } = useCategoryValueContext(); const { selectCategory } = useCategoryActionContext(); - const currentCategoryId = categoryIds[category]; - - const location = useLocation(); - const queryParams = new URLSearchParams(location.search); - const categoryIdFromURL = queryParams.get('category'); + const currentCategoryId = categoryIds[categoryType]; const { gaEvent } = useGA(); - useEffect(() => { - if (categoryIdFromURL) { - selectCategory(category, parseInt(categoryIdFromURL)); - } - }, [category]); - const handleCategoryButtonClick = (menuId: number) => { - selectCategory(category, menuId); + selectCategory(categoryType, menuId); gaEvent({ category: 'button', action: `${getTargetCategoryName(categories, menuId)} ์นดํ…Œ๊ณ ๋ฆฌ ๋ฒ„ํŠผ ํด๋ฆญ`, @@ -41,10 +29,10 @@ const CategoryStoreTab = () => { return ( - {categories.map((menu) => { - const isSelected = menu.id === currentCategoryId; + {categories.map(({ id, name }) => { + const isSelected = id === currentCategoryId; return ( -
  • +
  • { weight="bold" variant={isSelected ? 'filled' : 'outlined'} isSelected={isSelected} - onClick={() => handleCategoryButtonClick(menu.id)} + onClick={() => handleCategoryButtonClick(id)} aria-pressed={isSelected} > - {menu.name} + {name}
  • ); @@ -81,10 +69,9 @@ const CategoryMenuContainer = styled.ul` const CategoryButton = styled(Button)<{ isSelected: boolean }>` padding: 6px 12px; ${({ isSelected }) => - isSelected - ? ` + isSelected && + ` background: ${theme.colors.primary}; color: ${theme.textColors.default}; - ` - : ''} + `} `; diff --git a/frontend/src/components/Common/ImageUploader/ImageUploader.tsx b/frontend/src/components/Common/ImageUploader/ImageUploader.tsx index bd85c20e3..9c915081e 100644 --- a/frontend/src/components/Common/ImageUploader/ImageUploader.tsx +++ b/frontend/src/components/Common/ImageUploader/ImageUploader.tsx @@ -4,6 +4,7 @@ import styled from 'styled-components'; import { IMAGE_MAX_SIZE } from '@/constants'; import { useEnterKeyDown } from '@/hooks/common'; +import { useToastActionContext } from '@/hooks/context'; interface ReviewImageUploaderProps { previewImage: string; @@ -13,6 +14,7 @@ interface ReviewImageUploaderProps { const ImageUploader = ({ previewImage, uploadImage, deleteImage }: ReviewImageUploaderProps) => { const { inputRef, handleKeydown } = useEnterKeyDown(); + const { toast } = useToastActionContext(); const handleImageUpload: ChangeEventHandler = (event) => { if (!event.target.files) { @@ -22,7 +24,7 @@ const ImageUploader = ({ previewImage, uploadImage, deleteImage }: ReviewImageUp const imageFile = event.target.files[0]; if (imageFile.size > IMAGE_MAX_SIZE) { - alert('์ด๋ฏธ์ง€ ํฌ๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์ปค์š”. 5MB ์ดํ•˜์˜ ์ด๋ฏธ์ง€๋ฅผ ๊ณจ๋ผ์ฃผ์„ธ์š”.'); + toast.error('์ด๋ฏธ์ง€ ํฌ๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์ปค์š”. 5MB ์ดํ•˜์˜ ์ด๋ฏธ์ง€๋ฅผ ๊ณจ๋ผ์ฃผ์„ธ์š”.'); event.target.value = ''; return; } diff --git a/frontend/src/components/Common/Input/Input.tsx b/frontend/src/components/Common/Input/Input.tsx index 59f86743e..c3b3b40f1 100644 --- a/frontend/src/components/Common/Input/Input.tsx +++ b/frontend/src/components/Common/Input/Input.tsx @@ -8,6 +8,10 @@ interface InputProps extends ComponentPropsWithRef<'input'> { * Input ์ปดํฌ๋„ŒํŠธ์˜ ๋„ˆ๋น„๊ฐ’์ž…๋‹ˆ๋‹ค. */ customWidth?: string; + /** + * Input ์ปดํฌ๋„ŒํŠธ์˜ ์ตœ์†Œ ๋„ˆ๋น„๊ฐ’์ž…๋‹ˆ๋‹ค. + */ + minWidth?: string; /** * Input value์— ์—๋Ÿฌ๊ฐ€ ์žˆ๋Š”์ง€ ์—ฌ๋ถ€์ž…๋‹ˆ๋‹ค. */ @@ -24,12 +28,12 @@ interface InputProps extends ComponentPropsWithRef<'input'> { const Input = forwardRef( ( - { customWidth = '300px', isError = false, rightIcon, errorMessage, ...props }: InputProps, + { customWidth = '300px', minWidth, isError = false, rightIcon, errorMessage, ...props }: InputProps, ref: ForwardedRef ) => { return ( <> - + {rightIcon && {rightIcon}} @@ -43,11 +47,12 @@ Input.displayName = 'Input'; export default Input; -type InputContainerStyleProps = Pick; +type InputContainerStyleProps = Pick; type CustomInputStyleProps = Pick; const InputContainer = styled.div` position: relative; + min-width: ${({ minWidth }) => minWidth ?? 0}; max-width: ${({ customWidth }) => customWidth}; text-align: center; `; diff --git a/frontend/src/components/Common/Loading/Loading.tsx b/frontend/src/components/Common/Loading/Loading.tsx index 4ef7d374e..7c58614ae 100644 --- a/frontend/src/components/Common/Loading/Loading.tsx +++ b/frontend/src/components/Common/Loading/Loading.tsx @@ -40,7 +40,7 @@ const rotate = keyframes` } 100% { - transform: rotate(-360deg); + transform: rotate(360deg); } `; diff --git a/frontend/src/components/Common/SectionTitle/SectionTitle.stories.tsx b/frontend/src/components/Common/SectionTitle/SectionTitle.stories.tsx index edec003ca..05883aea3 100644 --- a/frontend/src/components/Common/SectionTitle/SectionTitle.stories.tsx +++ b/frontend/src/components/Common/SectionTitle/SectionTitle.stories.tsx @@ -13,13 +13,11 @@ type Story = StoryObj; export const Default: Story = { args: { name: '์‚ฌ์ด๋‹ค', - bookmark: false, }, }; export const Bookmarked: Story = { args: { name: '์‚ฌ์ด๋‹ค', - bookmark: true, }, }; diff --git a/frontend/src/components/Common/SectionTitle/SectionTitle.tsx b/frontend/src/components/Common/SectionTitle/SectionTitle.tsx index 106c60759..c9d649ddb 100644 --- a/frontend/src/components/Common/SectionTitle/SectionTitle.tsx +++ b/frontend/src/components/Common/SectionTitle/SectionTitle.tsx @@ -1,4 +1,5 @@ -import { Button, Heading, theme } from '@fun-eat/design-system'; +import { Button, Heading, Link, theme } from '@fun-eat/design-system'; +import { Link as RouterLink } from 'react-router-dom'; import styled from 'styled-components'; import { SvgIcon } from '@/components/Common'; @@ -6,10 +7,10 @@ import { useRoutePage } from '@/hooks/common'; interface SectionTitleProps { name: string; - bookmark?: boolean; + link?: string; } -const SectionTitle = ({ name, bookmark = false }: SectionTitleProps) => { +const SectionTitle = ({ name, link }: SectionTitleProps) => { const { routeBack } = useRoutePage(); return ( @@ -18,18 +19,15 @@ const SectionTitle = ({ name, bookmark = false }: SectionTitleProps) => { - - {name} - + {link ? ( + + {name} + + ) : ( + {name} + )} + {link && } - {bookmark && ( - - )} ); }; @@ -45,9 +43,12 @@ const SectionTitleContainer = styled.div` const SectionTitleWrapper = styled.div` display: flex; align-items: center; - column-gap: 16px; svg { padding-top: 2px; } `; + +const ProductName = styled(Heading)` + margin: 0 5px 0 16px; +`; diff --git a/frontend/src/components/Common/SortOptionList/SortOptionList.stories.tsx b/frontend/src/components/Common/SortOptionList/SortOptionList.stories.tsx index 779e68942..5e7c2f935 100644 --- a/frontend/src/components/Common/SortOptionList/SortOptionList.stories.tsx +++ b/frontend/src/components/Common/SortOptionList/SortOptionList.stories.tsx @@ -17,7 +17,7 @@ type Story = StoryObj; export const Default: Story = { render: () => { - const { ref, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); + const { isOpen, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); const { selectedOption, selectSortOption } = useSortOption(PRODUCT_SORT_OPTIONS[0]); useEffect(() => { @@ -25,7 +25,7 @@ export const Default: Story = { }, []); return ( - + { + + + + + + + + + + + + + + + ); }; diff --git a/frontend/src/components/Common/TagList/TagList.tsx b/frontend/src/components/Common/TagList/TagList.tsx index abf2817ee..b36cd70aa 100644 --- a/frontend/src/components/Common/TagList/TagList.tsx +++ b/frontend/src/components/Common/TagList/TagList.tsx @@ -15,7 +15,7 @@ const TagList = ({ tags }: TagListProps) => { const tagColor = convertTagColor(tag.tagType); return (
  • - + {tag.name}
  • @@ -29,6 +29,7 @@ export default TagList; const TagListContainer = styled.ul` display: flex; + margin: 12px 0; column-gap: 8px; `; diff --git a/frontend/src/components/Common/Toast/Toast.stories.tsx b/frontend/src/components/Common/Toast/Toast.stories.tsx new file mode 100644 index 000000000..383c43751 --- /dev/null +++ b/frontend/src/components/Common/Toast/Toast.stories.tsx @@ -0,0 +1,49 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import Toast from './Toast'; + +import ToastProvider from '@/contexts/ToastContext'; +import { useToastActionContext } from '@/hooks/context'; + +const meta: Meta = { + title: 'common/Toast', + component: Toast, + decorators: [ + (Story) => ( + + + + ), + ], +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + render: () => { + const { toast } = useToastActionContext(); + const handleClick = () => { + toast.success('์„ฑ๊ณต'); + }; + return ( +
    + +
    + ); + }, +}; + +export const Error: Story = { + render: () => { + const { toast } = useToastActionContext(); + const handleClick = () => { + toast.error('์‹คํŒจ'); + }; + return ( +
    + +
    + ); + }, +}; diff --git a/frontend/src/components/Common/Toast/Toast.tsx b/frontend/src/components/Common/Toast/Toast.tsx new file mode 100644 index 000000000..c9d9dc46f --- /dev/null +++ b/frontend/src/components/Common/Toast/Toast.tsx @@ -0,0 +1,41 @@ +import { Text, useTheme } from '@fun-eat/design-system'; +import styled from 'styled-components'; + +import { useToast } from '@/hooks/common'; +import { fadeOut, slideIn } from '@/styles/animations'; + +interface ToastProps { + id: number; + message: string; + isError?: boolean; +} + +const Toast = ({ id, message, isError = false }: ToastProps) => { + const theme = useTheme(); + const isShown = useToast(id); + + return ( + + {message} + + ); +}; + +export default Toast; + +type ToastStyleProps = Pick & { isAnimating?: boolean }; + +const ToastWrapper = styled.div` + position: relative; + width: calc(100% - 20px); + height: 55px; + max-width: 560px; + border-radius: 10px; + background: ${({ isError, theme }) => (isError ? theme.colors.error : theme.colors.black)}; + animation: ${({ isAnimating }) => (isAnimating ? slideIn : fadeOut)} 0.3s ease-in-out forwards; +`; + +const Message = styled(Text)` + margin-left: 20px; + line-height: 55px; +`; diff --git a/frontend/src/components/Common/index.ts b/frontend/src/components/Common/index.ts index 8668ceb21..070263f54 100644 --- a/frontend/src/components/Common/index.ts +++ b/frontend/src/components/Common/index.ts @@ -19,7 +19,9 @@ export { default as MarkedText } from './MarkedText/MarkedText'; export { default as NavigableSectionTitle } from './NavigableSectionTitle/NavigableSectionTitle'; export { default as Carousel } from './Carousel/Carousel'; export { default as RegisterButton } from './RegisterButton/RegisterButton'; +export { default as Toast } from './Toast/Toast'; export { default as CategoryItem } from './CategoryItem/CategoryItem'; export { default as CategoryFoodList } from './CategoryFoodList/CategoryFoodList'; export { default as CategoryStoreList } from './CategoryStoreList/CategoryStoreList'; export { default as Skeleton } from './Skeleton/Skeleton'; +export { default as Banner } from './Banner/Banner'; diff --git a/frontend/src/components/Members/MemberRecipeList/MemberRecipeList.tsx b/frontend/src/components/Members/MemberRecipeList/MemberRecipeList.tsx index 14558353f..740daddff 100644 --- a/frontend/src/components/Members/MemberRecipeList/MemberRecipeList.tsx +++ b/frontend/src/components/Members/MemberRecipeList/MemberRecipeList.tsx @@ -10,15 +10,15 @@ import { useInfiniteMemberRecipeQuery } from '@/hooks/queries/members'; import useDisplaySlice from '@/utils/displaySlice'; interface MemberRecipeListProps { - isMemberPage?: boolean; + isPreview?: boolean; } -const MemberRecipeList = ({ isMemberPage = false }: MemberRecipeListProps) => { +const MemberRecipeList = ({ isPreview = false }: MemberRecipeListProps) => { const scrollRef = useRef(null); const { fetchNextPage, hasNextPage, data } = useInfiniteMemberRecipeQuery(); const memberRecipes = data?.pages.flatMap((page) => page.recipes); - const recipeToDisplay = useDisplaySlice(isMemberPage, memberRecipes); + const recipeToDisplay = useDisplaySlice(isPreview, memberRecipes); useIntersectionObserver(fetchNextPage, scrollRef, hasNextPage); @@ -40,7 +40,7 @@ const MemberRecipeList = ({ isMemberPage = false }: MemberRecipeListProps) => { return ( - {!isMemberPage && ( + {!isPreview && ( ์ด {totalRecipeCount}๊ฐœ์˜ ๊ฟ€์กฐํ•ฉ์„ ๋‚จ๊ฒผ์–ด์š”! @@ -50,7 +50,7 @@ const MemberRecipeList = ({ isMemberPage = false }: MemberRecipeListProps) => { {recipeToDisplay?.map((recipe) => (
  • - +
  • ))} diff --git a/frontend/src/components/Members/MemberReviewItem/MemberReviewItem.stories.tsx b/frontend/src/components/Members/MemberReviewItem/MemberReviewItem.stories.tsx new file mode 100644 index 000000000..a631341d4 --- /dev/null +++ b/frontend/src/components/Members/MemberReviewItem/MemberReviewItem.stories.tsx @@ -0,0 +1,35 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import MemberReviewItem from './MemberReviewItem'; + +import ToastProvider from '@/contexts/ToastContext'; + +const meta: Meta = { + title: 'members/MemberReviewItem', + component: MemberReviewItem, + decorators: [ + (Story) => ( + + + + ), + ], + args: { + review: { + reviewId: 1, + productId: 5, + productName: '๊ตฌ์šด๊ฐ์ž์Šฌ๋ฆผ๋ช…๋ž€๋งˆ์š”', + content: + 'ํ• ๋จธ๋‹ˆ๊ฐ€ ๋จน์„ ๊ฑฐ ๊ฐ™์€ ๋ง›์ž…๋‹ˆ๋‹ค. 1960๋…„ ์ „์Ÿ ๋•Œ ๋ง› ๋ณด๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ๊ทธ๋•Œ๋Š” ๋„ˆ๋ฌด ๊ฐ€๋‚œํ•ด์„œ ๋จน์„ ์ˆ˜ ์—†์—ˆ๋Š”๋ฐ์š” ์ด๊ฒƒ๋ณด๋‹ค ๊ธด ๋ฆฌ๋ทฐ๋„ ์ž˜๋ ค ๋ณด์ธ๋‹ต๋‹ˆ๋‹ค', + rating: 4.0, + favoriteCount: 1256, + categoryType: 'food', + }, + isPreview: true, + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = {}; diff --git a/frontend/src/components/Members/MemberReviewItem/MemberReviewItem.tsx b/frontend/src/components/Members/MemberReviewItem/MemberReviewItem.tsx new file mode 100644 index 000000000..1d4503853 --- /dev/null +++ b/frontend/src/components/Members/MemberReviewItem/MemberReviewItem.tsx @@ -0,0 +1,123 @@ +import { useTheme, Spacing, Text, Button } from '@fun-eat/design-system'; +import type { MouseEventHandler } from 'react'; +import styled from 'styled-components'; + +import { SvgIcon } from '@/components/Common'; +import { useToastActionContext } from '@/hooks/context'; +import { useDeleteReview } from '@/hooks/queries/members'; +import type { MemberReview } from '@/types/review'; + +interface MemberReviewItemProps { + review: MemberReview; + isPreview: boolean; +} + +const MemberReviewItem = ({ review, isPreview }: MemberReviewItemProps) => { + const theme = useTheme(); + + const { mutate } = useDeleteReview(); + + const { toast } = useToastActionContext(); + + const { reviewId, productName, content, rating, favoriteCount } = review; + + const handleReviewDelete: MouseEventHandler = (e) => { + e.preventDefault(); + + const result = window.confirm('๋ฆฌ๋ทฐ๋ฅผ ์‚ญ์ œํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?'); + if (!result) { + return; + } + + mutate(reviewId, { + onSuccess: () => { + toast.success('๋ฆฌ๋ทฐ๋ฅผ ์‚ญ์ œํ–ˆ์Šต๋‹ˆ๋‹ค.'); + }, + onError: (error) => { + if (error instanceof Error) { + toast.error(error.message); + return; + } + + toast.error('๋ฆฌ๋ทฐ ์ข‹์•„์š”๋ฅผ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); + }, + }); + }; + + return ( + + + + {productName} + + {!isPreview && ( + + )} + + + {content} + + + + + + + {favoriteCount} + + + + + + {rating.toFixed(1)} + + + + + ); +}; + +export default MemberReviewItem; + +const ReviewRankingItemContainer = styled.div` + display: flex; + flex-direction: column; + gap: 4px; + padding: 12px 0; + border-bottom: ${({ theme }) => `1px solid ${theme.borderColors.disabled}`}; +`; + +const ProductNameIconWrapper = styled.div` + display: flex; + justify-content: space-between; +`; + +const ReviewText = styled(Text)` + display: -webkit-inline-box; + text-overflow: ellipsis; + overflow: hidden; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +`; + +const FavoriteStarWrapper = styled.div` + display: flex; + gap: 4px; +`; + +const FavoriteIconWrapper = styled.div` + display: flex; + gap: 4px; + align-items: center; +`; + +const RatingIconWrapper = styled.div` + display: flex; + gap: 2px; + align-items: center; + + & > svg { + padding-bottom: 2px; + } +`; diff --git a/frontend/src/components/Members/MemberReviewList/MemberReviewList.tsx b/frontend/src/components/Members/MemberReviewList/MemberReviewList.tsx index 50398fedf..b622d9f65 100644 --- a/frontend/src/components/Members/MemberReviewList/MemberReviewList.tsx +++ b/frontend/src/components/Members/MemberReviewList/MemberReviewList.tsx @@ -3,21 +3,22 @@ import { useRef } from 'react'; import { Link as RouterLink } from 'react-router-dom'; import styled from 'styled-components'; -import { ReviewRankingItem } from '@/components/Rank'; +import MemberReviewItem from '../MemberReviewItem/MemberReviewItem'; + import { PATH } from '@/constants/path'; import { useIntersectionObserver } from '@/hooks/common'; import { useInfiniteMemberReviewQuery } from '@/hooks/queries/members'; import useDisplaySlice from '@/utils/displaySlice'; interface MemberReviewListProps { - isMemberPage?: boolean; + isPreview?: boolean; } -const MemberReviewList = ({ isMemberPage = false }: MemberReviewListProps) => { +const MemberReviewList = ({ isPreview = false }: MemberReviewListProps) => { const scrollRef = useRef(null); const { fetchNextPage, hasNextPage, data } = useInfiniteMemberReviewQuery(); const memberReviews = data.pages.flatMap((page) => page.reviews); - const reviewsToDisplay = useDisplaySlice(isMemberPage, memberReviews); + const reviewsToDisplay = useDisplaySlice(isPreview, memberReviews); useIntersectionObserver(fetchNextPage, scrollRef, hasNextPage); @@ -39,21 +40,17 @@ const MemberReviewList = ({ isMemberPage = false }: MemberReviewListProps) => { return ( - {!isMemberPage && ( + {!isPreview && ( ์ด {totalReviewCount}๊ฐœ์˜ ๋ฆฌ๋ทฐ๋ฅผ ๋‚จ๊ฒผ์–ด์š”! )} - {reviewsToDisplay.map((reviewRanking) => ( -
  • - - + {reviewsToDisplay.map((review) => ( +
  • + +
  • ))} diff --git a/frontend/src/components/Members/index.ts b/frontend/src/components/Members/index.ts index a295e2728..4e31460ee 100644 --- a/frontend/src/components/Members/index.ts +++ b/frontend/src/components/Members/index.ts @@ -2,3 +2,4 @@ export { default as MembersInfo } from './MembersInfo/MembersInfo'; export { default as MemberReviewList } from './MemberReviewList/MemberReviewList'; export { default as MemberRecipeList } from './MemberRecipeList/MemberRecipeList'; export { default as MemberModifyInput } from './MemberModifyInput/MemberModifyInput'; +export { default as MemberReviewItem } from './MemberReviewItem/MemberReviewItem'; diff --git a/frontend/src/components/Product/ProductDetailItem/ProductDetailItem.tsx b/frontend/src/components/Product/ProductDetailItem/ProductDetailItem.tsx index 5d87be4b3..b91b97e2b 100644 --- a/frontend/src/components/Product/ProductDetailItem/ProductDetailItem.tsx +++ b/frontend/src/components/Product/ProductDetailItem/ProductDetailItem.tsx @@ -20,7 +20,7 @@ const ProductDetailItem = ({ category, productDetail }: ProductDetailItemProps) return ( - {image !== null ? ( + {image ? ( {name} ) : category === CATEGORY_TYPE.FOOD ? ( @@ -29,6 +29,7 @@ const ProductDetailItem = ({ category, productDetail }: ProductDetailItemProps) )} + ๊ฐ€๊ฒฉ {price.toLocaleString('ko-KR')}์› @@ -41,11 +42,10 @@ const ProductDetailItem = ({ category, productDetail }: ProductDetailItemProps) ํ‰๊ท  ํ‰์  - {averageRating} + {averageRating.toFixed(1)} - ); }; diff --git a/frontend/src/components/Product/ProductItem/ProductItem.tsx b/frontend/src/components/Product/ProductItem/ProductItem.tsx index 74fe7accb..b1e935dd8 100644 --- a/frontend/src/components/Product/ProductItem/ProductItem.tsx +++ b/frontend/src/components/Product/ProductItem/ProductItem.tsx @@ -1,9 +1,12 @@ import { Text, useTheme } from '@fun-eat/design-system'; import { memo, useState } from 'react'; +import { useParams } from 'react-router-dom'; import styled from 'styled-components'; import PreviewImage from '@/assets/characters.svg'; +import PBPreviewImage from '@/assets/samgakgimbab.svg'; import { Skeleton, SvgIcon } from '@/components/Common'; +import { CATEGORY_TYPE } from '@/constants'; import type { Product } from '@/types/product'; interface ProductItemProps { @@ -12,12 +15,17 @@ interface ProductItemProps { const ProductItem = ({ product }: ProductItemProps) => { const theme = useTheme(); + const { category } = useParams(); const { name, price, image, averageRating, reviewCount } = product; const [isImageLoading, setIsImageLoading] = useState(true); + if (!category) { + return null; + } + return ( - {image !== null ? ( + {image ? ( <> { /> {isImageLoading && } - ) : ( + ) : category === CATEGORY_TYPE.FOOD ? ( + ) : ( + )} @@ -43,7 +53,7 @@ const ProductItem = ({ product }: ProductItemProps) => { - {averageRating} + {averageRating.toFixed(1)} diff --git a/frontend/src/components/Rank/RecipeRankingItem/RecipeRankingItem.tsx b/frontend/src/components/Rank/RecipeRankingItem/RecipeRankingItem.tsx index 81086851d..b887ad10d 100644 --- a/frontend/src/components/Rank/RecipeRankingItem/RecipeRankingItem.tsx +++ b/frontend/src/components/Rank/RecipeRankingItem/RecipeRankingItem.tsx @@ -5,6 +5,7 @@ import styled from 'styled-components'; import RecipePreviewImage from '@/assets/plate.svg'; import { Skeleton, SvgIcon } from '@/components/Common'; import type { RecipeRanking } from '@/types/ranking'; +import { getRelativeDate } from '@/utils/date'; interface RecipeRankingItemProps { rank: number; @@ -18,6 +19,7 @@ const RecipeRankingItem = ({ rank, recipe }: RecipeRankingItemProps) => { title, author: { nickname, profileImage }, favoriteCount, + createdAt, } = recipe; const [isImageLoading, setIsImageLoading] = useState(true); @@ -49,6 +51,10 @@ const RecipeRankingItem = ({ rank, recipe }: RecipeRankingItemProps) => { {favoriteCount} + + + {getRelativeDate(createdAt)} + diff --git a/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.stories.tsx b/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.stories.tsx index ca874ebf6..099f34737 100644 --- a/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.stories.tsx +++ b/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.stories.tsx @@ -15,6 +15,7 @@ const meta: Meta = { rating: 4.0, favoriteCount: 1256, categoryType: 'food', + createdAt: '2021-08-01T00:00:00.000Z', }, }, }; diff --git a/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.tsx b/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.tsx index 70fd89c32..205cfb03b 100644 --- a/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.tsx +++ b/frontend/src/components/Rank/ReviewRankingItem/ReviewRankingItem.tsx @@ -1,16 +1,19 @@ -import { Spacing, Text, theme } from '@fun-eat/design-system'; +import { Spacing, Text, useTheme } from '@fun-eat/design-system'; import { memo } from 'react'; import styled from 'styled-components'; import { SvgIcon } from '@/components/Common'; import type { ReviewRanking } from '@/types/ranking'; +import { getRelativeDate } from '@/utils/date'; interface ReviewRankingItemProps { reviewRanking: ReviewRanking; } const ReviewRankingItem = ({ reviewRanking }: ReviewRankingItemProps) => { - const { productName, content, rating, favoriteCount } = reviewRanking; + const theme = useTheme(); + + const { productName, content, rating, favoriteCount, createdAt } = reviewRanking; return ( @@ -34,6 +37,9 @@ const ReviewRankingItem = ({ reviewRanking }: ReviewRankingItemProps) => { {rating.toFixed(1)} + + {getRelativeDate(createdAt)} + ); @@ -46,7 +52,7 @@ const ReviewRankingItemContainer = styled.div` flex-direction: column; gap: 4px; padding: 12px; - border: 1px solid ${({ theme }) => theme.borderColors.disabled}; + border: ${({ theme }) => `1px solid ${theme.borderColors.disabled}`}; border-radius: ${({ theme }) => theme.borderRadius.sm}; `; @@ -78,3 +84,7 @@ const RatingIconWrapper = styled.div` padding-bottom: 2px; } `; + +const ReviewDate = styled(Text)` + margin-left: auto; +`; diff --git a/frontend/src/components/Rank/ReviewRankingList/ReviewRankingList.tsx b/frontend/src/components/Rank/ReviewRankingList/ReviewRankingList.tsx index 7b6c8272c..99f10d5f3 100644 --- a/frontend/src/components/Rank/ReviewRankingList/ReviewRankingList.tsx +++ b/frontend/src/components/Rank/ReviewRankingList/ReviewRankingList.tsx @@ -28,7 +28,7 @@ const ReviewRankingList = ({ isHomePage = false }: ReviewRankingListProps) => {
  • diff --git a/frontend/src/components/Recipe/CommentForm/CommentForm.stories.tsx b/frontend/src/components/Recipe/CommentForm/CommentForm.stories.tsx new file mode 100644 index 000000000..e65b87225 --- /dev/null +++ b/frontend/src/components/Recipe/CommentForm/CommentForm.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import CommentForm from './CommentForm'; + +const meta: Meta = { + title: 'recipe/CommentForm', + component: CommentForm, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = {}; diff --git a/frontend/src/components/Recipe/CommentForm/CommentForm.tsx b/frontend/src/components/Recipe/CommentForm/CommentForm.tsx new file mode 100644 index 000000000..104657552 --- /dev/null +++ b/frontend/src/components/Recipe/CommentForm/CommentForm.tsx @@ -0,0 +1,106 @@ +import { Button, Spacing, Text, Textarea, useTheme } from '@fun-eat/design-system'; +import type { ChangeEventHandler, FormEventHandler, RefObject } from 'react'; +import { useState } from 'react'; +import styled from 'styled-components'; + +import { SvgIcon } from '@/components/Common'; +import { useScroll } from '@/hooks/common'; +import { useToastActionContext } from '@/hooks/context'; +import { useRecipeCommentMutation } from '@/hooks/queries/recipe'; + +interface CommentFormProps { + recipeId: number; + scrollTargetRef: RefObject; +} + +const MAX_COMMENT_LENGTH = 200; + +const CommentForm = ({ recipeId, scrollTargetRef }: CommentFormProps) => { + const [commentValue, setCommentValue] = useState(''); + const { mutate } = useRecipeCommentMutation(recipeId); + + const theme = useTheme(); + const { toast } = useToastActionContext(); + + const { scrollToPosition } = useScroll(); + + const handleCommentInput: ChangeEventHandler = (e) => { + setCommentValue(e.target.value); + }; + + const handleSubmitComment: FormEventHandler = (e) => { + e.preventDefault(); + + mutate( + { comment: commentValue }, + { + onSuccess: () => { + setCommentValue(''); + scrollToPosition(scrollTargetRef); + toast.success('๋Œ“๊ธ€์ด ๋“ฑ๋ก๋˜์—ˆ์Šต๋‹ˆ๋‹ค.'); + }, + onError: (error) => { + if (error instanceof Error) { + toast.error(error.message); + return; + } + + toast.error('๋Œ“๊ธ€์„ ๋“ฑ๋กํ•˜๋Š”๋ฐ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.'); + }, + } + ); + }; + + return ( + +
    + + + + + + + + {commentValue.length}์ž / {MAX_COMMENT_LENGTH}์ž + +
    + ); +}; + +export default CommentForm; + +const CommentFormContainer = styled.div` + position: fixed; + bottom: 0; + width: calc(100% - 40px); + max-width: 540px; + padding: 16px 0; + background: ${({ theme }) => theme.backgroundColors.default}; +`; + +const Form = styled.form` + display: flex; + gap: 4px; + justify-content: space-around; + align-items: center; +`; + +const CommentTextarea = styled(Textarea)` + height: 50px; + padding: 8px; + font-size: 1.4rem; +`; + +const SubmitButton = styled(Button)` + cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')}; +`; diff --git a/frontend/src/components/Recipe/CommentItem/CommentItem.stories.tsx b/frontend/src/components/Recipe/CommentItem/CommentItem.stories.tsx new file mode 100644 index 000000000..70bf1f9a6 --- /dev/null +++ b/frontend/src/components/Recipe/CommentItem/CommentItem.stories.tsx @@ -0,0 +1,18 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import CommentItem from './CommentItem'; + +import comments from '@/mocks/data/comments.json'; + +const meta: Meta = { + title: 'recipe/CommentItem', + component: CommentItem, + args: { + recipeComment: comments.comments[0], + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = {}; diff --git a/frontend/src/components/Recipe/CommentItem/CommentItem.tsx b/frontend/src/components/Recipe/CommentItem/CommentItem.tsx new file mode 100644 index 000000000..847194b75 --- /dev/null +++ b/frontend/src/components/Recipe/CommentItem/CommentItem.tsx @@ -0,0 +1,50 @@ +import { Divider, Spacing, Text, useTheme } from '@fun-eat/design-system'; +import styled from 'styled-components'; + +import type { Comment } from '@/types/recipe'; +import { getFormattedDate } from '@/utils/date'; + +interface CommentItemProps { + recipeComment: Comment; +} + +const CommentItem = ({ recipeComment }: CommentItemProps) => { + const theme = useTheme(); + const { author, comment, createdAt } = recipeComment; + + return ( + <> + + +
    + + {author.nickname} ๋‹˜ + + + {getFormattedDate(createdAt)} + +
    +
    + {comment} + + + + ); +}; + +export default CommentItem; + +const AuthorWrapper = styled.div` + display: flex; + gap: 12px; + align-items: center; +`; + +const AuthorProfileImage = styled.img` + border: 1px solid ${({ theme }) => theme.colors.primary}; + border-radius: 50%; +`; + +const CommentContent = styled(Text)` + margin: 16px 0; +`; diff --git a/frontend/src/components/Recipe/CommentList/CommentList.stories.tsx b/frontend/src/components/Recipe/CommentList/CommentList.stories.tsx new file mode 100644 index 000000000..ebad218de --- /dev/null +++ b/frontend/src/components/Recipe/CommentList/CommentList.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import CommentList from './CommentList'; + +const meta: Meta = { + title: 'recipe/CommentList', + component: CommentList, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = {}; diff --git a/frontend/src/components/Recipe/CommentList/CommentList.tsx b/frontend/src/components/Recipe/CommentList/CommentList.tsx new file mode 100644 index 000000000..d44f33c34 --- /dev/null +++ b/frontend/src/components/Recipe/CommentList/CommentList.tsx @@ -0,0 +1,37 @@ +import { Heading, Spacing, Text, theme } from '@fun-eat/design-system'; +import { useRef } from 'react'; + +import CommentItem from '../CommentItem/CommentItem'; + +import { useIntersectionObserver } from '@/hooks/common'; +import { useInfiniteRecipeCommentQuery } from '@/hooks/queries/recipe'; + +interface CommentListProps { + recipeId: number; +} + +const CommentList = ({ recipeId }: CommentListProps) => { + const scrollRef = useRef(null); + + const { fetchNextPage, hasNextPage, data } = useInfiniteRecipeCommentQuery(Number(recipeId)); + useIntersectionObserver(fetchNextPage, scrollRef, hasNextPage); + + const [{ totalElements }] = data.pages.flatMap((page) => page); + const comments = data.pages.flatMap((page) => page.comments); + + return ( + <> + + ๋Œ“๊ธ€ ({totalElements}๊ฐœ) + + + {totalElements === 0 && ๊ฟ€์กฐํ•ฉ์˜ ์ฒซ๋ฒˆ์งธ ๋Œ“๊ธ€์„ ๋‹ฌ์•„๋ณด์„ธ์š”!} + {comments.map((comment) => ( + + ))} +
    + + ); +}; + +export default CommentList; diff --git a/frontend/src/components/Recipe/RecipeFavorite/RecipeFavorite.tsx b/frontend/src/components/Recipe/RecipeFavorite/RecipeFavorite.tsx index 882ca0eed..703e209c6 100644 --- a/frontend/src/components/Recipe/RecipeFavorite/RecipeFavorite.tsx +++ b/frontend/src/components/Recipe/RecipeFavorite/RecipeFavorite.tsx @@ -4,6 +4,7 @@ import styled from 'styled-components'; import { SvgIcon } from '@/components/Common'; import { useTimeout } from '@/hooks/common'; +import { useToastActionContext } from '@/hooks/context'; import { useRecipeFavoriteMutation } from '@/hooks/queries/recipe'; interface RecipeFavoriteProps { @@ -15,6 +16,8 @@ interface RecipeFavoriteProps { const RecipeFavorite = ({ recipeId, favorite, favoriteCount }: RecipeFavoriteProps) => { const [isFavorite, setIsFavorite] = useState(favorite); const [currentFavoriteCount, setCurrentFavoriteCount] = useState(favoriteCount); + const { toast } = useToastActionContext(); + const { mutate } = useRecipeFavoriteMutation(Number(recipeId)); const handleToggleFavorite = async () => { @@ -26,7 +29,7 @@ const RecipeFavorite = ({ recipeId, favorite, favoriteCount }: RecipeFavoritePro setCurrentFavoriteCount((prev) => (isFavorite ? prev - 1 : prev + 1)); }, onError: () => { - alert('๊ฟ€์กฐํ•ฉ ์ข‹์•„์š”๋ฅผ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); + toast.error('๊ฟ€์กฐํ•ฉ ์ข‹์•„์š”๋ฅผ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); }, } ); diff --git a/frontend/src/components/Recipe/RecipeRegisterForm/RecipeRegisterForm.tsx b/frontend/src/components/Recipe/RecipeRegisterForm/RecipeRegisterForm.tsx index 238de3574..e92d894c5 100644 --- a/frontend/src/components/Recipe/RecipeRegisterForm/RecipeRegisterForm.tsx +++ b/frontend/src/components/Recipe/RecipeRegisterForm/RecipeRegisterForm.tsx @@ -8,7 +8,7 @@ import RecipeUsedProducts from '../RecipeUsedProducts/RecipeUsedProducts'; import { ImageUploader, SvgIcon } from '@/components/Common'; import { useImageUploader, useFormData } from '@/hooks/common'; -import { useRecipeFormValueContext, useRecipeFormActionContext } from '@/hooks/context'; +import { useRecipeFormValueContext, useRecipeFormActionContext, useToastActionContext } from '@/hooks/context'; import { useRecipeRegisterFormMutation } from '@/hooks/queries/recipe'; import type { RecipeRequest } from '@/types/recipe'; @@ -23,6 +23,7 @@ const RecipeRegisterForm = ({ closeRecipeDialog }: RecipeRegisterFormProps) => { const recipeFormValue = useRecipeFormValueContext(); const { resetRecipeFormValue } = useRecipeFormActionContext(); + const { toast } = useToastActionContext(); const formData = useFormData({ imageKey: 'images', @@ -48,15 +49,16 @@ const RecipeRegisterForm = ({ closeRecipeDialog }: RecipeRegisterFormProps) => { mutate(formData, { onSuccess: () => { resetAndCloseForm(); + toast.success('๐Ÿฏ ๊ฟ€์กฐํ•ฉ์ด ๋“ฑ๋ก ๋์–ด์š”'); }, onError: (error) => { resetAndCloseForm(); if (error instanceof Error) { - alert(error.message); + toast.error(error.message); return; } - alert('๊ฟ€์กฐํ•ฉ ๋“ฑ๋ก์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”'); + toast.error('๊ฟ€์กฐํ•ฉ ๋“ฑ๋ก์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”'); }, }); }; diff --git a/frontend/src/components/Recipe/index.ts b/frontend/src/components/Recipe/index.ts index f0ecdf5f6..b79761203 100644 --- a/frontend/src/components/Recipe/index.ts +++ b/frontend/src/components/Recipe/index.ts @@ -5,3 +5,6 @@ export { default as RecipeItem } from './RecipeItem/RecipeItem'; export { default as RecipeList } from './RecipeList/RecipeList'; export { default as RecipeRegisterForm } from './RecipeRegisterForm/RecipeRegisterForm'; export { default as RecipeFavorite } from './RecipeFavorite/RecipeFavorite'; +export { default as CommentItem } from './CommentItem/CommentItem'; +export { default as CommentForm } from './CommentForm/CommentForm'; +export { default as CommentList } from './CommentList/CommentList'; diff --git a/frontend/src/components/Review/BestReviewItem/BestReviewItem.stories.tsx b/frontend/src/components/Review/BestReviewItem/BestReviewItem.stories.tsx new file mode 100644 index 000000000..bc8c75e77 --- /dev/null +++ b/frontend/src/components/Review/BestReviewItem/BestReviewItem.stories.tsx @@ -0,0 +1,17 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import BestReviewItem from './BestReviewItem'; + +const meta: Meta = { + title: 'review/BestReviewItem', + component: BestReviewItem, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + productId: 2, + }, +}; diff --git a/frontend/src/components/Review/BestReviewItem/BestReviewItem.tsx b/frontend/src/components/Review/BestReviewItem/BestReviewItem.tsx new file mode 100644 index 000000000..5e66dcbbb --- /dev/null +++ b/frontend/src/components/Review/BestReviewItem/BestReviewItem.tsx @@ -0,0 +1,103 @@ +import { Spacing, Text, useTheme } from '@fun-eat/design-system'; +import styled from 'styled-components'; + +import { SvgIcon } from '@/components/Common'; +import { useBestReviewQuery } from '@/hooks/queries/rank'; + +interface BestReviewItemProps { + productId: number; +} + +const BestReviewItem = ({ productId }: BestReviewItemProps) => { + const { data: bestReview } = useBestReviewQuery(productId); + + if (!bestReview) { + return null; + } + + const { profileImage, userName, rating, favoriteCount, content } = bestReview; + + const theme = useTheme(); + + return ( + <> + + โญ๏ธ ๋ฒ ์ŠคํŠธ ๋ฆฌ๋ทฐ โญ๏ธ + + + {Object.keys(bestReview).length !== 0 && ( + + + + +
    + + {userName} ๋‹˜ + + {Array.from({ length: 5 }, (_, index) => ( + + ))} +
    +
    + + + + {favoriteCount} + + +
    + + + {content} + +
    + )} + + ); +}; + +export default BestReviewItem; + +const BestReviewItemContainer = styled.div` + padding: 10px; + border: 1px solid ${({ theme }) => theme.borderColors.disabled}; + border-radius: 5px; +`; + +const ReviewRateFavoriteWrapper = styled.div` + display: flex; + justify-content: space-between; + align-items: flex-end; +`; + +const ReviewerInfoWrapper = styled.div` + display: flex; + align-items: center; + column-gap: 10px; +`; + +const ReviewerImage = styled.img` + border: 2px solid ${({ theme }) => theme.colors.primary}; + border-radius: 50%; + object-fit: cover; +`; + +const FavoriteWrapper = styled.div` + display: flex; + gap: 8px; + align-items: center; +`; + +const ReviewText = styled(Text)` + display: -webkit-inline-box; + text-overflow: ellipsis; + overflow: hidden; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +`; diff --git a/frontend/src/components/Review/ReviewItem/ReviewItem.tsx b/frontend/src/components/Review/ReviewItem/ReviewItem.tsx index 112824ada..14cd83d18 100644 --- a/frontend/src/components/Review/ReviewItem/ReviewItem.tsx +++ b/frontend/src/components/Review/ReviewItem/ReviewItem.tsx @@ -4,6 +4,7 @@ import styled from 'styled-components'; import { SvgIcon, TagList } from '@/components/Common'; import { useTimeout } from '@/hooks/common'; +import { useToastActionContext } from '@/hooks/context'; import { useReviewFavoriteMutation } from '@/hooks/queries/review'; import type { Review } from '@/types/review'; import { getRelativeDate } from '@/utils/date'; @@ -18,6 +19,8 @@ const ReviewItem = ({ productId, review }: ReviewItemProps) => { review; const [isFavorite, setIsFavorite] = useState(favorite); const [currentFavoriteCount, setCurrentFavoriteCount] = useState(favoriteCount); + + const { toast } = useToastActionContext(); const { mutate } = useReviewFavoriteMutation(productId, id); const theme = useTheme(); @@ -32,11 +35,11 @@ const ReviewItem = ({ productId, review }: ReviewItemProps) => { }, onError: (error) => { if (error instanceof Error) { - alert(error.message); + toast.error(error.message); return; } - alert('๋ฆฌ๋ทฐ ์ข‹์•„์š”๋ฅผ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); + toast.error('๋ฆฌ๋ทฐ ์ข‹์•„์š”๋ฅผ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); }, } ); diff --git a/frontend/src/components/Review/ReviewRegisterForm/ReviewRegisterForm.tsx b/frontend/src/components/Review/ReviewRegisterForm/ReviewRegisterForm.tsx index 32207d184..6c422c68d 100644 --- a/frontend/src/components/Review/ReviewRegisterForm/ReviewRegisterForm.tsx +++ b/frontend/src/components/Review/ReviewRegisterForm/ReviewRegisterForm.tsx @@ -11,7 +11,7 @@ import { ImageUploader, SvgIcon } from '@/components/Common'; import { ProductOverviewItem } from '@/components/Product'; import { MIN_DISPLAYED_TAGS_LENGTH } from '@/constants'; import { useFormData, useImageUploader, useScroll } from '@/hooks/common'; -import { useReviewFormActionContext, useReviewFormValueContext } from '@/hooks/context'; +import { useReviewFormActionContext, useReviewFormValueContext, useToastActionContext } from '@/hooks/context'; import { useProductDetailQuery } from '@/hooks/queries/product'; import { useReviewRegisterFormMutation } from '@/hooks/queries/review'; import type { ReviewRequest } from '@/types/review'; @@ -29,10 +29,11 @@ interface ReviewRegisterFormProps { const ReviewRegisterForm = ({ productId, targetRef, closeReviewDialog, initTabMenu }: ReviewRegisterFormProps) => { const { scrollToPosition } = useScroll(); - const { previewImage, imageFile, uploadImage, deleteImage } = useImageUploader(); + const { isImageUploading, previewImage, imageFile, uploadImage, deleteImage } = useImageUploader(); const reviewFormValue = useReviewFormValueContext(); const { resetReviewFormValue } = useReviewFormActionContext(); + const { toast } = useToastActionContext(); const { data: productDetail } = useProductDetailQuery(productId); const { mutate, isLoading } = useReviewRegisterFormMutation(productId); @@ -41,7 +42,8 @@ const ReviewRegisterForm = ({ productId, targetRef, closeReviewDialog, initTabMe reviewFormValue.rating > MIN_RATING_SCORE && reviewFormValue.tagIds.length >= MIN_SELECTED_TAGS_COUNT && reviewFormValue.tagIds.length <= MIN_DISPLAYED_TAGS_LENGTH && - reviewFormValue.content.length > MIN_CONTENT_LENGTH; + reviewFormValue.content.length > MIN_CONTENT_LENGTH && + !isImageUploading; const formData = useFormData({ imageKey: 'image', @@ -64,15 +66,16 @@ const ReviewRegisterForm = ({ productId, targetRef, closeReviewDialog, initTabMe resetAndCloseForm(); initTabMenu(); scrollToPosition(targetRef); + toast.success('๐Ÿ“ ๋ฆฌ๋ทฐ๊ฐ€ ๋“ฑ๋ก ๋์–ด์š”'); }, onError: (error) => { resetAndCloseForm(); if (error instanceof Error) { - alert(error.message); + toast.error(error.message); return; } - alert('๋ฆฌ๋ทฐ ๋“ฑ๋ก์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”'); + toast.error('๋ฆฌ๋ทฐ ๋“ฑ๋ก์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”'); }, }); }; diff --git a/frontend/src/components/Review/index.ts b/frontend/src/components/Review/index.ts index 73a7530d9..ac1fa9cd4 100644 --- a/frontend/src/components/Review/index.ts +++ b/frontend/src/components/Review/index.ts @@ -3,3 +3,4 @@ export { default as ReviewList } from './ReviewList/ReviewList'; export { default as ReviewTagItem } from './ReviewTagItem/ReviewTagItem'; export { default as ReviewTagList } from './ReviewTagList/ReviewTagList'; export { default as ReviewRegisterForm } from './ReviewRegisterForm/ReviewRegisterForm'; +export { default as BestReviewItem } from './BestReviewItem/BestReviewItem'; diff --git a/frontend/src/constants/index.ts b/frontend/src/constants/index.ts index 81b964c6c..8865b2802 100644 --- a/frontend/src/constants/index.ts +++ b/frontend/src/constants/index.ts @@ -63,7 +63,13 @@ export const CATEGORY_TYPE = { export const IMAGE_MAX_SIZE = 5 * 1024 * 1024; -export const ENVIRONMENT = window.location.href.includes('dev') ? 'dev' : 'prod'; +export const ENVIRONMENT = window.location.href.includes('dev') + ? 'dev' + : process.env.NODE_ENV === 'production' + ? 'prod' + : 'local'; export const IMAGE_URL = ENVIRONMENT === 'dev' ? process.env.S3_DEV_CLOUDFRONT_PATH : process.env.S3_PROD_CLOUDFRONT_PATH; + +export const PREVIOUS_PATH_LOCAL_STORAGE_KEY = `funeat-previous-path-${ENVIRONMENT}`; diff --git a/frontend/src/constants/path.ts b/frontend/src/constants/path.ts index 6fd8735c8..f729a74b2 100644 --- a/frontend/src/constants/path.ts +++ b/frontend/src/constants/path.ts @@ -4,5 +4,6 @@ export const PATH = { PRODUCT_LIST: '/products', MEMBER: '/members', RECIPE: '/recipes', + REVIEW: '/reviews', LOGIN: '/login', } as const; diff --git a/frontend/src/contexts/ToastContext.tsx b/frontend/src/contexts/ToastContext.tsx new file mode 100644 index 000000000..f14148646 --- /dev/null +++ b/frontend/src/contexts/ToastContext.tsx @@ -0,0 +1,80 @@ +import type { PropsWithChildren } from 'react'; +import { createContext, useState } from 'react'; +import { createPortal } from 'react-dom'; +import styled from 'styled-components'; + +import { Toast } from '@/components/Common'; + +interface ToastState { + id: number; + message: string; + isError?: boolean; +} + +interface ToastValue { + toasts: ToastState[]; +} +interface ToastAction { + toast: { + success: (message: string) => void; + error: (message: string) => void; + }; + deleteToast: (id: number) => void; +} + +export const ToastValueContext = createContext(null); +export const ToastActionContext = createContext(null); + +const ToastProvider = ({ children }: PropsWithChildren) => { + const [toasts, setToasts] = useState([]); + + const showToast = (id: number, message: string, isError?: boolean) => { + setToasts([...toasts, { id, message, isError }]); + }; + + const deleteToast = (id: number) => { + setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id)); + }; + + const toast = { + success: (message: string) => showToast(Number(Date.now()), message), + error: (message: string) => showToast(Number(Date.now()), message, true), + }; + + const toastValue = { + toasts, + }; + + const toastAction = { + toast, + deleteToast, + }; + + return ( + + + {children} + {createPortal( + + {toasts.map(({ id, message, isError }) => ( + + ))} + , + document.getElementById('toast-container') as HTMLElement + )} + + + ); +}; + +export default ToastProvider; + +const ToastContainer = styled.div` + position: fixed; + z-index: 1000; + display: flex; + flex-direction: column; + align-items: center; + width: 100%; + transform: translate(0, -10px); +`; diff --git a/frontend/src/hooks/common/index.ts b/frontend/src/hooks/common/index.ts index 2cbf28c1f..199ae608a 100644 --- a/frontend/src/hooks/common/index.ts +++ b/frontend/src/hooks/common/index.ts @@ -10,4 +10,5 @@ export { default as useTimeout } from './useTimeout'; export { default as useRouteChangeTracker } from './useRouteChangeTracker'; export { default as useTabMenu } from './useTabMenu'; export { default as useScrollRestoration } from './useScrollRestoration'; +export { default as useToast } from './useToast'; export { default as useGA } from './useGA'; diff --git a/frontend/src/hooks/common/useImageUploader.ts b/frontend/src/hooks/common/useImageUploader.ts index c5783ad59..cc093517d 100644 --- a/frontend/src/hooks/common/useImageUploader.ts +++ b/frontend/src/hooks/common/useImageUploader.ts @@ -1,19 +1,50 @@ +import imageCompression from 'browser-image-compression'; import { useState } from 'react'; +import { useToastActionContext } from '../context'; + const isImageFile = (file: File) => file.type !== 'image/png' && file.type !== 'image/jpeg'; +const options = { + maxSizeMB: 1, + maxWidthOrHeight: 1920, + useWebWorker: true, +}; + const useImageUploader = () => { + const { toast } = useToastActionContext(); + const [imageFile, setImageFile] = useState(null); + const [isImageUploading, setIsImageUploading] = useState(false); const [previewImage, setPreviewImage] = useState(''); - const uploadImage = (imageFile: File) => { + const uploadImage = async (imageFile: File) => { if (isImageFile(imageFile)) { - alert('์ด๋ฏธ์ง€ ํŒŒ์ผ๋งŒ ์—…๋กœ๋“œ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.'); + toast.error('์ด๋ฏธ์ง€ ํŒŒ์ผ๋งŒ ์—…๋กœ๋“œ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.'); return; } setPreviewImage(URL.createObjectURL(imageFile)); - setImageFile(imageFile); + + try { + setIsImageUploading(true); + + const compressedFile = await imageCompression(imageFile, options); + const compressedImageFilePromise = imageCompression.getFilefromDataUrl( + await imageCompression.getDataUrlFromFile(compressedFile), + compressedFile.name + ); + compressedImageFilePromise + .then((result) => { + setImageFile(result); + }) + .then(() => { + setIsImageUploading(false); + toast.success('์ด๋ฏธ์ง€๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ๋“ฑ๋ก ๋์Šต๋‹ˆ๋‹ค'); + }); + } catch (error) { + console.log(error); + } }; const deleteImage = () => { @@ -23,6 +54,7 @@ const useImageUploader = () => { }; return { + isImageUploading, previewImage, imageFile, uploadImage, diff --git a/frontend/src/hooks/common/useToast.ts b/frontend/src/hooks/common/useToast.ts new file mode 100644 index 000000000..f95f33ef9 --- /dev/null +++ b/frontend/src/hooks/common/useToast.ts @@ -0,0 +1,37 @@ +import { useEffect, useRef, useState } from 'react'; + +import { useToastActionContext } from '../context'; + +const useToast = (id: number) => { + const { deleteToast } = useToastActionContext(); + const [isShown, setIsShown] = useState(true); + + const showTimeoutRef = useRef(null); + const deleteTimeoutRef = useRef(null); + + useEffect(() => { + showTimeoutRef.current = window.setTimeout(() => setIsShown(false), 2000); + + return () => { + if (showTimeoutRef.current) { + clearTimeout(showTimeoutRef.current); + } + }; + }, []); + + useEffect(() => { + if (!isShown) { + deleteTimeoutRef.current = window.setTimeout(() => deleteToast(id), 2000); + } + + return () => { + if (deleteTimeoutRef.current) { + clearTimeout(deleteTimeoutRef.current); + } + }; + }, [isShown]); + + return isShown; +}; + +export default useToast; diff --git a/frontend/src/hooks/context/index.ts b/frontend/src/hooks/context/index.ts index 56470cfbb..dd03253c9 100644 --- a/frontend/src/hooks/context/index.ts +++ b/frontend/src/hooks/context/index.ts @@ -4,3 +4,5 @@ export { default as useReviewFormActionContext } from './useReviewFormActionCont export { default as useReviewFormValueContext } from './useReviewFormValueContext'; export { default as useRecipeFormActionContext } from './useRecipeFormActionContext'; export { default as useRecipeFormValueContext } from './useRecipeFormValueContext'; +export { default as useToastActionContext } from './useToastActionContext'; +export { default as useToastValueContext } from './useToastValueContext'; diff --git a/frontend/src/hooks/context/useToastActionContext.ts b/frontend/src/hooks/context/useToastActionContext.ts new file mode 100644 index 000000000..e0d7e31a2 --- /dev/null +++ b/frontend/src/hooks/context/useToastActionContext.ts @@ -0,0 +1,14 @@ +import { useContext } from 'react'; + +import { ToastActionContext } from '@/contexts/ToastContext'; + +const useToastActionContext = () => { + const toastAction = useContext(ToastActionContext); + if (toastAction === null || toastAction === undefined) { + throw new Error('useToastActionContext๋Š” Toast Provider ์•ˆ์—์„œ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.'); + } + + return toastAction; +}; + +export default useToastActionContext; diff --git a/frontend/src/hooks/context/useToastValueContext.ts b/frontend/src/hooks/context/useToastValueContext.ts new file mode 100644 index 000000000..ca4b65ca3 --- /dev/null +++ b/frontend/src/hooks/context/useToastValueContext.ts @@ -0,0 +1,14 @@ +import { useContext } from 'react'; + +import { ToastValueContext } from '@/contexts/ToastContext'; + +const useToastValueContext = () => { + const toastValue = useContext(ToastValueContext); + if (toastValue === null || toastValue === undefined) { + throw new Error('useToastValueContext๋Š” Toast Provider ์•ˆ์—์„œ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.'); + } + + return toastValue; +}; + +export default useToastValueContext; diff --git a/frontend/src/hooks/queries/banner/index.ts b/frontend/src/hooks/queries/banner/index.ts new file mode 100644 index 000000000..92fc0eb88 --- /dev/null +++ b/frontend/src/hooks/queries/banner/index.ts @@ -0,0 +1 @@ +export { default as useBannerQuery } from './useBannerQuery'; diff --git a/frontend/src/hooks/queries/banner/useBannerQuery.ts b/frontend/src/hooks/queries/banner/useBannerQuery.ts new file mode 100644 index 000000000..00fc09c42 --- /dev/null +++ b/frontend/src/hooks/queries/banner/useBannerQuery.ts @@ -0,0 +1,16 @@ +import { useSuspendedQuery } from '../useSuspendedQuery'; + +import { bannerApi } from '@/apis'; +import type { Banner } from '@/types/banner'; + +const fetchBanner = async () => { + const response = await bannerApi.get({}); + const data: Banner[] = await response.json(); + return data; +}; + +const useBannerQuery = () => { + return useSuspendedQuery(['banner'], () => fetchBanner()); +}; + +export default useBannerQuery; diff --git a/frontend/src/hooks/queries/members/index.ts b/frontend/src/hooks/queries/members/index.ts index 9e45e5239..cbd6e7468 100644 --- a/frontend/src/hooks/queries/members/index.ts +++ b/frontend/src/hooks/queries/members/index.ts @@ -3,3 +3,4 @@ export { default as useMemberQuery } from './useMemberQuery'; export { default as useInfiniteMemberRecipeQuery } from './useInfiniteMemberRecipeQuery'; export { default as useMemberModifyMutation } from './useMemberModifyMutation'; export { default as useLogoutMutation } from './useLogoutMutation'; +export { default as useDeleteReview } from './useDeleteReview'; diff --git a/frontend/src/hooks/queries/members/useDeleteReview.ts b/frontend/src/hooks/queries/members/useDeleteReview.ts new file mode 100644 index 000000000..a88169bce --- /dev/null +++ b/frontend/src/hooks/queries/members/useDeleteReview.ts @@ -0,0 +1,20 @@ +import { useMutation, useQueryClient } from '@tanstack/react-query'; + +import { memberApi } from '@/apis'; + +const headers = { 'Content-Type': 'application/json' }; + +const deleteReview = async (reviewId: number) => { + return memberApi.delete({ params: `/reviews/${reviewId}`, credentials: true }, headers); +}; + +const useDeleteReview = () => { + const queryClient = useQueryClient(); + + return useMutation({ + mutationFn: (reviewId: number) => deleteReview(reviewId), + onSuccess: () => queryClient.invalidateQueries({ queryKey: ['member', 'review'] }), + }); +}; + +export default useDeleteReview; diff --git a/frontend/src/hooks/queries/members/useLogoutMutation.ts b/frontend/src/hooks/queries/members/useLogoutMutation.ts index 3e586adc7..afc27e2bc 100644 --- a/frontend/src/hooks/queries/members/useLogoutMutation.ts +++ b/frontend/src/hooks/queries/members/useLogoutMutation.ts @@ -3,11 +3,14 @@ import { useNavigate } from 'react-router-dom'; import { logoutApi } from '@/apis'; import { PATH } from '@/constants/path'; +import { useToastActionContext } from '@/hooks/context'; const useLogoutMutation = () => { const navigate = useNavigate(); const queryClient = useQueryClient(); + const { toast } = useToastActionContext(); + return useMutation({ mutationFn: () => logoutApi.post({ credentials: true }), onSuccess: () => { @@ -16,10 +19,10 @@ const useLogoutMutation = () => { }, onError: (error) => { if (error instanceof Error) { - alert(error.message); + toast.error(error.message); return; } - alert('๋กœ๊ทธ์•„์›ƒ์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); + toast.error('๋กœ๊ทธ์•„์›ƒ์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); }, }); }; diff --git a/frontend/src/hooks/queries/product/useInfiniteProductReviewsQuery.ts b/frontend/src/hooks/queries/product/useInfiniteProductReviewsQuery.ts index 0fb4d604b..8142c77e0 100644 --- a/frontend/src/hooks/queries/product/useInfiniteProductReviewsQuery.ts +++ b/frontend/src/hooks/queries/product/useInfiniteProductReviewsQuery.ts @@ -6,7 +6,7 @@ import type { ProductReviewResponse } from '@/types/response'; const fetchProductReviews = async (pageParam: number, productId: number, sort: string) => { const res = await productApi.get({ params: `/${productId}/reviews`, - queries: `?sort=${sort}&page=${pageParam}`, + queries: `?sort=${sort}&lastReviewId=${pageParam}`, credentials: true, }); @@ -20,9 +20,8 @@ const useInfiniteProductReviewsQuery = (productId: number, sort: string) => { ({ pageParam = 0 }) => fetchProductReviews(pageParam, productId, sort), { getNextPageParam: (prevResponse: ProductReviewResponse) => { - const isLast = prevResponse.page.lastPage; - const nextPage = prevResponse.page.requestPage + 1; - return isLast ? undefined : nextPage; + const lastCursor = prevResponse.reviews.length ? prevResponse.reviews[prevResponse.reviews.length - 1].id : 0; + return prevResponse.hasNext ? lastCursor : undefined; }, } ); diff --git a/frontend/src/hooks/queries/product/useInfiniteProductsQuery.ts b/frontend/src/hooks/queries/product/useInfiniteProductsQuery.ts index d8b008126..1b9fdd57f 100644 --- a/frontend/src/hooks/queries/product/useInfiniteProductsQuery.ts +++ b/frontend/src/hooks/queries/product/useInfiniteProductsQuery.ts @@ -6,7 +6,7 @@ import type { CategoryProductResponse } from '@/types/response'; const fetchProducts = async (pageParam: number, categoryId: number, sort = 'reviewCount,desc') => { const res = await categoryApi.get({ params: `/${categoryId}/products`, - queries: `?page=${pageParam}&sort=${sort}`, + queries: `?lastProductId=${pageParam}&sort=${sort}`, }); const data: CategoryProductResponse = await res.json(); @@ -19,9 +19,10 @@ const useInfiniteProductsQuery = (categoryId: number, sort = 'reviewCount,desc') ({ pageParam = 0 }) => fetchProducts(pageParam, categoryId, sort), { getNextPageParam: (prevResponse: CategoryProductResponse) => { - const isLast = prevResponse.page.lastPage; - const nextPage = prevResponse.page.requestPage + 1; - return isLast ? undefined : nextPage; + const lastCursor = prevResponse.products.length + ? prevResponse.products[prevResponse.products.length - 1].id + : 0; + return prevResponse.hasNext ? lastCursor : undefined; }, } ); diff --git a/frontend/src/hooks/queries/rank/index.ts b/frontend/src/hooks/queries/rank/index.ts index 34eacd269..6fd3cd034 100644 --- a/frontend/src/hooks/queries/rank/index.ts +++ b/frontend/src/hooks/queries/rank/index.ts @@ -1,3 +1,4 @@ export { default as useProductRankingQuery } from './useProductRankingQuery'; export { default as useReviewRankingQuery } from './useReviewRankingQuery'; export { default as useRecipeRankingQuery } from './useRecipeRankingQuery'; +export { default as useBestReviewQuery } from './useBestReviewQuery'; diff --git a/frontend/src/hooks/queries/rank/useBestReviewQuery.ts b/frontend/src/hooks/queries/rank/useBestReviewQuery.ts new file mode 100644 index 000000000..5dbd0e902 --- /dev/null +++ b/frontend/src/hooks/queries/rank/useBestReviewQuery.ts @@ -0,0 +1,21 @@ +import { useSuspendedQuery } from '../useSuspendedQuery'; + +import { rankApi } from '@/apis'; +import type { Review } from '@/types/review'; + +const fetchBestReview = async (productId: number) => { + const response = await rankApi.get({ params: `/products/${productId}/reviews` }); + + if (response.status === 204) { + return null; + } + + const data: Review = await response.json(); + return data; +}; + +const useBestReviewQuery = (productId: number) => { + return useSuspendedQuery(['bestReview', productId], () => fetchBestReview(productId)); +}; + +export default useBestReviewQuery; diff --git a/frontend/src/hooks/queries/recipe/index.ts b/frontend/src/hooks/queries/recipe/index.ts index ef871dadd..0cd5db9f6 100644 --- a/frontend/src/hooks/queries/recipe/index.ts +++ b/frontend/src/hooks/queries/recipe/index.ts @@ -2,3 +2,5 @@ export { default as useRecipeDetailQuery } from './useRecipeDetailQuery'; export { default as useRecipeRegisterFormMutation } from './useRecipeRegisterFormMutation'; export { default as useRecipeFavoriteMutation } from './useRecipeFavoriteMutation'; export { default as useInfiniteRecipesQuery } from './useInfiniteRecipesQuery'; +export { default as useInfiniteRecipeCommentQuery } from './useInfiniteRecipeCommentQuery'; +export { default as useRecipeCommentMutation } from './useRecipeCommentMutation'; diff --git a/frontend/src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts b/frontend/src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts new file mode 100644 index 000000000..068520c8a --- /dev/null +++ b/frontend/src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts @@ -0,0 +1,39 @@ +import { useSuspendedInfiniteQuery } from '../useSuspendedInfiniteQuery'; + +import { recipeApi } from '@/apis'; +import type { CommentResponse } from '@/types/response'; + +interface PageParam { + lastId: number; + totalElements: number | null; +} + +const fetchRecipeComments = async (pageParam: PageParam, recipeId: number) => { + const { lastId, totalElements } = pageParam; + const queries = totalElements === null ? '' : `?lastId=${lastId}&totalElements=${totalElements}`; + + const response = await recipeApi.get({ + params: `/${recipeId}/comments`, + queries: queries, + credentials: true, + }); + const data: CommentResponse = await response.json(); + return data; +}; + +const useInfiniteRecipeCommentQuery = (recipeId: number) => { + return useSuspendedInfiniteQuery( + ['recipeComment', recipeId], + ({ pageParam = { lastId: 0, totalElements: null } }) => fetchRecipeComments(pageParam, recipeId), + { + getNextPageParam: (prevResponse: CommentResponse) => { + const lastId = prevResponse.comments.length ? prevResponse.comments[prevResponse.comments.length - 1].id : 0; + const totalElements = prevResponse.totalElements; + const lastCursor = { lastId: lastId, totalElements: totalElements }; + return prevResponse.hasNext ? lastCursor : undefined; + }, + } + ); +}; + +export default useInfiniteRecipeCommentQuery; diff --git a/frontend/src/hooks/queries/recipe/useRecipeCommentMutation.ts b/frontend/src/hooks/queries/recipe/useRecipeCommentMutation.ts new file mode 100644 index 000000000..fc599b15e --- /dev/null +++ b/frontend/src/hooks/queries/recipe/useRecipeCommentMutation.ts @@ -0,0 +1,24 @@ +import { useMutation, useQueryClient } from '@tanstack/react-query'; + +import { recipeApi } from '@/apis'; + +interface RecipeCommentRequestBody { + comment: string; +} + +const headers = { 'Content-Type': 'application/json' }; + +const postRecipeComment = (recipeId: number, body: RecipeCommentRequestBody) => { + return recipeApi.post({ params: `/${recipeId}/comments`, credentials: true }, headers, body); +}; + +const useRecipeCommentMutation = (recipeId: number) => { + const queryClient = useQueryClient(); + + return useMutation({ + mutationFn: (body: RecipeCommentRequestBody) => postRecipeComment(recipeId, body), + onSuccess: () => queryClient.invalidateQueries({ queryKey: ['recipeComment', recipeId] }), + }); +}; + +export default useRecipeCommentMutation; diff --git a/frontend/src/hooks/queries/review/index.ts b/frontend/src/hooks/queries/review/index.ts index e8bb44d4a..78fd628d2 100644 --- a/frontend/src/hooks/queries/review/index.ts +++ b/frontend/src/hooks/queries/review/index.ts @@ -1,3 +1,4 @@ export { default as useReviewTagsQuery } from './useReviewTagsQuery'; export { default as useReviewFavoriteMutation } from './useReviewFavoriteMutation'; export { default as useReviewRegisterFormMutation } from './useReviewRegisterFormMutation'; +export { default as useReviewDetailQuery } from './useReviewDetailQuery'; diff --git a/frontend/src/hooks/queries/review/useReviewDetailQuery.ts b/frontend/src/hooks/queries/review/useReviewDetailQuery.ts new file mode 100644 index 000000000..4b043a93b --- /dev/null +++ b/frontend/src/hooks/queries/review/useReviewDetailQuery.ts @@ -0,0 +1,16 @@ +import { useSuspendedQuery } from '../useSuspendedQuery'; + +import { reviewApi } from '@/apis'; +import type { ReviewDetail } from '@/types/review'; + +const fetchReviewDetail = async (reviewId: number) => { + const response = await reviewApi.get({ params: `/${reviewId}` }); + const data: ReviewDetail = await response.json(); + return data; +}; + +const useReviewDetailQuery = (reviewId: number) => { + return useSuspendedQuery(['review', reviewId, 'detail'], () => fetchReviewDetail(reviewId)); +}; + +export default useReviewDetailQuery; diff --git a/frontend/src/hooks/search/useSearch.ts b/frontend/src/hooks/search/useSearch.ts index 4c438d4ec..ba9853940 100644 --- a/frontend/src/hooks/search/useSearch.ts +++ b/frontend/src/hooks/search/useSearch.ts @@ -3,6 +3,7 @@ import { useRef, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; import { useGA } from '../common'; +import { useToastActionContext } from '../context'; const useSearch = () => { const inputRef = useRef(null); @@ -14,6 +15,8 @@ const useSearch = () => { const [isSubmitted, setIsSubmitted] = useState(!!currentSearchQuery); const [isAutocompleteOpen, setIsAutocompleteOpen] = useState(searchQuery.length > 0); + const { toast } = useToastActionContext(); + const { gaEvent } = useGA(); const focusInput = () => { @@ -35,7 +38,7 @@ const useSearch = () => { const trimmedSearchQuery = searchQuery.trim(); if (!trimmedSearchQuery) { - alert('๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”'); + toast.error('๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”'); focusInput(); resetSearchQuery(); return; diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index 113f22f69..7cb7bc771 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -8,8 +8,9 @@ import { RouterProvider } from 'react-router-dom'; import { SvgSprite } from './components/Common'; import { ENVIRONMENT } from './constants'; +import ToastProvider from './contexts/ToastContext'; import router from './router'; -import GlobalStyle from './styles'; +import GlobalStyle from './styles/globalStyle'; const initializeReactGA = () => { if (process.env.NODE_ENV === 'development') return; @@ -42,7 +43,9 @@ root.render( - ...loading

    } /> + + ...loading

    } /> +
    diff --git a/frontend/src/mocks/browser.ts b/frontend/src/mocks/browser.ts index f7bb4bf35..b0b74505b 100644 --- a/frontend/src/mocks/browser.ts +++ b/frontend/src/mocks/browser.ts @@ -9,6 +9,7 @@ import { recipeHandlers, searchHandlers, logoutHandlers, + bannerHandlers, } from './handlers'; export const worker = setupWorker( @@ -19,5 +20,6 @@ export const worker = setupWorker( ...memberHandlers, ...recipeHandlers, ...searchHandlers, - ...logoutHandlers + ...logoutHandlers, + ...bannerHandlers ); diff --git a/frontend/src/mocks/data/banners.json b/frontend/src/mocks/data/banners.json new file mode 100644 index 000000000..0883f4c22 --- /dev/null +++ b/frontend/src/mocks/data/banners.json @@ -0,0 +1,17 @@ +[ + { + "id": 3, + "link": "https://www.youtube.com/embed/3QlYJ0VY7zg", + "image": "https://i.ytimg.com/vi/3QlYJ0VY7zg/maxresdefault.jpg" + }, + { + "id": 2, + "link": "https://www.youtube.com/embed/3QlYJ0VY7zg", + "image": "https://i.ytimg.com/vi/3QlYJ0VY7zg/maxresdefault.jpg" + }, + { + "id": 1, + "link": "https://www.youtube.com/embed/3QlYJ0VY7zg", + "image": "https://i.ytimg.com/vi/3QlYJ0VY7zg/maxresdefault.jpg" + } +] diff --git a/frontend/src/mocks/data/comments.json b/frontend/src/mocks/data/comments.json new file mode 100644 index 000000000..d2f029c98 --- /dev/null +++ b/frontend/src/mocks/data/comments.json @@ -0,0 +1,33 @@ +{ + "hasNext": false, + "totalElements": 3, + "comments": [ + { + "author": { + "nickname": "ํŽ€์ž‡", + "profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34" + }, + "comment": "์ €๋„ ๋จน์–ด๋ดค๋Š”๋ฐ ๋ง›์žˆ์—ˆ์–ด์š”. ์ €๋„ ๋จน์–ด๋ดค๋Š”๋ฐ ๋ง›์žˆ์—ˆ์–ด์š”. ์ €๋„ ๋จน์–ด๋ดค๋Š”๋ฐ ๋ง›์žˆ์—ˆ์–ด์š”. ์ €๋„ ๋จน์–ด๋ดค๋Š”๋ฐ ๋ง›์žˆ์—ˆ์–ด์š”. ์ €๋„ ๋จน์–ด๋ดค๋Š”๋ฐ ๋ง›์žˆ์—ˆ์–ด์š”. ์ €๋„ ๋จน์–ด๋ดค๋Š”๋ฐ ๋ง›์žˆ์—ˆ์–ด์š”. ", + "createdAt": "2023-08-09T10:10:10", + "id": 1 + }, + { + "author": { + "nickname": "ํŽ€์ž‡", + "profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34" + }, + "comment": "string", + "createdAt": "2023-08-09T10:10:10", + "id": 1 + }, + { + "author": { + "nickname": "ํŽ€์ž‡", + "profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34" + }, + "comment": "string", + "createdAt": "2023-08-09T10:10:10", + "id": 1 + } + ] +} diff --git a/frontend/src/mocks/data/pbProducts.json b/frontend/src/mocks/data/pbProducts.json index 12bad382c..cd4491c33 100644 --- a/frontend/src/mocks/data/pbProducts.json +++ b/frontend/src/mocks/data/pbProducts.json @@ -1,12 +1,5 @@ { - "page": { - "totalDataCount": 99, - "totalPages": 10, - "firstPage": true, - "lastPage": false, - "requestPage": 1, - "requestSize": 10 - }, + "hasNext": false, "products": [ { "id": 11, @@ -44,7 +37,7 @@ "id": 5, "name": "PB ๋ฒ„ํ„ฐ๋ง", "price": 1000, - "image": "https://cdn.pixabay.com/photo/2016/03/23/15/00/ice-cream-1274894_1280.jpg", + "image": "", "averageRating": 4.0, "reviewCount": 100 }, diff --git a/frontend/src/mocks/data/productDetail.json b/frontend/src/mocks/data/productDetail.json index 386c7ae71..2695b51b1 100644 --- a/frontend/src/mocks/data/productDetail.json +++ b/frontend/src/mocks/data/productDetail.json @@ -5,7 +5,6 @@ "image": "https://i.namu.wiki/i/9wnvUaEa1EkDqG-M0Pbwfdf19FJQQXV_-bnlU2SYaNcG05y2wbabiIrfrGES1M4xSgDjY39RwOvLNggDd3Huuw.webp", "content": "ํ• ๋จธ๋‹ˆ๊ฐ€ ๋จน์„ ๊ฑฐ ๊ฐ™์€ ๋ง›์ž…๋‹ˆ๋‹ค.\n1960๋…„ ์ „์Ÿ ๋•Œ ๋ง› ๋ณด๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ๊ทธ๋•Œ๋Š” ๋„ˆ๋ฌด ๊ฐ€๋‚œํ•ด์„œ ๋จน์„ ์ˆ˜ ์—†์—ˆ๋Š”๋ฐ, ๋ง›์žˆ์–ด์š”.", "averageRating": 4.5, - "bookmark": false, "reviewCount": 100, "tags": [ { diff --git a/frontend/src/mocks/data/productDetails.json b/frontend/src/mocks/data/productDetails.json index e3c68dab0..c386ce680 100644 --- a/frontend/src/mocks/data/productDetails.json +++ b/frontend/src/mocks/data/productDetails.json @@ -6,7 +6,6 @@ "image": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34", "content": "ํ• ๋จธ๋‹ˆ๊ฐ€ ๋จน์„ ๊ฑฐ ๊ฐ™์€ ๋ง›์ž…๋‹ˆ๋‹ค.\n1960๋…„ ์ „์Ÿ ๋•Œ ๋ง› ๋ณด๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ๊ทธ๋•Œ๋Š” ๋„ˆ๋ฌด ๊ฐ€๋‚œํ•ด์„œ ๋จน์„ ์ˆ˜ ์—†์—ˆ๋Š”๋ฐ, ๋ง›์žˆ์–ด์š”.", "averageRating": 4.5, - "bookmark": false, "reviewCount": 100, "tags": [ { @@ -33,7 +32,6 @@ "image": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34", "content": "ํ• ๋จธ๋‹ˆ๊ฐ€ ๋จน์„ ๊ฑฐ ๊ฐ™์€ ๋ง›์ž…๋‹ˆ๋‹ค. 1960๋…„ ์ „์Ÿ ๋•Œ ๋ง› ๋ณด๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ๊ทธ๋•Œ๋Š” ๋„ˆ๋ฌด ๊ฐ€๋‚œํ•ด์„œ ๋จน์„ ์ˆ˜ ์—†์—ˆ๋Š”๋ฐ, ๋ง›์žˆ์–ด์š”.", "averageRating": 4.0, - "bookmark": true, "reviewCount": 55, "tags": [ { diff --git a/frontend/src/mocks/data/products.json b/frontend/src/mocks/data/products.json index 8d78d4a97..e68a13fbf 100644 --- a/frontend/src/mocks/data/products.json +++ b/frontend/src/mocks/data/products.json @@ -1,12 +1,5 @@ { - "page": { - "totalDataCount": 99, - "totalPages": 10, - "firstPage": true, - "lastPage": false, - "requestPage": 1, - "requestSize": 10 - }, + "hasNext": false, "products": [ { "id": 1, diff --git a/frontend/src/mocks/data/recipeDetail.json b/frontend/src/mocks/data/recipeDetail.json index 41c5c1fce..a8ba54c3d 100644 --- a/frontend/src/mocks/data/recipeDetail.json +++ b/frontend/src/mocks/data/recipeDetail.json @@ -1,6 +1,6 @@ { "id": 3, - "images": [], + "images": ["https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34"], "title": "์ดˆํŠน๊ธ‰๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ", "content": "๋ง›์žˆ๋Š” ๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ๋ฎ๋ฐฅ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” 1๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  2๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  3๋ฒˆ ๋ง›์žˆ๋Š” ๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ๋ฎ๋ฐฅ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” 1๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  2๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ \n\n 3๋ฒˆ๋ง›์žˆ๋Š” ๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ๋ฎ๋ฐฅ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” 1๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  2๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  3๋ฒˆ๋ง›์žˆ๋Š” ๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ๋ฎ๋ฐฅ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” 1๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  2๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  3๋ฒˆ๋ง›์žˆ๋Š” ๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ๋ฎ๋ฐฅ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” 1๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  2๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  3๋ฒˆ๋ง›์žˆ๋Š” ๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ๋ฎ๋ฐฅ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” 1๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  2๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  3๋ฒˆ๋ง›์žˆ๋Š” ๋ถˆ๋‹ญ์ฝ˜์น˜์ฆˆ๋ฎ๋ฐฅ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” 1๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  2๋ฒˆ. ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ  3๋ฒˆ", "author": { diff --git a/frontend/src/mocks/data/recipeRankingList.json b/frontend/src/mocks/data/recipeRankingList.json index c08391be2..fbb93ff10 100644 --- a/frontend/src/mocks/data/recipeRankingList.json +++ b/frontend/src/mocks/data/recipeRankingList.json @@ -8,7 +8,8 @@ "profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/991f7b69-53bf-4d03-96e1-988c34d010ed", "nickname": "funeat" }, - "favoriteCount": 153 + "favoriteCount": 153, + "createdAt": "2023-08-09T10:10:10" }, { "id": 2, @@ -18,7 +19,8 @@ "profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/991f7b69-53bf-4d03-96e1-988c34d010ed", "nickname": "funeat" }, - "favoriteCount": 153 + "favoriteCount": 153, + "createdAt": "2023-08-09T10:10:10" }, { "id": 3, @@ -28,7 +30,8 @@ "profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/991f7b69-53bf-4d03-96e1-988c34d010ed", "nickname": "funeat" }, - "favoriteCount": 153 + "favoriteCount": 153, + "createdAt": "2023-08-09T10:10:10" } ] } diff --git a/frontend/src/mocks/data/reviewDetail.json b/frontend/src/mocks/data/reviewDetail.json new file mode 100644 index 000000000..9d0bcc097 --- /dev/null +++ b/frontend/src/mocks/data/reviewDetail.json @@ -0,0 +1,27 @@ +{ + "id": 1, + "userName": "ํŽ€์ž‡", + "profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34", + "image": "https://i.namu.wiki/i/9wnvUaEa1EkDqG-M0Pbwfdf19FJQQXV_-bnlU2SYaNcG05y2wbabiIrfrGES1M4xSgDjY39RwOvLNggDd3Huuw.webp", + "rating": 4.5, + "tags": [ + { + "id": 5, + "name": "๋‹จ์ง ๋‹จ์ง ", + "tagType": "TASTE" + }, + { + "id": 1, + "name": "๋ง๊ณ ๋ง๊ณ ", + "tagType": "TASTE" + } + ], + "content": "๋ง›์žˆ์–ด์šฉ~!~!", + "rebuy": true, + "favoriteCount": 1320, + "favorite": true, + "createdAt": "2023-10-13T00:00:00", + "categoryType": "food", + "productId": 1, + "productName": "์น ์„ฑ ์‚ฌ์ด๋‹ค" +} diff --git a/frontend/src/mocks/data/reviewRankingList.json b/frontend/src/mocks/data/reviewRankingList.json index 3a5cc0f73..8f9577454 100644 --- a/frontend/src/mocks/data/reviewRankingList.json +++ b/frontend/src/mocks/data/reviewRankingList.json @@ -7,7 +7,8 @@ "content": "ํ• ๋จธ๋‹ˆ๊ฐ€ ๋จน์„ ๊ฑฐ ๊ฐ™์€ ๋ง›์ž…๋‹ˆ๋‹ค. 1960๋…„ ์ „์Ÿ ๋•Œ ๋ง› ๋ณด๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ๊ทธ๋•Œ๋Š” ๋„ˆ๋ฌด ๊ฐ€๋‚œํ•ด์„œ ๋จน์„ ์ˆ˜ ์—†์—ˆ๋Š”๋ฐ์š” ์ด๊ฒƒ๋ณด๋‹ค ๊ธด ๋ฆฌ๋ทฐ๋„ ์ž˜๋ ค ๋ณด์ธ๋‹ต๋‹ˆ๋‹ค", "rating": 4.0, "favoriteCount": 1256, - "categoryType": "food" + "categoryType": "food", + "createdAt": "2023-08-09T10:10:10" }, { "reviewId": 1, @@ -16,7 +17,8 @@ "content": "ํ•˜์–€ ์งœํŒŒ๊ฒŒํ‹ฐ๋ผ๋‹ˆ ๋ง์ด ์•ˆ๋œ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์—ˆ์ฃ . ์‹ค์ œ๋กœ ๋ง›์„ ๋ณด๋‹ˆ๊นŒ ๊นŒ๋งŒ ์งœํŒŒ๊ฒŒํ‹ฐ๋ž‘ ๋ง›์ด ๋ญ”๊ฐ€ ๋‹ค๋ฅผ๊ฒŒ ์—†๋„ค์š”.", "rating": 4.4, "favoriteCount": 870, - "categoryType": "food" + "categoryType": "food", + "createdAt": "2023-08-09T10:10:10" } ] } diff --git a/frontend/src/mocks/data/reviews.json b/frontend/src/mocks/data/reviews.json index 54b9719ce..5f9d129ee 100644 --- a/frontend/src/mocks/data/reviews.json +++ b/frontend/src/mocks/data/reviews.json @@ -1,12 +1,5 @@ { - "page": { - "totalDataCount": 99, - "totalPages": 10, - "firstPage": true, - "lastPage": false, - "requestPage": 1, - "requestSize": 10 - }, + "hasNext": false, "reviews": [ { "id": 1, diff --git a/frontend/src/mocks/handlers/bannerHandlers.ts b/frontend/src/mocks/handlers/bannerHandlers.ts new file mode 100644 index 000000000..20bf92f77 --- /dev/null +++ b/frontend/src/mocks/handlers/bannerHandlers.ts @@ -0,0 +1,9 @@ +import { rest } from 'msw'; + +import banners from '../data/banners.json'; + +export const bannerHandlers = [ + rest.get('/api/banners', (req, res, ctx) => { + return res(ctx.status(200), ctx.json(banners)); + }), +]; diff --git a/frontend/src/mocks/handlers/index.ts b/frontend/src/mocks/handlers/index.ts index c255590ef..b8c5b8b38 100644 --- a/frontend/src/mocks/handlers/index.ts +++ b/frontend/src/mocks/handlers/index.ts @@ -6,3 +6,4 @@ export * from './memberHandlers'; export * from './recipeHandlers'; export * from './searchHandlers'; export * from './logoutHandlers'; +export * from './bannerHandlers'; diff --git a/frontend/src/mocks/handlers/memberHandlers.ts b/frontend/src/mocks/handlers/memberHandlers.ts index 2abb3d7fb..31ee93536 100644 --- a/frontend/src/mocks/handlers/memberHandlers.ts +++ b/frontend/src/mocks/handlers/memberHandlers.ts @@ -55,4 +55,8 @@ export const memberHandlers = [ return res(ctx.status(200), ctx.json(mockMemberRecipes)); }), + + rest.delete('/api/members/reviews/:reviewId', (req, res, ctx) => { + return res(ctx.status(204)); + }), ]; diff --git a/frontend/src/mocks/handlers/productHandlers.ts b/frontend/src/mocks/handlers/productHandlers.ts index bc230c1fa..32f3feadc 100644 --- a/frontend/src/mocks/handlers/productHandlers.ts +++ b/frontend/src/mocks/handlers/productHandlers.ts @@ -25,7 +25,6 @@ export const productHandlers = [ rest.get('/api/categories/:categoryId/products', (req, res, ctx) => { const sortOptions = req.url.searchParams.get('sort'); const categoryId = req.params.categoryId; - const page = Number(req.url.searchParams.get('page')); if (sortOptions === null) { return res(ctx.status(400)); @@ -37,7 +36,7 @@ export const productHandlers = [ let products = commonProducts; - if (Number(categoryId) >= 7 && Number(categoryId) <= 9) { + if (Number(categoryId) >= 6 && Number(categoryId) <= 9) { products = pbProducts; } @@ -53,11 +52,7 @@ export const productHandlers = [ sortOrder === 'asc' ? cur[key] - next[key] : next[key] - cur[key] ), }; - return res( - ctx.status(200), - ctx.json({ page: sortedProducts.page, products: products.products.slice(page * 10, (page + 1) * 10) }), - ctx.delay(500) - ); + return res(ctx.status(200), ctx.json(sortedProducts), ctx.delay(500)); }), rest.get('/api/products/:productId', (req, res, ctx) => { diff --git a/frontend/src/mocks/handlers/rankingHandlers.ts b/frontend/src/mocks/handlers/rankingHandlers.ts index 2c4ea7fd9..869f7d969 100644 --- a/frontend/src/mocks/handlers/rankingHandlers.ts +++ b/frontend/src/mocks/handlers/rankingHandlers.ts @@ -3,6 +3,7 @@ import { rest } from 'msw'; import mockProductRankingList from '../data/productRankingList.json'; import mockRecipeRankingList from '../data/recipeRankingList.json'; import mockReviewRankingList from '../data/reviewRankingList.json'; +import mockReviewList from '../data/reviews.json'; export const rankingHandlers = [ rest.get('/api/ranks/products', (req, res, ctx) => { @@ -16,4 +17,8 @@ export const rankingHandlers = [ rest.get('/api/ranks/recipes', (req, res, ctx) => { return res(ctx.status(200), ctx.json(mockRecipeRankingList), ctx.delay(1000)); }), + + rest.get('/api/ranks/products/:productId/reviews', (req, res, ctx) => { + return res(ctx.status(200), ctx.json(mockReviewList.reviews[2])); + }), ]; diff --git a/frontend/src/mocks/handlers/recipeHandlers.ts b/frontend/src/mocks/handlers/recipeHandlers.ts index 0a37b22f0..fff47a879 100644 --- a/frontend/src/mocks/handlers/recipeHandlers.ts +++ b/frontend/src/mocks/handlers/recipeHandlers.ts @@ -1,11 +1,18 @@ import { rest } from 'msw'; import { isRecipeSortOption, isSortOrder } from './utils'; +import comments from '../data/comments.json'; import recipeDetail from '../data/recipeDetail.json'; import mockRecipes from '../data/recipes.json'; export const recipeHandlers = [ rest.get('/api/recipes/:recipeId', (req, res, ctx) => { + const { mockSessionId } = req.cookies; + + if (!mockSessionId) { + return res(ctx.status(401)); + } + return res(ctx.status(200), ctx.json(recipeDetail), ctx.delay(1000)); }), @@ -88,4 +95,12 @@ export const recipeHandlers = [ ctx.json({ ...sortedRecipes, recipes: sortedRecipes.recipes.slice(page * 5, (page + 1) * 5) }) ); }), + + rest.get('/api/recipes/:recipeId/comments', (req, res, ctx) => { + return res(ctx.status(200), ctx.json(comments)); + }), + + rest.post('/api/recipes/:recipeId/comments', (req, res, ctx) => { + return res(ctx.status(201)); + }), ]; diff --git a/frontend/src/mocks/handlers/reviewHandlers.ts b/frontend/src/mocks/handlers/reviewHandlers.ts index 455714f52..656891e55 100644 --- a/frontend/src/mocks/handlers/reviewHandlers.ts +++ b/frontend/src/mocks/handlers/reviewHandlers.ts @@ -1,6 +1,7 @@ import { rest } from 'msw'; import { isReviewSortOption, isSortOrder } from './utils'; +import mockReviewDetail from '../data/reviewDetail.json'; import mockReviewRanking from '../data/reviewRankingList.json'; import mockReviews from '../data/reviews.json'; import mockReviewTags from '../data/reviewTagList.json'; @@ -41,7 +42,7 @@ export const reviewHandlers = [ return res( ctx.status(200), - ctx.json({ page: sortedReviews.page, reviews: sortedReviews.reviews }), + ctx.json({ hasNext: sortedReviews.hasNext, reviews: sortedReviews.reviews }), ctx.delay(1000) ); }), @@ -73,4 +74,8 @@ export const reviewHandlers = [ rest.get('/api/tags', (_, res, ctx) => { return res(ctx.status(200), ctx.json(mockReviewTags)); }), + + rest.get('/api/reviews/:reviewId', (_, res, ctx) => { + return res(ctx.status(200), ctx.json(mockReviewDetail)); + }), ]; diff --git a/frontend/src/pages/AuthPage.tsx b/frontend/src/pages/AuthPage.tsx index a840cb978..9f7974e45 100644 --- a/frontend/src/pages/AuthPage.tsx +++ b/frontend/src/pages/AuthPage.tsx @@ -2,8 +2,10 @@ import { useEffect, useState } from 'react'; import { Navigate, useNavigate, useParams, useSearchParams } from 'react-router-dom'; import { loginApi } from '@/apis'; +import { PREVIOUS_PATH_LOCAL_STORAGE_KEY } from '@/constants'; import { PATH } from '@/constants/path'; import { useMemberQuery } from '@/hooks/queries/members'; +import { getLocalStorage, removeLocalStorage } from '@/utils/localStorage'; export const AuthPage = () => { const { authProvider } = useParams(); @@ -14,10 +16,6 @@ export const AuthPage = () => { const [location, setLocation] = useState(''); const navigate = useNavigate(); - if (member) { - return ; - } - const getSessionId = async () => { const response = await loginApi.get({ params: `/oauth2/code/${authProvider}`, @@ -51,9 +49,17 @@ export const AuthPage = () => { return; } + const previousPath = getLocalStorage(PREVIOUS_PATH_LOCAL_STORAGE_KEY); + const redirectLocation = previousPath ? previousPath : location; + + navigate(redirectLocation, { replace: true }); + removeLocalStorage(PREVIOUS_PATH_LOCAL_STORAGE_KEY); refetchMember(); - navigate(location, { replace: true }); }, [location]); + if (member) { + return ; + } + return <>; }; diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx index 436b893ec..d48e4a255 100644 --- a/frontend/src/pages/HomePage.tsx +++ b/frontend/src/pages/HomePage.tsx @@ -1,15 +1,23 @@ -import { Heading, Spacing } from '@fun-eat/design-system'; +import { Heading, Spacing, Text, useTheme } from '@fun-eat/design-system'; import { useQueryErrorResetBoundary } from '@tanstack/react-query'; import { Suspense } from 'react'; import styled from 'styled-components'; -import { Loading, ErrorBoundary, ErrorComponent, CategoryFoodList, CategoryStoreList } from '@/components/Common'; +import { + Loading, + ErrorBoundary, + ErrorComponent, + CategoryFoodList, + CategoryStoreList, + SvgIcon, + Banner, +} from '@/components/Common'; import { ProductRankingList, ReviewRankingList, RecipeRankingList } from '@/components/Rank'; -import { IMAGE_URL } from '@/constants'; import channelTalk from '@/service/channelTalk'; export const HomePage = () => { const { reset } = useQueryErrorResetBoundary(); + const theme = useTheme(); channelTalk.loadScript(); @@ -20,7 +28,7 @@ export const HomePage = () => { return ( <>
    - +
    @@ -41,7 +49,12 @@ export const HomePage = () => { ๐Ÿฏ ๊ฟ€์กฐํ•ฉ ๋žญํ‚น - + + + + ๊ฟ€์กฐํ•ฉ ๋žญํ‚น์€ ์ž์ฒด ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ธฐ๋ฐ˜์œผ๋กœ ์—…๋ฐ์ดํŠธ๋ฉ๋‹ˆ๋‹ค. + + }> @@ -51,9 +64,14 @@ export const HomePage = () => { - ๐Ÿ‘‘ ์ƒํ’ˆ ๋žญํ‚น + ๐Ÿ™ ์ƒํ’ˆ ๋žญํ‚น - + + + + ์ƒํ’ˆ ๋žญํ‚น์€ 2์ฃผ ๋‹จ์œ„๋กœ ์—…๋ฐ์ดํŠธ๋ฉ๋‹ˆ๋‹ค. + + }> @@ -65,7 +83,12 @@ export const HomePage = () => { ๐Ÿ“ ๋ฆฌ๋ทฐ ๋žญํ‚น - + + + + ๋ฆฌ๋ทฐ ๋žญํ‚น์€ ์ž์ฒด ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ธฐ๋ฐ˜์œผ๋กœ ์—…๋ฐ์ดํŠธ๋ฉ๋‹ˆ๋‹ค. + + }> @@ -77,11 +100,6 @@ export const HomePage = () => { ); }; -const Banner = styled.img` - width: 100%; - height: auto; -`; - const SectionWrapper = styled.section` padding: 0 20px; `; @@ -100,3 +118,14 @@ const CategoryListWrapper = styled.div` display: none; } `; + +const RankingInfoWrapper = styled.div` + display: flex; + align-items: center; + gap: 2px; + margin: 8px 0 16px; + + & > svg { + padding-bottom: 2px; + } +`; diff --git a/frontend/src/pages/MemberModifyPage.tsx b/frontend/src/pages/MemberModifyPage.tsx index c6c43a8c3..6b3031a9e 100644 --- a/frontend/src/pages/MemberModifyPage.tsx +++ b/frontend/src/pages/MemberModifyPage.tsx @@ -8,6 +8,7 @@ import { SectionTitle, SvgIcon } from '@/components/Common'; import { MemberModifyInput } from '@/components/Members'; import { IMAGE_MAX_SIZE } from '@/constants'; import { useFormData, useImageUploader } from '@/hooks/common'; +import { useToastActionContext } from '@/hooks/context'; import { useMemberModifyMutation, useMemberQuery } from '@/hooks/queries/members'; import type { MemberRequest } from '@/types/member'; @@ -16,6 +17,7 @@ export const MemberModifyPage = () => { const { mutate } = useMemberModifyMutation(); const { previewImage, imageFile, uploadImage } = useImageUploader(); + const { toast } = useToastActionContext(); const [nickname, setNickname] = useState(member?.nickname ?? ''); const navigate = useNavigate(); @@ -43,7 +45,7 @@ export const MemberModifyPage = () => { const imageFile = event.target.files[0]; if (imageFile.size > IMAGE_MAX_SIZE) { - alert('์ด๋ฏธ์ง€ ํฌ๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์ปค์š”. 5MB ์ดํ•˜์˜ ์ด๋ฏธ์ง€๋ฅผ ๊ณจ๋ผ์ฃผ์„ธ์š”.'); + toast.error('์ด๋ฏธ์ง€ ํฌ๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์ปค์š”. 5MB ์ดํ•˜์˜ ์ด๋ฏธ์ง€๋ฅผ ๊ณจ๋ผ์ฃผ์„ธ์š”.'); event.target.value = ''; return; } @@ -60,11 +62,11 @@ export const MemberModifyPage = () => { }, onError: (error) => { if (error instanceof Error) { - alert(error.message); + toast.error(error.message); return; } - alert('ํšŒ์›์ •๋ณด ์ˆ˜์ •์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); + toast.error('ํšŒ์›์ •๋ณด ์ˆ˜์ •์„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.'); }, }); }; diff --git a/frontend/src/pages/MemberPage.tsx b/frontend/src/pages/MemberPage.tsx index 7026e4768..58aa6d8e4 100644 --- a/frontend/src/pages/MemberPage.tsx +++ b/frontend/src/pages/MemberPage.tsx @@ -20,14 +20,14 @@ export const MemberPage = () => { }> - + }> - + diff --git a/frontend/src/pages/ProductDetailPage.tsx b/frontend/src/pages/ProductDetailPage.tsx index 46cc74b18..5b6bbca20 100644 --- a/frontend/src/pages/ProductDetailPage.tsx +++ b/frontend/src/pages/ProductDetailPage.tsx @@ -1,7 +1,7 @@ -import { BottomSheet, Spacing, useBottomSheet, Text, Link } from '@fun-eat/design-system'; +import { BottomSheet, Spacing, useBottomSheet, Text, Button } from '@fun-eat/design-system'; import { useQueryErrorResetBoundary } from '@tanstack/react-query'; import { useState, useRef, Suspense } from 'react'; -import { useParams, Link as RouterLink } from 'react-router-dom'; +import { useParams, useLocation, useNavigate } from 'react-router-dom'; import styled from 'styled-components'; import { @@ -16,13 +16,14 @@ import { SectionTitle, } from '@/components/Common'; import { ProductDetailItem, ProductRecipeList } from '@/components/Product'; -import { ReviewList, ReviewRegisterForm } from '@/components/Review'; -import { RECIPE_SORT_OPTIONS, REVIEW_SORT_OPTIONS } from '@/constants'; +import { BestReviewItem, ReviewList, ReviewRegisterForm } from '@/components/Review'; +import { PREVIOUS_PATH_LOCAL_STORAGE_KEY, RECIPE_SORT_OPTIONS, REVIEW_SORT_OPTIONS } from '@/constants'; import { PATH } from '@/constants/path'; import ReviewFormProvider from '@/contexts/ReviewFormContext'; import { useGA, useSortOption, useTabMenu } from '@/hooks/common'; import { useMemberQuery } from '@/hooks/queries/members'; import { useProductDetailQuery } from '@/hooks/queries/product'; +import { setLocalStorage } from '@/utils/localStorage'; const LOGIN_ERROR_MESSAGE_REVIEW = '๋กœ๊ทธ์ธ ํ›„ ์ƒํ’ˆ ๋ฆฌ๋ทฐ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์–ด์š”.\nํŽ€์ž‡์— ๊ฐ€์ž…ํ•˜๊ณ  ํŽธ์˜์  ์ƒํ’ˆ ๋ฆฌ๋ทฐ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š” ๐Ÿ˜Š'; @@ -31,25 +32,29 @@ const LOGIN_ERROR_MESSAGE_RECIPE = export const ProductDetailPage = () => { const { category, productId } = useParams(); + const { pathname } = useLocation(); + const navigate = useNavigate(); + const { data: member } = useMemberQuery(); const { data: productDetail } = useProductDetailQuery(Number(productId)); + const { reset } = useQueryErrorResetBoundary(); const { selectedTabMenu, isFirstTabMenu: isReviewTab, handleTabMenuClick, initTabMenu } = useTabMenu(); const tabRef = useRef(null); const { selectedOption, selectSortOption } = useSortOption(REVIEW_SORT_OPTIONS[0]); - const { ref, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); + const { isOpen, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); const [activeSheet, setActiveSheet] = useState<'registerReview' | 'sortOption'>('sortOption'); const { gaEvent } = useGA(); const productDetailPageRef = useRef(null); - if (!category) { + if (!category || !productId) { return null; } - const { name, bookmark, reviewCount } = productDetail; + const { name, reviewCount } = productDetail; const tabMenus = [`๋ฆฌ๋ทฐ ${reviewCount}`, '๊ฟ€์กฐํ•ฉ']; const sortOptions = isReviewTab ? REVIEW_SORT_OPTIONS : RECIPE_SORT_OPTIONS; @@ -72,11 +77,18 @@ export const ProductDetailPage = () => { selectSortOption(currentSortOption); }; + const handleLoginButtonClick = () => { + setLocalStorage(PREVIOUS_PATH_LOCAL_STORAGE_KEY, pathname); + navigate(PATH.LOGIN); + }; + return ( - + + + { {isReviewTab ? LOGIN_ERROR_MESSAGE_REVIEW : LOGIN_ERROR_MESSAGE_RECIPE} - + ๋กœ๊ทธ์ธํ•˜๋Ÿฌ ๊ฐ€๊ธฐ - + )} @@ -118,7 +136,7 @@ export const ProductDetailPage = () => { /> - + {activeSheet === 'registerReview' ? ( theme.colors.gray4}; - border-radius: 8px; `; const ReviewRegisterButtonWrapper = styled.div` diff --git a/frontend/src/pages/ProductListPage.tsx b/frontend/src/pages/ProductListPage.tsx index 11cf6231b..adaaeff1c 100644 --- a/frontend/src/pages/ProductListPage.tsx +++ b/frontend/src/pages/ProductListPage.tsx @@ -28,7 +28,7 @@ export const ProductListPage = () => { const { category } = useParams(); const productListRef = useRef(null); - const { ref, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); + const { isOpen, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); const { selectedOption, selectSortOption } = useSortOption(PRODUCT_SORT_OPTIONS[0]); const { reset } = useQueryErrorResetBoundary(); const { gaEvent } = useGA(); @@ -68,7 +68,7 @@ export const ProductListPage = () => { - + { const { recipeId } = useParams(); + const scrollTargetRef = useRef(null); + const { data: recipeDetail } = useRecipeDetailQuery(Number(recipeId)); + const { reset } = useQueryErrorResetBoundary(); + const { id, images, title, content, author, products, totalPrice, favoriteCount, favorite, createdAt } = recipeDetail; return ( - + <> {images.length > 0 ? ( @@ -65,23 +71,38 @@ export const RecipeDetailPage = () => { {content} - - + + + + + }> +
    + +
    +
    +
    + + + + ); }; -const RecipeDetailPageContainer = styled.div` - padding: 20px 20px 0; -`; - const RecipeImageContainer = styled.ul` display: flex; flex-direction: column; gap: 20px; align-items: center; + + & > li { + width: 312px; + margin: 0 auto; + } `; const RecipeImage = styled.img` + width: 100%; + height: auto; border-radius: 10px; object-fit: cover; `; diff --git a/frontend/src/pages/RecipePage.tsx b/frontend/src/pages/RecipePage.tsx index fe7dc1a36..fb7899a1b 100644 --- a/frontend/src/pages/RecipePage.tsx +++ b/frontend/src/pages/RecipePage.tsx @@ -1,7 +1,7 @@ import { BottomSheet, Heading, Link, Spacing, useBottomSheet } from '@fun-eat/design-system'; import { useQueryErrorResetBoundary } from '@tanstack/react-query'; -import { Suspense, useRef, useState } from 'react'; -import { Link as RouterLink } from 'react-router-dom'; +import { Suspense, useEffect, useRef, useState } from 'react'; +import { Link as RouterLink, useLocation } from 'react-router-dom'; import styled from 'styled-components'; import { @@ -15,10 +15,11 @@ import { SvgIcon, } from '@/components/Common'; import { RecipeList, RecipeRegisterForm } from '@/components/Recipe'; -import { RECIPE_SORT_OPTIONS } from '@/constants'; +import { PREVIOUS_PATH_LOCAL_STORAGE_KEY, RECIPE_SORT_OPTIONS } from '@/constants'; import { PATH } from '@/constants/path'; import RecipeFormProvider from '@/contexts/RecipeFormContext'; import { useGA, useSortOption } from '@/hooks/common'; +import { setLocalStorage } from '@/utils/localStorage'; const RECIPE_PAGE_TITLE = '๐Ÿฏ ๊ฟ€์กฐํ•ฉ'; const REGISTER_RECIPE = '๊ฟ€์กฐํ•ฉ ์ž‘์„ฑํ•˜๊ธฐ'; @@ -27,12 +28,17 @@ const REGISTER_RECIPE_AFTER_LOGIN = '๋กœ๊ทธ์ธ ํ›„ ๊ฟ€์กฐํ•ฉ์„ ์ž‘์„ฑํ•  ์ˆ˜ export const RecipePage = () => { const [activeSheet, setActiveSheet] = useState<'registerRecipe' | 'sortOption'>('sortOption'); const { selectedOption, selectSortOption } = useSortOption(RECIPE_SORT_OPTIONS[0]); - const { ref, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); + const { isOpen, isClosing, handleOpenBottomSheet, handleCloseBottomSheet } = useBottomSheet(); const { reset } = useQueryErrorResetBoundary(); const { gaEvent } = useGA(); + const { pathname } = useLocation(); const recipeRef = useRef(null); + useEffect(() => { + setLocalStorage(PREVIOUS_PATH_LOCAL_STORAGE_KEY, pathname); + }, []); + const handleOpenRegisterRecipeSheet = () => { setActiveSheet('registerRecipe'); handleOpenBottomSheet(); @@ -72,7 +78,7 @@ export const RecipePage = () => { /> - + {activeSheet === 'sortOption' ? ( { + const { reviewId } = useParams(); + const { data: reviewDetail } = useReviewDetailQuery(Number(reviewId)); + + const { + productName, + categoryType, + productId, + profileImage, + userName, + rating, + createdAt, + rebuy, + image, + tags, + content, + favoriteCount, + } = reviewDetail; + + const theme = useTheme(); + + return ( + + + + + + + +
    + {userName} + + {Array.from({ length: 5 }, (_, index) => ( + + ))} + + {getRelativeDate(createdAt)} + + +
    +
    + {rebuy && ( + + ๐Ÿ˜ ๋˜ ์‚ด๋ž˜์š” + + )} +
    + {image && } + + {content} + + + + {favoriteCount} + + +
    +
    + ); +}; + +const ReviewDetailPageContainer = styled.div` + padding: 20px 20px 0; +`; + +const ReviewItemContainer = styled.div` + display: flex; + flex-direction: column; + row-gap: 20px; +`; + +const ReviewerWrapper = styled.div` + display: flex; + justify-content: space-between; + align-items: center; +`; + +const ReviewerInfoWrapper = styled.div` + display: flex; + align-items: center; + column-gap: 10px; +`; + +const RebuyBadge = styled(Badge)` + font-weight: ${({ theme }) => theme.fontWeights.bold}; +`; + +const ReviewerImage = styled.img` + border: 2px solid ${({ theme }) => theme.colors.primary}; + border-radius: 50%; + object-fit: cover; +`; + +const RatingIconWrapper = styled.div` + display: flex; + align-items: center; + margin-left: -2px; + + & > span { + margin-left: 12px; + } +`; + +const ReviewImage = styled.img` + align-self: center; +`; + +const ReviewContent = styled(Text)` + white-space: pre-wrap; +`; + +const FavoriteWrapper = styled.div` + display: flex; + align-items: center; + padding: 0; + column-gap: 8px; +`; diff --git a/frontend/src/router/index.tsx b/frontend/src/router/index.tsx index 0103d0fc7..9f39193e0 100644 --- a/frontend/src/router/index.tsx +++ b/frontend/src/router/index.tsx @@ -1,4 +1,4 @@ -import { createBrowserRouter } from 'react-router-dom'; +import { Navigate, createBrowserRouter } from 'react-router-dom'; import App from './App'; @@ -8,6 +8,7 @@ import CategoryProvider from '@/contexts/CategoryContext'; import NotFoundPage from '@/pages/NotFoundPage'; const router = createBrowserRouter([ + /** ๋กœ๊ทธ์ธ์ด ์•ˆ๋˜์—ˆ๋‹ค๋ฉด ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ */ { path: '/', element: ( @@ -15,17 +16,8 @@ const router = createBrowserRouter([ ), - errorElement: , + errorElement: , children: [ - { - path: `${PATH.RECIPE}/:recipeId`, - async lazy() { - const { RecipeDetailPage } = await import( - /* webpackChunkName: "RecipeDetailPage" */ '@/pages/RecipeDetailPage' - ); - return { Component: RecipeDetailPage }; - }, - }, { path: PATH.MEMBER, async lazy() { @@ -62,6 +54,28 @@ const router = createBrowserRouter([ }, ], }, + /** ๋กœ๊ทธ์ธ์ด ์•ˆ๋˜์—ˆ๋‹ค๋ฉด ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธํ•˜๋ฉด์„œ ํ—ค๋”๋งŒ ์žˆ๋Š” ๋ ˆ์ด์•„์›ƒ */ + { + path: '/', + element: ( + + + + ), + errorElement: , + children: [ + { + path: `${PATH.RECIPE}/:recipeId`, + async lazy() { + const { RecipeDetailPage } = await import( + /* webpackChunkName: "RecipeDetailPage" */ '@/pages/RecipeDetailPage' + ); + return { Component: RecipeDetailPage }; + }, + }, + ], + }, + /** ํ—ค๋”์™€ ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐ”๊ฐ€ ์žˆ๋Š” ๊ธฐ๋ณธ ๋ ˆ์ด์•„์›ƒ */ { path: '/', element: ( @@ -78,8 +92,18 @@ const router = createBrowserRouter([ return { Component: HomePage }; }, }, + { + path: `${PATH.REVIEW}/:reviewId`, + async lazy() { + const { ReviewDetailPage } = await import( + /* webpackChunkName: "ReviewDetailPage" */ '@/pages/ReviewDetailPage' + ); + return { Component: ReviewDetailPage }; + }, + }, ], }, + /** ํ—ค๋”, ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ชจ๋‘ ์—†๋Š” ๋ ˆ์ด์•„์›ƒ */ { path: '/', element: , @@ -101,6 +125,7 @@ const router = createBrowserRouter([ }, ], }, + /** ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐ” ์—†์ด ํ—ค๋”๋งŒ ์žˆ๋Š” ๋ ˆ์ด์•„์›ƒ */ { path: '/', element: ( @@ -121,6 +146,7 @@ const router = createBrowserRouter([ }, ], }, + /** ๋„ค๋น„๊ฒŒ์ด์…˜๊ณผ ํ—ค๋”(๊ฒ€์ƒ‰ ์•„์ด์ฝ˜์ด ์—†๋Š”)๊ฐ€ ์žˆ๋Š” ๋ ˆ์ด์•„์›ƒ */ { path: '/', element: ( diff --git a/frontend/src/styles/animations.ts b/frontend/src/styles/animations.ts new file mode 100644 index 000000000..aff72c3d4 --- /dev/null +++ b/frontend/src/styles/animations.ts @@ -0,0 +1,23 @@ +import { keyframes } from 'styled-components'; + +export const slideIn = keyframes` + 0% { + transform: translateY(-100px); + } + + 100% { + transform: translateY(70px); + } +`; + +export const fadeOut = keyframes` + 0% { + transform: translateY(70px); + opacity: 1; + } + + 100% { + transform: translateY(70px); + opacity:0; + } +`; diff --git a/frontend/src/styles/index.ts b/frontend/src/styles/globalStyle.ts similarity index 100% rename from frontend/src/styles/index.ts rename to frontend/src/styles/globalStyle.ts diff --git a/frontend/src/types/banner.ts b/frontend/src/types/banner.ts new file mode 100644 index 000000000..ae3ebad74 --- /dev/null +++ b/frontend/src/types/banner.ts @@ -0,0 +1,5 @@ +export interface Banner { + id: number; + link: string; + image: string; +} diff --git a/frontend/src/types/product.ts b/frontend/src/types/product.ts index 391cb103d..b3389a32f 100644 --- a/frontend/src/types/product.ts +++ b/frontend/src/types/product.ts @@ -17,7 +17,6 @@ export interface ProductDetail { content: string; averageRating: number; reviewCount: number; - bookmark: boolean; tags: Tag[]; } diff --git a/frontend/src/types/ranking.ts b/frontend/src/types/ranking.ts index 9f0707f68..42cfe29ca 100644 --- a/frontend/src/types/ranking.ts +++ b/frontend/src/types/ranking.ts @@ -1,3 +1,4 @@ +import type { CategoryVariant } from './common'; import type { Member } from './member'; import type { Product } from './product'; @@ -10,7 +11,8 @@ export interface ReviewRanking { content: string; rating: number; favoriteCount: number; - categoryType: string; + categoryType: CategoryVariant; + createdAt: string; } export interface RecipeRanking { @@ -19,4 +21,5 @@ export interface RecipeRanking { title: string; author: Member; favoriteCount: number; + createdAt: string; } diff --git a/frontend/src/types/recipe.ts b/frontend/src/types/recipe.ts index 3fec2ba91..da336d7b5 100644 --- a/frontend/src/types/recipe.ts +++ b/frontend/src/types/recipe.ts @@ -39,3 +39,10 @@ export interface RecipeFavoriteRequestBody { type RecipeProductWithPrice = Pick; export type RecipeProduct = Omit; + +export interface Comment { + id: number; + author: Member; + comment: string; + createdAt: string; +} diff --git a/frontend/src/types/response.ts b/frontend/src/types/response.ts index 7ab144bc0..b2935328a 100644 --- a/frontend/src/types/response.ts +++ b/frontend/src/types/response.ts @@ -1,7 +1,7 @@ import type { Product } from './product'; import type { ProductRanking, RecipeRanking, ReviewRanking } from './ranking'; -import type { MemberRecipe, Recipe } from './recipe'; -import type { Review } from './review'; +import type { Comment, MemberRecipe, Recipe } from './recipe'; +import type { Review, ReviewDetail } from './review'; import type { ProductSearchResult, ProductSearchAutocomplete } from './search'; export interface Page { @@ -14,11 +14,11 @@ export interface Page { } export interface CategoryProductResponse { - page: Page; + hasNext: boolean; products: Product[]; } export interface ProductReviewResponse { - page: Page; + hasNext: boolean; reviews: Review[]; } @@ -63,3 +63,9 @@ export interface MemberRecipeResponse { page: Page; recipes: MemberRecipe[]; } + +export interface CommentResponse { + hasNext: boolean; + totalElements: number | null; + comments: Comment[]; +} diff --git a/frontend/src/types/review.ts b/frontend/src/types/review.ts index debf6f65e..dd0273ddf 100644 --- a/frontend/src/types/review.ts +++ b/frontend/src/types/review.ts @@ -1,4 +1,4 @@ -import type { Tag, TagVariants } from './common'; +import type { CategoryVariant, Tag, TagVariants } from './common'; export interface Review { id: number; @@ -14,6 +14,22 @@ export interface Review { favorite: boolean; } +export interface ReviewDetail extends Review { + categoryType: CategoryVariant; + productId: number; + productName: string; +} + +export interface MemberReview { + reviewId: number; + productId: number; + productName: string; + content: string; + rating: number; + favoriteCount: number; + categoryType: CategoryVariant; +} + export interface ReviewTag { tagType: TagVariants; tags: Tag[]; diff --git a/frontend/src/types/search.ts b/frontend/src/types/search.ts index 75d5d816d..78f293f7f 100644 --- a/frontend/src/types/search.ts +++ b/frontend/src/types/search.ts @@ -1,7 +1,8 @@ +import type { CategoryVariant } from './common'; import type { Product } from './product'; export interface ProductSearchResult extends Product { - categoryType: string; + categoryType: CategoryVariant; } export type ProductSearchAutocomplete = Pick; diff --git a/frontend/src/utils/localStorage.ts b/frontend/src/utils/localStorage.ts new file mode 100644 index 000000000..91ce0c762 --- /dev/null +++ b/frontend/src/utils/localStorage.ts @@ -0,0 +1,26 @@ +export const getLocalStorage = (key: string) => { + const item = localStorage.getItem(key); + + if (item) { + try { + return JSON.parse(item); + } catch (error) { + return item; + } + } + + return null; +}; + +export const setLocalStorage = (key: string, newValue: unknown) => { + if (typeof newValue === 'string') { + localStorage.setItem(key, newValue); + return; + } + + localStorage.setItem(key, JSON.stringify(newValue)); +}; + +export const removeLocalStorage = (key: string) => { + localStorage.removeItem(key); +}; diff --git a/frontend/yarn.lock b/frontend/yarn.lock index c78fae96a..0a59dfb08 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -28,13 +28,13 @@ default-browser-id "3.0.0" "@babel/cli@^7.21.0": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.22.15.tgz#22ed82d76745a43caa60a89917bedb7c9b5bd145" - integrity sha512-prtg5f6zCERIaECeTZzd2fMtVjlfjhUcO+fBLQ6DXXdq5FljN+excVitJ2nogsusdf31LeqkjAfXZ7Xq+HmN8g== + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.23.0.tgz#1d7f37c44d4117c67df46749e0c86e11a58cc64b" + integrity sha512-17E1oSkGk2IwNILM4jtfAvgjt+ohmpfBky8aLerUfYZhiPNg7ca+CRCxZn8QDxwNhV/upsc2VHBCqGFIR+iBfA== dependencies: "@jridgewell/trace-mapping" "^0.3.17" commander "^4.0.1" - convert-source-map "^1.1.0" + convert-source-map "^2.0.0" fs-readdir-recursive "^1.1.0" glob "^7.2.0" make-dir "^2.1.0" @@ -51,38 +51,38 @@ "@babel/highlight" "^7.22.13" chalk "^2.4.2" -"@babel/compat-data@^7.20.5", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" - integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== +"@babel/compat-data@^7.20.5", "@babel/compat-data@^7.22.20", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.20.tgz#8df6e96661209623f1975d66c35ffca66f3306d0" + integrity sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw== -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.13.16", "@babel/core@^7.21.0", "@babel/core@^7.21.3", "@babel/core@^7.22.0", "@babel/core@^7.22.9", "@babel/core@^7.7.5": - version "7.22.17" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.17.tgz#2f9b0b395985967203514b24ee50f9fd0639c866" - integrity sha512-2EENLmhpwplDux5PSsZnSbnSkB3tZ6QTksgO25xwEL7pIDcNOMhF5v/s6RzwjMZzZzw9Ofc30gHv5ChCC8pifQ== +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.13.16", "@babel/core@^7.21.0", "@babel/core@^7.21.3", "@babel/core@^7.22.9", "@babel/core@^7.7.5": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.0.tgz#f8259ae0e52a123eb40f552551e647b506a94d83" + integrity sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ== dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.22.13" - "@babel/generator" "^7.22.15" + "@babel/generator" "^7.23.0" "@babel/helper-compilation-targets" "^7.22.15" - "@babel/helper-module-transforms" "^7.22.17" - "@babel/helpers" "^7.22.15" - "@babel/parser" "^7.22.16" + "@babel/helper-module-transforms" "^7.23.0" + "@babel/helpers" "^7.23.0" + "@babel/parser" "^7.23.0" "@babel/template" "^7.22.15" - "@babel/traverse" "^7.22.17" - "@babel/types" "^7.22.17" - convert-source-map "^1.7.0" + "@babel/traverse" "^7.23.0" + "@babel/types" "^7.23.0" + convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.12.11", "@babel/generator@^7.22.15", "@babel/generator@^7.22.9", "@babel/generator@^7.7.2": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.15.tgz#1564189c7ec94cb8f77b5e8a90c4d200d21b2339" - integrity sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA== +"@babel/generator@^7.12.11", "@babel/generator@^7.22.9", "@babel/generator@^7.23.0", "@babel/generator@^7.7.2": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== dependencies: - "@babel/types" "^7.22.15" + "@babel/types" "^7.23.0" "@jridgewell/gen-mapping" "^0.3.2" "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" @@ -147,18 +147,18 @@ lodash.debounce "^4.0.8" resolve "^1.14.2" -"@babel/helper-environment-visitor@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98" - integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q== +"@babel/helper-environment-visitor@^7.22.20", "@babel/helper-environment-visitor@^7.22.5": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== -"@babel/helper-function-name@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz#ede300828905bb15e582c037162f99d5183af1be" - integrity sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ== +"@babel/helper-function-name@^7.22.5", "@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== dependencies: - "@babel/template" "^7.22.5" - "@babel/types" "^7.22.5" + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" "@babel/helper-hoist-variables@^7.22.5": version "7.22.5" @@ -167,12 +167,12 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-member-expression-to-functions@^7.22.15", "@babel/helper-member-expression-to-functions@^7.22.5": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.22.15.tgz#b95a144896f6d491ca7863576f820f3628818621" - integrity sha512-qLNsZbgrNh0fDQBCPocSL8guki1hcPvltGDv/NxvUoABwFq7GkKSu1nRXeJkVZc+wJvne2E0RKQz+2SQrz6eAA== +"@babel/helper-member-expression-to-functions@^7.22.15": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz#9263e88cc5e41d39ec18c9a3e0eced59a3e7d366" + integrity sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA== dependencies: - "@babel/types" "^7.22.15" + "@babel/types" "^7.23.0" "@babel/helper-module-imports@^7.18.6", "@babel/helper-module-imports@^7.22.15", "@babel/helper-module-imports@^7.22.5": version "7.22.15" @@ -181,16 +181,16 @@ dependencies: "@babel/types" "^7.22.15" -"@babel/helper-module-transforms@^7.22.15", "@babel/helper-module-transforms@^7.22.17", "@babel/helper-module-transforms@^7.22.5", "@babel/helper-module-transforms@^7.22.9": - version "7.22.17" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.17.tgz#7edf129097a51ccc12443adbc6320e90eab76693" - integrity sha512-XouDDhQESrLHTpnBtCKExJdyY4gJCdrvH2Pyv8r8kovX2U8G0dRUOT45T9XlbLtuu9CLXP15eusnkprhoPV5iQ== +"@babel/helper-module-transforms@^7.22.5", "@babel/helper-module-transforms@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz#3ec246457f6c842c0aee62a01f60739906f7047e" + integrity sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw== dependencies: - "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" "@babel/helper-module-imports" "^7.22.15" "@babel/helper-simple-access" "^7.22.5" "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.15" + "@babel/helper-validator-identifier" "^7.22.20" "@babel/helper-optimise-call-expression@^7.22.5": version "7.22.5" @@ -205,21 +205,21 @@ integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== "@babel/helper-remap-async-to-generator@^7.22.5", "@babel/helper-remap-async-to-generator@^7.22.9": - version "7.22.17" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.17.tgz#dabaa50622b3b4670bd6546fc8db23eb12d89da0" - integrity sha512-bxH77R5gjH3Nkde6/LuncQoLaP16THYPscurp1S8z7S9ZgezCyV3G8Hc+TZiCmY8pz4fp8CvKSgtJMW0FkLAxA== + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.20.tgz#7b68e1cb4fa964d2996fd063723fb48eca8498e0" + integrity sha512-pBGyV4uBqOns+0UvhsTO8qgl8hO89PmiDYv+/COyp1aeMcmfrfruz+/nCMFiYyFF/Knn0yfrC85ZzNFjembFTw== dependencies: "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-environment-visitor" "^7.22.5" - "@babel/helper-wrap-function" "^7.22.17" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-wrap-function" "^7.22.20" "@babel/helper-replace-supers@^7.22.5", "@babel/helper-replace-supers@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.22.9.tgz#cbdc27d6d8d18cd22c81ae4293765a5d9afd0779" - integrity sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg== + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz#e37d367123ca98fe455a9887734ed2e16eb7a793" + integrity sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw== dependencies: - "@babel/helper-environment-visitor" "^7.22.5" - "@babel/helper-member-expression-to-functions" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-member-expression-to-functions" "^7.22.15" "@babel/helper-optimise-call-expression" "^7.22.5" "@babel/helper-simple-access@^7.22.5": @@ -248,47 +248,47 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== -"@babel/helper-validator-identifier@^7.22.15", "@babel/helper-validator-identifier@^7.22.5": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.15.tgz#601fa28e4cc06786c18912dca138cec73b882044" - integrity sha512-4E/F9IIEi8WR94324mbDUMo074YTheJmd7eZF5vITTeYchqAi6sYXRLHUVsmkdmY4QjfKTcB2jB7dVP3NaBElQ== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== "@babel/helper-validator-option@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz#694c30dfa1d09a6534cdfcafbe56789d36aba040" integrity sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA== -"@babel/helper-wrap-function@^7.22.17": - version "7.22.17" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.22.17.tgz#222ac3ff9cc8f9b617cc1e5db75c0b538e722801" - integrity sha512-nAhoheCMlrqU41tAojw9GpVEKDlTS8r3lzFmF0lP52LwblCPbuFSO7nGIZoIcoU5NIm1ABrna0cJExE4Ay6l2Q== +"@babel/helper-wrap-function@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.22.20.tgz#15352b0b9bfb10fc9c76f79f6342c00e3411a569" + integrity sha512-pms/UwkOpnQe/PDAEdV/d7dVCoBbB+R4FvYoHGZz+4VPcg7RtYy2KP7S2lbuWM6FCSgob5wshfGESbC/hzNXZw== dependencies: "@babel/helper-function-name" "^7.22.5" "@babel/template" "^7.22.15" - "@babel/types" "^7.22.17" + "@babel/types" "^7.22.19" -"@babel/helpers@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.15.tgz#f09c3df31e86e3ea0b7ff7556d85cdebd47ea6f1" - integrity sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw== +"@babel/helpers@^7.23.0": + version "7.23.1" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.1.tgz#44e981e8ce2b9e99f8f0b703f3326a4636c16d15" + integrity sha512-chNpneuK18yW5Oxsr+t553UZzzAs3aZnFm4bxhebsNTeshrC95yA7l5yl7GBAG+JG1rF0F7zzD2EixK9mWSDoA== dependencies: "@babel/template" "^7.22.15" - "@babel/traverse" "^7.22.15" - "@babel/types" "^7.22.15" + "@babel/traverse" "^7.23.0" + "@babel/types" "^7.23.0" "@babel/highlight@^7.22.13": - version "7.22.13" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.13.tgz#9cda839e5d3be9ca9e8c26b6dd69e7548f0cbf16" - integrity sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ== + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== dependencies: - "@babel/helper-validator-identifier" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" chalk "^2.4.2" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.13.16", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.22.15", "@babel/parser@^7.22.16", "@babel/parser@^7.22.7": - version "7.22.16" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.16.tgz#180aead7f247305cce6551bea2720934e2fa2c95" - integrity sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA== +"@babel/parser@^7.1.0", "@babel/parser@^7.13.16", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.22.15", "@babel/parser@^7.22.7", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.22.15": version "7.22.15" @@ -543,9 +543,9 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-transform-block-scoping@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.22.15.tgz#494eb82b87b5f8b1d8f6f28ea74078ec0a10a841" - integrity sha512-G1czpdJBZCtngoK1sJgloLiOHUnkb/bLZwqVZD8kXmq0ZnVfTTWUcs9OWtp0mBtYJ+4LQY1fllqBkOIPhXmFmw== + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.23.0.tgz#8744d02c6c264d82e1a4bc5d2d501fd8aff6f022" + integrity sha512-cOsrbmIOXmf+5YbL99/S49Y3j46k/T16b9ml8bm9lP6N9US5iQ2yBK7gpui1pg0V/WMcXdkfKbTb7HXq9u+v4g== dependencies: "@babel/helper-plugin-utils" "^7.22.5" @@ -590,9 +590,9 @@ "@babel/template" "^7.22.5" "@babel/plugin-transform-destructuring@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.22.15.tgz#e7404ea5bb3387073b9754be654eecb578324694" - integrity sha512-HzG8sFl1ZVGTme74Nw+X01XsUTqERVQ6/RLHo3XjGRzm7XD6QTtfS3NJotVgCGy8BzkDqRjRBD8dAyJn5TuvSQ== + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.23.0.tgz#6447aa686be48b32eaf65a73e0e2c0bd010a266c" + integrity sha512-vaMdgNXFkYrB+8lbgniSYWHsgqK5gjaMNcc84bMIOMRLH0L9AqYq3hwMdvnyqj1OPqea8UtjPEuS/DCenah1wg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" @@ -690,31 +690,31 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-transform-modules-amd@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.22.5.tgz#4e045f55dcf98afd00f85691a68fc0780704f526" - integrity sha512-R+PTfLTcYEmb1+kK7FNkhQ1gP4KgjpSO6HfH9+f8/yfp2Nt3ggBjiVpRwmwTlfqZLafYKJACy36yDXlEmI9HjQ== + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.23.0.tgz#05b2bc43373faa6d30ca89214731f76f966f3b88" + integrity sha512-xWT5gefv2HGSm4QHtgc1sYPbseOyf+FFDo2JbpE25GWl5BqTGO9IMwTYJRoIdjsF85GE+VegHxSCUt5EvoYTAw== dependencies: - "@babel/helper-module-transforms" "^7.22.5" + "@babel/helper-module-transforms" "^7.23.0" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-modules-commonjs@^7.13.8", "@babel/plugin-transform-modules-commonjs@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.15.tgz#b11810117ed4ee7691b29bd29fd9f3f98276034f" - integrity sha512-jWL4eh90w0HQOTKP2MoXXUpVxilxsB2Vl4ji69rSjS3EcZ/v4sBmn+A3NpepuJzBhOaEBbR7udonlHHn5DWidg== +"@babel/plugin-transform-modules-commonjs@^7.13.8", "@babel/plugin-transform-modules-commonjs@^7.22.15", "@babel/plugin-transform-modules-commonjs@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.0.tgz#b3dba4757133b2762c00f4f94590cf6d52602481" + integrity sha512-32Xzss14/UVc7k9g775yMIvkVK8xwKE0DPdP5JTapr3+Z9w4tzeOuLNY6BXDQR6BdnzIlXnCGAzsk/ICHBLVWQ== dependencies: - "@babel/helper-module-transforms" "^7.22.15" + "@babel/helper-module-transforms" "^7.23.0" "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-simple-access" "^7.22.5" "@babel/plugin-transform-modules-systemjs@^7.22.11": - version "7.22.11" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.22.11.tgz#3386be5875d316493b517207e8f1931d93154bb1" - integrity sha512-rIqHmHoMEOhI3VkVf5jQ15l539KrwhzqcBO6wdCNWPWc/JWt9ILNYNUssbRpeq0qWns8svuw8LnMNCvWBIJ8wA== + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.23.0.tgz#77591e126f3ff4132a40595a6cccd00a6b60d160" + integrity sha512-qBej6ctXZD2f+DhlOC9yO47yEYgUh5CZNz/aBoH4j/3NOlRfJXJbY7xDQCqQVf9KbrqGzIWER1f23doHGrIHFg== dependencies: "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-module-transforms" "^7.22.9" + "@babel/helper-module-transforms" "^7.23.0" "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-validator-identifier" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" "@babel/plugin-transform-modules-umd@^7.22.5": version "7.22.5" @@ -783,9 +783,9 @@ "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-transform-optional-chaining@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.15.tgz#d7a5996c2f7ca4ad2ad16dbb74444e5c4385b1ba" - integrity sha512-ngQ2tBhq5vvSJw2Q2Z9i7ealNkpDMU0rGWnHPKqRZO0tzZ5tlaoz4hDvhXioOoaE0X2vfNss1djwg0DXlfu30A== + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.23.0.tgz#73ff5fc1cf98f542f09f29c0631647d8ad0be158" + integrity sha512-sBBGXbLJjxTzLBF5rFWaikMnOGOk/BmK6vVByIdEggZ7Vn6CvWXZyRkkLFK6WE0IF8jSliyOkUN6SScFgzCM0g== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" @@ -956,11 +956,11 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/preset-env@^7.20.2", "@babel/preset-env@^7.22.9": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.15.tgz#142716f8e00bc030dae5b2ac6a46fbd8b3e18ff8" - integrity sha512-tZFHr54GBkHk6hQuVA8w4Fmq+MSPsfvMG0vPnOYyTnJpyfMqybL8/MbNCPRT9zc2KBO2pe4tq15g6Uno4Jpoag== + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.20.tgz#de9e9b57e1127ce0a2f580831717f7fb677ceedb" + integrity sha512-11MY04gGC4kSzlPHRfvVkNAZhUxOvm7DCJ37hPDnUENwe06npjIRAfInEMTGSb4LZK5ZgDFkv5hw0lGebHeTyg== dependencies: - "@babel/compat-data" "^7.22.9" + "@babel/compat-data" "^7.22.20" "@babel/helper-compilation-targets" "^7.22.15" "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-validator-option" "^7.22.15" @@ -1034,7 +1034,7 @@ "@babel/plugin-transform-unicode-regex" "^7.22.5" "@babel/plugin-transform-unicode-sets-regex" "^7.22.5" "@babel/preset-modules" "0.1.6-no-external-plugins" - "@babel/types" "^7.22.15" + "@babel/types" "^7.22.19" babel-plugin-polyfill-corejs2 "^0.4.5" babel-plugin-polyfill-corejs3 "^0.8.3" babel-plugin-polyfill-regenerator "^0.5.2" @@ -1072,14 +1072,14 @@ "@babel/plugin-transform-react-pure-annotations" "^7.22.5" "@babel/preset-typescript@^7.13.0", "@babel/preset-typescript@^7.21.0", "@babel/preset-typescript@^7.22.5": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.22.15.tgz#43db30516fae1d417d748105a0bc95f637239d48" - integrity sha512-HblhNmh6yM+cU4VwbBRpxFhxsTdfS1zsvH9W+gEjD0ARV9+8B4sNfpI6GuhePti84nuvhiwKS539jKPFHskA9A== + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.23.0.tgz#cc6602d13e7e5b2087c811912b87cf937a9129d9" + integrity sha512-6P6VVa/NM/VlAYj5s2Aq/gdVg8FSENCg3wlZ6Qau9AcPaoF5LbN1nyGlR9DTRIw9PpxI94e+ReydsJHcjwAweg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-validator-option" "^7.22.15" "@babel/plugin-syntax-jsx" "^7.22.5" - "@babel/plugin-transform-modules-commonjs" "^7.22.15" + "@babel/plugin-transform-modules-commonjs" "^7.23.0" "@babel/plugin-transform-typescript" "^7.22.15" "@babel/register@^7.13.16": @@ -1099,9 +1099,9 @@ integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.17.8", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.15.tgz#38f46494ccf6cf020bd4eed7124b425e83e523b8" - integrity sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA== + version "7.23.1" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.1.tgz#72741dc4d413338a91dcb044a86f3c0bc402646d" + integrity sha512-hC2v6p8ZSI/W0HUzh3V8C5g+NwSKzKPtJwSpTjwl0o297GP9+ZLQSkdvHz46CM3LqyoXxq+5G9komY+eSqSO0g== dependencies: regenerator-runtime "^0.14.0" @@ -1114,29 +1114,29 @@ "@babel/parser" "^7.22.15" "@babel/types" "^7.22.15" -"@babel/traverse@^7.1.6", "@babel/traverse@^7.21.2", "@babel/traverse@^7.22.15", "@babel/traverse@^7.22.17", "@babel/traverse@^7.22.8": - version "7.22.17" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.17.tgz#b23c203ab3707e3be816043081b4a994fcacec44" - integrity sha512-xK4Uwm0JnAMvxYZxOVecss85WxTEIbTa7bnGyf/+EgCL5Zt3U7htUpEOWv9detPlamGKuRzCqw74xVglDWpPdg== +"@babel/traverse@^7.1.6", "@babel/traverse@^7.21.2", "@babel/traverse@^7.22.8", "@babel/traverse@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.0.tgz#18196ddfbcf4ccea324b7f6d3ada00d8c5a99c53" + integrity sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw== dependencies: "@babel/code-frame" "^7.22.13" - "@babel/generator" "^7.22.15" - "@babel/helper-environment-visitor" "^7.22.5" - "@babel/helper-function-name" "^7.22.5" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" "@babel/helper-hoist-variables" "^7.22.5" "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.22.16" - "@babel/types" "^7.22.17" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.20.7", "@babel/types@^7.21.3", "@babel/types@^7.22.15", "@babel/types@^7.22.17", "@babel/types@^7.22.5", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.22.17" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.17.tgz#f753352c4610ffddf9c8bc6823f9ff03e2303eee" - integrity sha512-YSQPHLFtQNE5xN9tHuZnzu8vPr61wVTBZdfv1meex1NBosa4iT05k/Jw06ddJugi4bk7The/oSwQGFcksmEJQg== +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.20.7", "@babel/types@^7.21.3", "@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== dependencies: "@babel/helper-string-parser" "^7.22.5" - "@babel/helper-validator-identifier" "^7.22.15" + "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" "@base2/pretty-print-object@1.0.1": @@ -1155,19 +1155,19 @@ integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== "@csstools/css-parser-algorithms@^2.3.1": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.3.1.tgz#ec4fc764ba45d2bb7ee2774667e056aa95003f3a" - integrity sha512-xrvsmVUtefWMWQsGgFffqWSK03pZ1vfDki4IVIIUxxDKnGBzqNgv0A7SB1oXtVNEkcVO8xi1ZrTL29HhSu5kGA== + version "2.3.2" + resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.3.2.tgz#1e0d581dbf4518cb3e939c3b863cb7180c8cedad" + integrity sha512-sLYGdAdEY2x7TSw9FtmdaTrh2wFtRJO5VMbBrA8tEqEod7GEggFmxTSK9XqExib3yMuYNcvcTdCZIP6ukdjAIA== "@csstools/css-tokenizer@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@csstools/css-tokenizer/-/css-tokenizer-2.2.0.tgz#9d70e6dcbe94e44c7400a2929928db35c4de32b5" - integrity sha512-wErmsWCbsmig8sQKkM6pFhr/oPha1bHfvxsUY5CYSQxwyhA9Ulrs8EqCgClhg4Tgg2XapVstGqSVcz0xOYizZA== + version "2.2.1" + resolved "https://registry.yarnpkg.com/@csstools/css-tokenizer/-/css-tokenizer-2.2.1.tgz#9dc431c9a5f61087af626e41ac2a79cce7bb253d" + integrity sha512-Zmsf2f/CaEPWEVgw29odOj+WEVoiJy9s9NOv5GgNY9mZ1CZ7394By6wONrONrTsnNDv6F9hR02nvFihrGVGHBg== "@csstools/media-query-list-parser@^2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@csstools/media-query-list-parser/-/media-query-list-parser-2.1.4.tgz#0017f99945f6c16dd81a7aacf6821770933c3a5c" - integrity sha512-V/OUXYX91tAC1CDsiY+HotIcJR+vPtzrX8pCplCpT++i8ThZZsq5F5dzZh/bDM3WUOjrvC1ljed1oSJxMfjqhw== + version "2.1.5" + resolved "https://registry.yarnpkg.com/@csstools/media-query-list-parser/-/media-query-list-parser-2.1.5.tgz#94bc8b3c3fd7112a40b7bf0b483e91eba0654a0f" + integrity sha512-IxVBdYzR8pYe89JiyXQuYk4aVVoCPhMJkz6ElRwlVysjwURTsTk/bmY/z4FfeRE+CRBMlykPwXEVUg8lThv7AQ== "@csstools/selector-specificity@^3.0.0": version "3.0.0" @@ -1319,9 +1319,9 @@ eslint-visitor-keys "^3.3.0" "@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.1": - version "4.8.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.8.0.tgz#11195513186f68d42fbf449f9a7136b2c0c92005" - integrity sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg== + version "4.9.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.9.1.tgz#449dfa81a57a1d755b09aa58d826c1262e4283b4" + integrity sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA== "@eslint/eslintrc@^2.1.2": version "2.1.2" @@ -1338,30 +1338,30 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.49.0": - version "8.49.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.49.0.tgz#86f79756004a97fa4df866835093f1df3d03c333" - integrity sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w== +"@eslint/js@8.50.0": + version "8.50.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.50.0.tgz#9e93b850f0f3fa35f5fa59adfd03adae8488e484" + integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ== "@fal-works/esbuild-plugin-global-externals@^2.1.2": version "2.1.2" resolved "https://registry.yarnpkg.com/@fal-works/esbuild-plugin-global-externals/-/esbuild-plugin-global-externals-2.1.2.tgz#c05ed35ad82df8e6ac616c68b92c2282bd083ba4" integrity sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ== -"@floating-ui/core@^1.4.1": - version "1.4.1" - resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.4.1.tgz#0d633f4b76052668afb932492ac452f7ebe97f17" - integrity sha512-jk3WqquEJRlcyu7997NtR5PibI+y5bi+LS3hPmguVClypenMsCY3CBa3LAQnozRCtCrYWSEtAdiskpamuJRFOQ== +"@floating-ui/core@^1.4.2": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.5.0.tgz#5c05c60d5ae2d05101c3021c1a2a350ddc027f8c" + integrity sha512-kK1h4m36DQ0UHGj5Ah4db7R0rHemTqqO0QLvUqi1/mUUp3LuAWbWxdxSIf/XsnH9VS6rRVPLJCncjRzUvyCLXg== dependencies: - "@floating-ui/utils" "^0.1.1" + "@floating-ui/utils" "^0.1.3" "@floating-ui/dom@^1.5.1": - version "1.5.2" - resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.5.2.tgz#6812e89d1d4d4ea32f10d15c3b81feb7f9836d89" - integrity sha512-6ArmenS6qJEWmwzczWyhvrXRdI/rI78poBcW0h/456+onlabit+2G+QxHx5xTOX60NBJQXjsCLFbW2CmsXpUog== + version "1.5.3" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.5.3.tgz#54e50efcb432c06c23cd33de2b575102005436fa" + integrity sha512-ClAbQnEqJAKCJOEbbLo5IUlZHkNszqhuxS4fHAVxRPXPya6Ysf2G8KypnYcOTpx6I8xcgF9bbHb6g/2KpbV8qA== dependencies: - "@floating-ui/core" "^1.4.1" - "@floating-ui/utils" "^0.1.1" + "@floating-ui/core" "^1.4.2" + "@floating-ui/utils" "^0.1.3" "@floating-ui/react-dom@^2.0.0": version "2.0.2" @@ -1370,15 +1370,15 @@ dependencies: "@floating-ui/dom" "^1.5.1" -"@floating-ui/utils@^0.1.1": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.1.1.tgz#1a5b1959a528e374e8037c4396c3e825d6cf4a83" - integrity sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw== +"@floating-ui/utils@^0.1.3": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.1.6.tgz#22958c042e10b67463997bd6ea7115fe28cbcaf9" + integrity sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A== -"@fun-eat/design-system@^0.3.12": - version "0.3.12" - resolved "https://registry.yarnpkg.com/@fun-eat/design-system/-/design-system-0.3.12.tgz#a5e431287b1c4e4685c748ade392aa2602076d27" - integrity sha512-rHnhO6EVQ0FY9ahaFJLCuEUKwm2vwSJ42zY565Ph0/i/dMnQscLGalL4YHUF+O3hzKslqj6Aw/SOwivQDY2wWQ== +"@fun-eat/design-system@^0.3.18": + version "0.3.18" + resolved "https://registry.yarnpkg.com/@fun-eat/design-system/-/design-system-0.3.18.tgz#0c930437cd47923a9daffbaec748ef5db3b4d0c1" + integrity sha512-d1yfTLJLKPakFzf/wiDcLkRi5cit16hDJClH4+Mj6nMtChxMeUu3VU+i4oCJNqaNjZHDw9wOa+7L4kmIcKQnRg== "@humanwhocodes/config-array@^0.11.11": version "0.11.11" @@ -1415,27 +1415,27 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.6.4.tgz#a7e2d84516301f986bba0dd55af9d5fe37f46527" - integrity sha512-wNK6gC0Ha9QeEPSkeJedQuTQqxZYnDPuDcDhVuVatRvMkL4D0VTvFVZj+Yuh6caG2aOfzkUZ36KtCmLNtR02hw== +"@jest/console@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" + integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== dependencies: "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^29.6.3" - jest-util "^29.6.3" + jest-message-util "^29.7.0" + jest-util "^29.7.0" slash "^3.0.0" -"@jest/core@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.6.4.tgz#265ebee05ec1ff3567757e7a327155c8d6bdb126" - integrity sha512-U/vq5ccNTSVgYH7mHnodHmCffGWHJnz/E1BEWlLuK5pM4FZmGfBn/nrJGLjUsSmyx3otCeqc1T31F4y08AMDLg== +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== dependencies: - "@jest/console" "^29.6.4" - "@jest/reporters" "^29.6.4" - "@jest/test-result" "^29.6.4" - "@jest/transform" "^29.6.4" + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" @@ -1443,80 +1443,80 @@ ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" - jest-changed-files "^29.6.3" - jest-config "^29.6.4" - jest-haste-map "^29.6.4" - jest-message-util "^29.6.3" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" jest-regex-util "^29.6.3" - jest-resolve "^29.6.4" - jest-resolve-dependencies "^29.6.4" - jest-runner "^29.6.4" - jest-runtime "^29.6.4" - jest-snapshot "^29.6.4" - jest-util "^29.6.3" - jest-validate "^29.6.3" - jest-watcher "^29.6.4" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" micromatch "^4.0.4" - pretty-format "^29.6.3" + pretty-format "^29.7.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.6.4.tgz#78ec2c9f8c8829a37616934ff4fea0c028c79f4f" - integrity sha512-sQ0SULEjA1XUTHmkBRl7A1dyITM9yb1yb3ZNKPX3KlTd6IG7mWUe3e2yfExtC2Zz1Q+mMckOLHmL/qLiuQJrBQ== +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== dependencies: - "@jest/fake-timers" "^29.6.4" + "@jest/fake-timers" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" - jest-mock "^29.6.3" + jest-mock "^29.7.0" -"@jest/expect-utils@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.6.4.tgz#17c7dfe6cec106441f218b0aff4b295f98346679" - integrity sha512-FEhkJhqtvBwgSpiTrocquJCdXPsyvNKcl/n7A3u7X4pVoF4bswm11c9d4AV+kfq2Gpv/mM8x7E7DsRvH+djkrg== +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== dependencies: jest-get-type "^29.6.3" -"@jest/expect@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.6.4.tgz#1d6ae17dc68d906776198389427ab7ce6179dba6" - integrity sha512-Warhsa7d23+3X5bLbrbYvaehcgX5TLYhI03JKoedTiI8uJU4IhqYBWF7OSSgUyz4IgLpUYPkK0AehA5/fRclAA== +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== dependencies: - expect "^29.6.4" - jest-snapshot "^29.6.4" + expect "^29.7.0" + jest-snapshot "^29.7.0" -"@jest/fake-timers@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.6.4.tgz#45a27f093c43d5d989362a3e7a8c70c83188b4f6" - integrity sha512-6UkCwzoBK60edXIIWb0/KWkuj7R7Qq91vVInOe3De6DSpaEiqjKcJw4F7XUet24Wupahj9J6PlR09JqJ5ySDHw== +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== dependencies: "@jest/types" "^29.6.3" "@sinonjs/fake-timers" "^10.0.2" "@types/node" "*" - jest-message-util "^29.6.3" - jest-mock "^29.6.3" - jest-util "^29.6.3" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" -"@jest/globals@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.6.4.tgz#4f04f58731b062b44ef23036b79bdb31f40c7f63" - integrity sha512-wVIn5bdtjlChhXAzVXavcY/3PEjf4VqM174BM3eGL5kMxLiZD5CLnbmkEyA1Dwh9q8XjP6E8RwjBsY/iCWrWsA== +"@jest/globals@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== dependencies: - "@jest/environment" "^29.6.4" - "@jest/expect" "^29.6.4" + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" "@jest/types" "^29.6.3" - jest-mock "^29.6.3" + jest-mock "^29.7.0" -"@jest/reporters@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.6.4.tgz#9d6350c8a2761ece91f7946e97ab0dabc06deab7" - integrity sha512-sxUjWxm7QdchdrD3NfWKrL8FBsortZeibSJv4XLjESOOjSUOkjQcb0ZHJwfhEGIvBvTluTzfG2yZWZhkrXJu8g== +"@jest/reporters@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" + integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^29.6.4" - "@jest/test-result" "^29.6.4" - "@jest/transform" "^29.6.4" + "@jest/console" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" "@jest/types" "^29.6.3" "@jridgewell/trace-mapping" "^0.3.18" "@types/node" "*" @@ -1530,9 +1530,9 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.1.3" - jest-message-util "^29.6.3" - jest-util "^29.6.3" - jest-worker "^29.6.4" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + jest-worker "^29.7.0" slash "^3.0.0" string-length "^4.0.1" strip-ansi "^6.0.0" @@ -1554,30 +1554,30 @@ callsites "^3.0.0" graceful-fs "^4.2.9" -"@jest/test-result@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.6.4.tgz#adf5c79f6e1fb7405ad13d67d9e2b6ff54b54c6b" - integrity sha512-uQ1C0AUEN90/dsyEirgMLlouROgSY+Wc/JanVVk0OiUKa5UFh7sJpMEM3aoUBAz2BRNvUJ8j3d294WFuRxSyOQ== +"@jest/test-result@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" + integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== dependencies: - "@jest/console" "^29.6.4" + "@jest/console" "^29.7.0" "@jest/types" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.6.4.tgz#86aef66aaa22b181307ed06c26c82802fb836d7b" - integrity sha512-E84M6LbpcRq3fT4ckfKs9ryVanwkaIB0Ws9bw3/yP4seRLg/VaCZ/LgW0MCq5wwk4/iP/qnilD41aj2fsw2RMg== +"@jest/test-sequencer@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" + integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== dependencies: - "@jest/test-result" "^29.6.4" + "@jest/test-result" "^29.7.0" graceful-fs "^4.2.9" - jest-haste-map "^29.6.4" + jest-haste-map "^29.7.0" slash "^3.0.0" -"@jest/transform@^29.3.1", "@jest/transform@^29.6.4": - version "29.6.4" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.6.4.tgz#a6bc799ef597c5d85b2e65a11fd96b6b239bab5a" - integrity sha512-8thgRSiXUqtr/pPGY/OsyHuMjGyhVnWrFAwoxmIemlBuiMyU1WFs0tXoNxzcr4A4uErs/ABre76SGmrr5ab/AA== +"@jest/transform@^29.3.1", "@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== dependencies: "@babel/core" "^7.11.6" "@jest/types" "^29.6.3" @@ -1587,9 +1587,9 @@ convert-source-map "^2.0.0" fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" - jest-haste-map "^29.6.4" + jest-haste-map "^29.7.0" jest-regex-util "^29.6.3" - jest-util "^29.6.3" + jest-util "^29.7.0" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" @@ -1684,16 +1684,16 @@ "@types/set-cookie-parser" "^2.4.0" set-cookie-parser "^2.4.6" -"@mswjs/interceptors@^0.17.5": - version "0.17.9" - resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.17.9.tgz#0096fc88fea63ee42e36836acae8f4ae33651c04" - integrity sha512-4LVGt03RobMH/7ZrbHqRxQrS9cc2uh+iNKSj8UWr8M26A2i793ju+csaB5zaqYltqJmA2jUq4VeYfKmVqvsXQg== +"@mswjs/interceptors@^0.17.10": + version "0.17.10" + resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.17.10.tgz#857b41f30e2b92345ed9a4e2b1d0a08b8b6fcad4" + integrity sha512-N8x7eSLGcmUFNWZRxT1vsHvypzIRgQYdG0rJey/rZCy6zT/30qDt8Joj7FxzGNLSwXbeZqJOMqDurp7ra4hgbw== dependencies: "@open-draft/until" "^1.0.3" "@types/debug" "^4.1.7" "@xmldom/xmldom" "^0.8.3" debug "^4.3.3" - headers-polyfill "^3.1.0" + headers-polyfill "3.2.5" outvariant "^1.2.1" strict-event-emitter "^0.2.4" web-encoding "^1.1.5" @@ -2048,10 +2048,10 @@ dependencies: "@babel/runtime" "^7.13.10" -"@remix-run/router@1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.8.0.tgz#e848d2f669f601544df15ce2a313955e4bf0bafc" - integrity sha512-mrfKqIHnSZRyIzBcanNJmVQELTnX+qagEDlcKO90RgRBVOZGSGvZKeDihTRfWcqoDn5N/NkUcwWTccnpN18Tfg== +"@remix-run/router@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.9.0.tgz#9033238b41c4cbe1e961eccb3f79e2c588328cf6" + integrity sha512-bV63itrKBC0zdT27qYm6SDZHlkXwFL1xMBuhkn+X7l0+IIhNaH5wuuvZKp6eKhCD4KFhujhfhCT1YxXW6esUIA== "@sinclair/typebox@^0.27.8": version "0.27.8" @@ -2072,19 +2072,19 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@storybook/addon-actions@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-7.4.0.tgz#709988f46422b85b3672d2e6f90bf623af59faa9" - integrity sha512-0lHLLUlrGE7CBFrfmAXrBKu7fUIsiQlnNekuE3cIAjSgVR481bJEzYHUUoMATqpPC4GGErBdP1CZxVDDwWV8jA== +"@storybook/addon-actions@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-7.4.6.tgz#080bd1612a744cc3fc4a435a07a63d2d8c05f030" + integrity sha512-SsqZr3js5NinKPnC8AeNI7Ij+Q6fIl9tRdRmSulEgjksjOg7E5S1/Wsn5Bb2CCgj7MaX6VxGyC7s3XskQtDiIQ== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" dequal "^2.0.2" lodash "^4.17.21" polished "^4.2.2" @@ -2094,141 +2094,141 @@ ts-dedent "^2.0.0" uuid "^9.0.0" -"@storybook/addon-backgrounds@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-backgrounds/-/addon-backgrounds-7.4.0.tgz#7d3048329b8ef73145a2e9b435b7b35004a65f86" - integrity sha512-cEO/Tp/eRE+5bf1FGN4wKLqLDBv3EYp9enJyXV7B3cFdciqtoE7VJPZuFZkzjJN1rRcOKSZp8g5agsx+x9uNGQ== +"@storybook/addon-backgrounds@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-backgrounds/-/addon-backgrounds-7.4.6.tgz#315ac726e606259ce868b78c7b966cc9489b51ea" + integrity sha512-+LHTZB/ZYMAzkyD5ZxSriBsqmsrvIaW/Nnd/BeuXGbkrVKKqM0qAKiFZAfjc2WchA1piVNy0/1Rsf+kuYCEiJw== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" memoizerific "^1.11.3" ts-dedent "^2.0.0" -"@storybook/addon-controls@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-controls/-/addon-controls-7.4.0.tgz#b212d60fd74d69f6b63c53e4d52ab6c77ee51247" - integrity sha512-tYDfqpTR+c9y4kElmr3aWNHPot6kYd+nruYb697LpkCdy4lFErqSo0mhvPyZfMZp2KEajfp6YJAurhQWbvbj/A== - dependencies: - "@storybook/blocks" "7.4.0" - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-common" "7.4.0" - "@storybook/core-events" "7.4.0" - "@storybook/manager-api" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" +"@storybook/addon-controls@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-controls/-/addon-controls-7.4.6.tgz#b1db7a0faacb25b9a6f54c2dff2ba94d06619bd4" + integrity sha512-4lq3sycEUIsK8SUWDYc60QgF4vV9FZZ3lDr6M7j2W9bOnvGw49d2fbdlnq+bX1ZprZZ9VgglQpBAorQB3BXZRw== + dependencies: + "@storybook/blocks" "7.4.6" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-common" "7.4.6" + "@storybook/core-events" "7.4.6" + "@storybook/manager-api" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" lodash "^4.17.21" ts-dedent "^2.0.0" -"@storybook/addon-docs@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-docs/-/addon-docs-7.4.0.tgz#e07233c264eaec149a0fcca0e27c586d4e80b403" - integrity sha512-LJE92LUeVTgi8W4tLBEbSvCqF54snmBfTFCr46vhCFov2CE2VBgEvIX1XT3dfUgYUOtPu3RXR2C89fYgU6VYZw== +"@storybook/addon-docs@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-docs/-/addon-docs-7.4.6.tgz#f2cc635a77cfb3e2910d6ca813add9a16785595d" + integrity sha512-dLaub+XWFq4hChw+xfuF9yYg0Txp77FUawKoAigccfjWXx+OOhRV3XTuAcknpXkYq94GWynHgUFXosXT9kbDNA== dependencies: "@jest/transform" "^29.3.1" "@mdx-js/react" "^2.1.5" - "@storybook/blocks" "7.4.0" - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/csf-plugin" "7.4.0" - "@storybook/csf-tools" "7.4.0" + "@storybook/blocks" "7.4.6" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/csf-plugin" "7.4.6" + "@storybook/csf-tools" "7.4.6" "@storybook/global" "^5.0.0" "@storybook/mdx2-csf" "^1.0.0" - "@storybook/node-logger" "7.4.0" - "@storybook/postinstall" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/react-dom-shim" "7.4.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/node-logger" "7.4.6" + "@storybook/postinstall" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/react-dom-shim" "7.4.6" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" fs-extra "^11.1.0" remark-external-links "^8.0.0" remark-slug "^6.0.0" ts-dedent "^2.0.0" "@storybook/addon-essentials@^7.0.27": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-essentials/-/addon-essentials-7.4.0.tgz#b5d19c60233e5bd5e1a29b76b51059c889f18d52" - integrity sha512-nZmNM9AKw2JXxnYUXyFKLeUF/cL7Z9E1WTeZyOFTDtU2aITRt8+LvaepwjchtPqu2B0GcQxLB5FRDdhy0I19nw== - dependencies: - "@storybook/addon-actions" "7.4.0" - "@storybook/addon-backgrounds" "7.4.0" - "@storybook/addon-controls" "7.4.0" - "@storybook/addon-docs" "7.4.0" - "@storybook/addon-highlight" "7.4.0" - "@storybook/addon-measure" "7.4.0" - "@storybook/addon-outline" "7.4.0" - "@storybook/addon-toolbars" "7.4.0" - "@storybook/addon-viewport" "7.4.0" - "@storybook/core-common" "7.4.0" - "@storybook/manager-api" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/preview-api" "7.4.0" + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-essentials/-/addon-essentials-7.4.6.tgz#b9c83dbdae0ffd6f24fa9328b36488d563714260" + integrity sha512-dWodufrt71TK7ELkeIvVae/x4PzECUlbOm57Iqqt4yQCyR291CgvI4PjeB8un2HbpcXCGZ+N/Oj3YkytvzBi4A== + dependencies: + "@storybook/addon-actions" "7.4.6" + "@storybook/addon-backgrounds" "7.4.6" + "@storybook/addon-controls" "7.4.6" + "@storybook/addon-docs" "7.4.6" + "@storybook/addon-highlight" "7.4.6" + "@storybook/addon-measure" "7.4.6" + "@storybook/addon-outline" "7.4.6" + "@storybook/addon-toolbars" "7.4.6" + "@storybook/addon-viewport" "7.4.6" + "@storybook/core-common" "7.4.6" + "@storybook/manager-api" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/preview-api" "7.4.6" ts-dedent "^2.0.0" -"@storybook/addon-highlight@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-highlight/-/addon-highlight-7.4.0.tgz#ea33826a7f610f5e76cfa59ff22283e01cfd76cd" - integrity sha512-kpYSb3oXI9t/1+aRJhToDZ0/1W4mu+SzTBfv9Bl2d/DogEkFzgJricoy5LtvS5EpcXUmKO1FJsw/DCm9buSL2g== +"@storybook/addon-highlight@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-highlight/-/addon-highlight-7.4.6.tgz#ee688232fe260f1b926205ddc1ceb1e0781dcbaf" + integrity sha512-zCufxxD2KS5VwczxfkcBxe1oR/juTTn2H1Qm8kYvWCJQx3UxzX0+G9cwafbpV7eivqaufLweEwROkH+0KjAtkQ== dependencies: - "@storybook/core-events" "7.4.0" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/preview-api" "7.4.0" + "@storybook/preview-api" "7.4.6" "@storybook/addon-interactions@^7.0.27": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-interactions/-/addon-interactions-7.4.0.tgz#d0c15303999ac1e8f33705146e9a0a6db6df339c" - integrity sha512-nEWP+Ib0Y/ShXfpCm40FBTbBy1/MT8XxTEAhcNN+3ZJ07Vhhkrb8GMlWHTKQv2PyghEVBYEoPFHhElUJQOe00g== - dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-common" "7.4.0" - "@storybook/core-events" "7.4.0" + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-interactions/-/addon-interactions-7.4.6.tgz#643659a6fd1a90e9fecaf6309276d29c3cee8af1" + integrity sha512-zVZYrEPZPhNrXBuPqM7HbQvr6jwsje1sbCYj3wnp83U5wjciuqrngqHIlaSZ30zOWSfRVyzbyqL+JQZKA58BNA== + dependencies: + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-common" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/instrumenter" "7.4.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/instrumenter" "7.4.6" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" jest-mock "^27.0.6" polished "^4.2.2" ts-dedent "^2.2.0" "@storybook/addon-links@^7.0.27": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-links/-/addon-links-7.4.0.tgz#f10ba388143d0de75150a27e94241d5fb4dfba7e" - integrity sha512-lFj8fiokWKk3jx5YUQ4anQo1uCNDMP1y6nJ/92Y85vnOd1vJr3w4GlLy8eOWMABRE33AKLI5Yp6wcpWZDe7hhQ== + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-links/-/addon-links-7.4.6.tgz#6bf1730b8f44d85a0b601d268fd6fb0726bbc360" + integrity sha512-BPygElZKX+CPI9Se6GJNk1dYc5oxuhA+vHigO1tBqhiM6VkHyFP3cvezJNQvpNYhkUnu3cxnZXb3UJnlRbPY3g== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/csf" "^0.1.0" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/router" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/router" "7.4.6" + "@storybook/types" "7.4.6" prop-types "^15.7.2" ts-dedent "^2.0.0" -"@storybook/addon-measure@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-measure/-/addon-measure-7.4.0.tgz#61bc0d0af5af8c22e81b70e1690b2f58262944cd" - integrity sha512-8YjBqm6jPOBgkRn9YnJkLN0+ghgJiukdHOa0VB3qhiT+oww4ZOZ7mc2aQRwXQoFb05UbVVG9UNxE7lhyTyaG2w== +"@storybook/addon-measure@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-measure/-/addon-measure-7.4.6.tgz#12cb5ffab78c922809178c0ee8574b264ff2de5d" + integrity sha512-nCymMLaHnxv8TE3yEM1A9Tulb1NuRXRNmtsdHTkjv7P1aWCxZo8A/GZaottKe/GLT8jSRjZ+dnpYWrbAhw6wTQ== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/types" "7.4.6" tiny-invariant "^1.3.1" "@storybook/addon-onboarding@^1.0.8": @@ -2239,62 +2239,71 @@ "@storybook/telemetry" "^7.1.0-alpha.32" react-confetti "^6.1.0" -"@storybook/addon-outline@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-outline/-/addon-outline-7.4.0.tgz#63fef45815f209a3ad7ac2b3765f0734093af668" - integrity sha512-CCAWFC3bfkmYPzFjOemfH/kjpqJOHt+SdJgBKmwujDy+zum0DHlUL/7rd+U32cEpezCA8bapd0hlWn59C4agHQ== +"@storybook/addon-outline@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-outline/-/addon-outline-7.4.6.tgz#d375046bb6858ea9ec09fdaf03d5802a543b2a30" + integrity sha512-errNUblRVDLpuEaHQPr/nsrnsUkD2ARmXawkRvizgDWLIDMDJYjTON3MUCaVx3x+hlZ3I6X//G5TVcma8tCc8A== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/types" "7.4.6" ts-dedent "^2.0.0" -"@storybook/addon-toolbars@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-toolbars/-/addon-toolbars-7.4.0.tgz#db1a3bc1d6e6aa0142b62aaf8c44d5a9f82fd6b7" - integrity sha512-00PDLchlQXI3ZClQHU0YQBfikAAxHOhVNv2QKW54yFKmxPl+P2c/VIeir9LcPhA04smKrJTD1u+Nszd66A9xAA== - dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/theming" "7.4.0" - -"@storybook/addon-viewport@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/addon-viewport/-/addon-viewport-7.4.0.tgz#a9bc167b822d31491cec6aad21cc0a420f1ae5b7" - integrity sha512-Bfoilf9eJV/C7tR8XHDxz3h8JlZ+iggoESp2Tc0bW9tlRvz+PsCqeyHhF/IgHY+gLnPal2PkK/PIM+ruO45HXA== - dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-events" "7.4.0" +"@storybook/addon-toolbars@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-toolbars/-/addon-toolbars-7.4.6.tgz#04d270bb45f6cea45cecce084f7713c7dda047f9" + integrity sha512-L9m2FBcKeteGq7qIYsMJr0LEfiH7Wdrv5IDcldZTn68eZUJTh1p4GdJZcOmzX1P5IFRr76hpu03iWsNlWQjpbQ== + dependencies: + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/theming" "7.4.6" + +"@storybook/addon-viewport@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-viewport/-/addon-viewport-7.4.6.tgz#ff6fbe9b67310d16cd7b4a38dbc445a8fede6373" + integrity sha512-INDtk54j7bi7NgxMfd2ATmbA0J7nAd6X8itMkLIyPuPJtx8bYHPDORyemDOd0AojgmAdTOAyUtDYdI/PFeo4Cw== + dependencies: + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/theming" "7.4.0" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/theming" "7.4.6" memoizerific "^1.11.3" prop-types "^15.7.2" -"@storybook/blocks@7.4.0", "@storybook/blocks@^7.0.27": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/blocks/-/blocks-7.4.0.tgz#6a9240e2b58bac99a998c559d719be7ff4e19dcc" - integrity sha512-YQznNjJm+l32fCfPxrZso9+MbcyG0pWZSpx3RKI1+pxDMsAs4mbXsIw4//jKfjoDP/6/Cz/FJcSx8LT7i4BJ2w== +"@storybook/addons@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-7.4.6.tgz#cca556ca30aa34652f9bbab30467a538df5b10fe" + integrity sha512-c+4awrtwNlJayFdgLkEXa5H2Gj+KNlxuN+Z5oDAdZBLqXI8g0gn7eYO2F/eCSIDWdd/+zcU2uq57XPFKc8veHQ== + dependencies: + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/types" "7.4.6" + +"@storybook/blocks@7.4.6", "@storybook/blocks@^7.0.27": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/blocks/-/blocks-7.4.6.tgz#03134130fa20d6c36c6985008bc2c38892c5b8f5" + integrity sha512-HxBSAeOiTZW2jbHQlo1upRWFgoMsaAyKijUFf5MwwMNIesXCuuTGZDJ3xTABwAVLK2qC9Ektfbo0CZCiPVuDRQ== dependencies: - "@storybook/channels" "7.4.0" - "@storybook/client-logger" "7.4.0" - "@storybook/components" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/channels" "7.4.6" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/csf" "^0.1.0" - "@storybook/docs-tools" "7.4.0" + "@storybook/docs-tools" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/manager-api" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" "@types/lodash" "^4.14.167" color-convert "^2.0.1" dequal "^2.0.2" @@ -2308,15 +2317,15 @@ ts-dedent "^2.0.0" util-deprecate "^1.0.2" -"@storybook/builder-manager@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/builder-manager/-/builder-manager-7.4.0.tgz#80cf72ea83f88e16d585c5bdb40d563874c7d8ca" - integrity sha512-4fuxVzBIBbZh2aVBizSOU5EJ8b74IhR6x2TAZjifZZf5Gdxgfgio8sAyrrd/C78vrFOFhFEgmQhMqZRuCLHxvQ== +"@storybook/builder-manager@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/builder-manager/-/builder-manager-7.4.6.tgz#942a1a5e0a8b5956bd30867841fa1c542eb3d0bf" + integrity sha512-zylZCD2rmyLOOFBFmUgtJg6UNUKmRNgXiig1XApzS2TkIbTZP827DsVEUl0ey/lskCe0uArkrEBR6ICba8p/Rw== dependencies: "@fal-works/esbuild-plugin-global-externals" "^2.1.2" - "@storybook/core-common" "7.4.0" - "@storybook/manager" "7.4.0" - "@storybook/node-logger" "7.4.0" + "@storybook/core-common" "7.4.6" + "@storybook/manager" "7.4.6" + "@storybook/node-logger" "7.4.6" "@types/ejs" "^3.1.1" "@types/find-cache-dir" "^3.2.1" "@yarnpkg/esbuild-plugin-pnp" "^3.0.0-rc.10" @@ -2330,20 +2339,28 @@ process "^0.11.10" util "^0.12.4" -"@storybook/builder-webpack5@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/builder-webpack5/-/builder-webpack5-7.4.0.tgz#c9a4ee5a6424dd70f5b35f057de24afd268a5fd3" - integrity sha512-CYeXppqGACzDUpLCFvWvwD7IjN7VNi7+nwQ1uRNgW2NgBMOIldZe+gcTXcc0BuHyIitU5/vvquYM0qjis05LYw== - dependencies: - "@babel/core" "^7.22.0" - "@storybook/channels" "7.4.0" - "@storybook/client-logger" "7.4.0" - "@storybook/core-common" "7.4.0" - "@storybook/core-events" "7.4.0" - "@storybook/core-webpack" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/preview" "7.4.0" - "@storybook/preview-api" "7.4.0" +"@storybook/builder-webpack5@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/builder-webpack5/-/builder-webpack5-7.4.6.tgz#a3d5b3e270d80cbbe31903de9dafb4a25e36e08e" + integrity sha512-j7AyDPlUuO2GiH6riB8iGbT7blQpyVGB+rMHXPSm7v6/U7IITbNzxFwe+sSMLoFr8K1e2VXpgqQ9p3rHFey+nw== + dependencies: + "@babel/core" "^7.22.9" + "@storybook/addons" "7.4.6" + "@storybook/channels" "7.4.6" + "@storybook/client-api" "7.4.6" + "@storybook/client-logger" "7.4.6" + "@storybook/components" "7.4.6" + "@storybook/core-common" "7.4.6" + "@storybook/core-events" "7.4.6" + "@storybook/core-webpack" "7.4.6" + "@storybook/global" "^5.0.0" + "@storybook/manager-api" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/preview" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/router" "7.4.6" + "@storybook/store" "7.4.6" + "@storybook/theming" "7.4.6" "@swc/core" "^1.3.49" "@types/node" "^16.0.0" "@types/semver" "^7.3.4" @@ -2372,34 +2389,35 @@ webpack-hot-middleware "^2.25.1" webpack-virtual-modules "^0.5.0" -"@storybook/channels@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-7.4.0.tgz#4ab69fce09c0fe7299f1595628b3de10b0fdcd8f" - integrity sha512-/1CU0s3npFumzVHLGeubSyPs21O3jNqtSppOjSB9iDTyV2GtQrjh5ntVwebfKpCkUSitx3x7TkCb9dylpEZ8+w== +"@storybook/channels@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-7.4.6.tgz#cadd16b91db08005c2b9e4938d3e1d1290d27a40" + integrity sha512-yPv/sfo2c18fM3fvG0i1xse63vG8l33Al/OU0k/dtovltPu001/HVa1QgBgsb/QrEfZtvGjGhmtdVeYb39fv3A== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" qs "^6.10.0" telejson "^7.2.0" tiny-invariant "^1.3.1" -"@storybook/cli@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/cli/-/cli-7.4.0.tgz#a50f435d55e3056547c983c0bfacb2eed63cd692" - integrity sha512-yn27cn3LzhTqpEVX6CzUz13KTJ3jPLA2eM4bO1t7SYUqpDlzw3lET9DIcYIaUAIiL+0r2Js3jW2BsyN/5KmO5w== +"@storybook/cli@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/cli/-/cli-7.4.6.tgz#c322fcfdacf839a55a9c2aaa592a820fdaa1422c" + integrity sha512-rRwaH8pOL+FHz/pJMEkNpMH2xvZvWsrl7obBYw26NQiHmiVSAkfHJicndSN1mwc+p5w+9iXthrgzbLtSAOSvkA== dependencies: "@babel/core" "^7.22.9" "@babel/preset-env" "^7.22.9" "@babel/types" "^7.22.5" "@ndelangen/get-tarball" "^3.0.7" - "@storybook/codemod" "7.4.0" - "@storybook/core-common" "7.4.0" - "@storybook/core-server" "7.4.0" - "@storybook/csf-tools" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/telemetry" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/codemod" "7.4.6" + "@storybook/core-common" "7.4.6" + "@storybook/core-events" "7.4.6" + "@storybook/core-server" "7.4.6" + "@storybook/csf-tools" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/telemetry" "7.4.6" + "@storybook/types" "7.4.6" "@types/semver" "^7.3.4" "@yarnpkg/fslib" "2.10.3" "@yarnpkg/libzip" "2.3.0" @@ -2430,25 +2448,33 @@ ts-dedent "^2.0.0" util-deprecate "^1.0.2" -"@storybook/client-logger@7.4.0", "@storybook/client-logger@^7.0.0-beta.0 || ^7.0.0-rc.0 || ^7.0.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-7.4.0.tgz#f90aa5ee29d540074f6e4890bae71836ac87273c" - integrity sha512-4pBnf7+df1wXEVcF1civqxbrtccGGHQkfWQkJo49s53RXvF7SRTcif6XTx0V3cQV0v7I1C5mmLm0LNlmjPRP1Q== +"@storybook/client-api@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-7.4.6.tgz#0007fa86d9aae34b6bde0220c0b68fc9d78bde73" + integrity sha512-O8yA/xEzPW9Oe3s5VJAFor2d2KwXHjUZ1gvou3o14zu/TJLgXwol0qBBr+YLRO2rcNNJ51pAIGwAT5bgmpUaeg== + dependencies: + "@storybook/client-logger" "7.4.6" + "@storybook/preview-api" "7.4.6" + +"@storybook/client-logger@7.4.6", "@storybook/client-logger@^7.0.0-beta.0 || ^7.0.0-rc.0 || ^7.0.0": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-7.4.6.tgz#3346f3ae51abb3ce61bf1a7d083d32f27b8f718f" + integrity sha512-XDw31ZziU//86PKuMRnmc+L/G0VopaGKENQOGEpvAXCU9IZASwGKlKAtcyosjrpi+ZiUXlMgUXCpXM7x3b1Ehw== dependencies: "@storybook/global" "^5.0.0" -"@storybook/codemod@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/codemod/-/codemod-7.4.0.tgz#c23ef80253b5a5998c83e49e74bd6ff62683d27a" - integrity sha512-XqNhv5bec+L7TJ5tXdsMalmJazwaFMVVxoNlnb0f9zKhovAEF2F6hl6+Pnd2avRomH9+1q7EM+GwrTCAvzAfzg== +"@storybook/codemod@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/codemod/-/codemod-7.4.6.tgz#b884304c246de6de22faa94e76cd38f129bd827e" + integrity sha512-lxmwEpwksCaAq96APN2YlooSDfKjJ1vKzN5Ni2EqQzf2TEXl7XQjLacHd7OOaII1kfsy+D5gNG4N5wBo7Ub30g== dependencies: "@babel/core" "^7.22.9" "@babel/preset-env" "^7.22.9" "@babel/types" "^7.22.5" "@storybook/csf" "^0.1.0" - "@storybook/csf-tools" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/csf-tools" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/types" "7.4.6" "@types/cross-spawn" "^6.0.2" cross-spawn "^7.0.3" globby "^11.0.2" @@ -2457,37 +2483,38 @@ prettier "^2.8.0" recast "^0.23.1" -"@storybook/components@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-7.4.0.tgz#0cc83ff89dd9cdcde3eaeeb7b3fbcf2036ba6fb8" - integrity sha512-GGnQrI4NXwri/PqNjhO1vNv4tC7RBjY87ce9WHBq1ueat3kBakdqV97NzScoldXarkkKK6grBqmhw9jE5PfzhQ== +"@storybook/components@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/components/-/components-7.4.6.tgz#e804407bd3a047e9f6026edfbbe188244661b55a" + integrity sha512-nIRBhewAgrJJVafyCzuaLx1l+YOfvvD5dOZ0JxZsxJsefOdw1jFpUqUZ5fIpQ2moyvrR0mAUFw378rBfMdHz5Q== dependencies: "@radix-ui/react-select" "^1.2.2" "@radix-ui/react-toolbar" "^1.0.4" - "@storybook/client-logger" "7.4.0" + "@storybook/client-logger" "7.4.6" "@storybook/csf" "^0.1.0" "@storybook/global" "^5.0.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" memoizerific "^1.11.3" use-resize-observer "^9.1.0" util-deprecate "^1.0.2" -"@storybook/core-client@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/core-client/-/core-client-7.4.0.tgz#b2b683ebc44d0dfaa7a886f7bb1a5fc74a3d0965" - integrity sha512-AhysJS2HnydB8Jc+BMVzK5VLHa1liJjxroNsd+ZTgGUhD7R8wvozrswQgY4MLFtcaLwN/wDWlK2YavSBqmc94Q== +"@storybook/core-client@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/core-client/-/core-client-7.4.6.tgz#880ab2a431133912d0b76f2273cefe95b287d8ca" + integrity sha512-tfgxAHeCvMcs6DsVgtb4hQSDaCHeAPJOsoyhb47eDQfk4OmxzriM0qWucJV5DePSMi+KutX/rN2u0JxfOuN68g== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/preview-api" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/preview-api" "7.4.6" -"@storybook/core-common@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/core-common/-/core-common-7.4.0.tgz#da71afd79a12cfb5565351f184f6797214a5da79" - integrity sha512-QKrBL46ZFdfTjlZE3f7b59Q5+frOHWIJ64sC9BZ2PHkZkGjFeYRDdJJ6EHLYBb+nToynl33dYN1GQz+hQn2vww== +"@storybook/core-common@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/core-common/-/core-common-7.4.6.tgz#8cb3fd94c4c7c5d307fb1606dcb0e06fc8672410" + integrity sha512-05MJFmOM86qvTLtgDskokIFz9txe0Lbhq4L3by1FtF0GwgH+p+W6I94KI7c6ANER+kVZkXQZhiRzwBFnVTW+Cg== dependencies: - "@storybook/node-logger" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/core-events" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/types" "7.4.6" "@types/find-cache-dir" "^3.2.1" "@types/node" "^16.0.0" "@types/node-fetch" "^2.6.4" @@ -2509,33 +2536,33 @@ resolve-from "^5.0.0" ts-dedent "^2.0.0" -"@storybook/core-events@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-7.4.0.tgz#0d50d254d65a678065d5906ac1dcab64396f2f6a" - integrity sha512-JavEo4dw7TQdF5pSKjk4RtqLgsG2R/eWRI8vZ3ANKa0ploGAnQR/eMTfSxf6TUH3ElBWLJhi+lvUCkKXPQD+dw== +"@storybook/core-events@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-7.4.6.tgz#f0b652c623c1afebda42d1702d631cecc1c137bf" + integrity sha512-r5vrE+32lwrJh1NGFr1a0mWjvxo7q8FXYShylcwRWpacmL5NTtLkrXOoJSeGvJ4yKNYkvxQFtOPId4lzDxa32w== dependencies: ts-dedent "^2.0.0" -"@storybook/core-server@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/core-server/-/core-server-7.4.0.tgz#9e624789ff30d9538ac014b038c48fac0ebb7272" - integrity sha512-AcbfXatHVx1by4R2CiPIMgjQlOL3sUbVarkhmgUcL0AWT0zC0SCQWUZdo22en+jZhAraazgXyLGNCVP7A+6Tqg== +"@storybook/core-server@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/core-server/-/core-server-7.4.6.tgz#82a3834d9a063ff01a126f7c1724c8997bdd1555" + integrity sha512-jqmRTGCJ1W0WReImivkisPVaLFT5sjtLnFoAk0feHp6QS5j7EYOPN7CYzliyQmARWTLUEXOVaFf3VD6nJZQhJQ== dependencies: "@aw-web-design/x-default-browser" "1.4.126" "@discoveryjs/json-ext" "^0.5.3" - "@storybook/builder-manager" "7.4.0" - "@storybook/channels" "7.4.0" - "@storybook/core-common" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/builder-manager" "7.4.6" + "@storybook/channels" "7.4.6" + "@storybook/core-common" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/csf" "^0.1.0" - "@storybook/csf-tools" "7.4.0" + "@storybook/csf-tools" "7.4.6" "@storybook/docs-mdx" "^0.1.0" "@storybook/global" "^5.0.0" - "@storybook/manager" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/telemetry" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/manager" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/telemetry" "7.4.6" + "@storybook/types" "7.4.6" "@types/detect-port" "^1.3.0" "@types/node" "^16.0.0" "@types/pretty-hrtime" "^1.0.0" @@ -2555,7 +2582,6 @@ prompts "^2.4.0" read-pkg-up "^7.0.1" semver "^7.3.7" - serve-favicon "^2.5.0" telejson "^7.2.0" tiny-invariant "^1.3.1" ts-dedent "^2.0.0" @@ -2564,36 +2590,36 @@ watchpack "^2.2.0" ws "^8.2.3" -"@storybook/core-webpack@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/core-webpack/-/core-webpack-7.4.0.tgz#0ff348a1590e9b8d425e9aec1ed850e3cfa3e75c" - integrity sha512-1zxzJjRbkcjl++OjYBVTDi0V/yO22Kz3ciPASTvXwrg0fXTXgxwxhJBmgOI4r17oY0kOWnJ1RDsmd95NLGAbGw== +"@storybook/core-webpack@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/core-webpack/-/core-webpack-7.4.6.tgz#d8063c3854f49e383b68ff13311b3767a55eaaed" + integrity sha512-EqQDmd+vKAWOAjoe539LsfP8WvQG9V9i1priMA53u1FOEged8o0NBtRiRy2+JDdUSiGUdpe/X5+V/TyyQw/KWw== dependencies: - "@storybook/core-common" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/core-common" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/types" "7.4.6" "@types/node" "^16.0.0" ts-dedent "^2.0.0" -"@storybook/csf-plugin@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/csf-plugin/-/csf-plugin-7.4.0.tgz#f25ebb30affbc9b4dd61b1fdb12c4a4257a275dc" - integrity sha512-X1L3l/dpz2UYjCEQlFLkW7w1A13pmzDZpJ0lotkV79PALlakMXBeoX3I2E0VMjJATV8wC9RSj56COBAs6HsPeg== +"@storybook/csf-plugin@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/csf-plugin/-/csf-plugin-7.4.6.tgz#63b4498c9be329ba9cdd53bb8cbe66ef225230ec" + integrity sha512-yi7Qa4NSqKOyiJTWCxlB0ih2ijXq6oY5qZKW6MuMMBP14xJNRGLbH5KabpfXgN2T7YECcOWG1uWaGj2veJb1KA== dependencies: - "@storybook/csf-tools" "7.4.0" + "@storybook/csf-tools" "7.4.6" unplugin "^1.3.1" -"@storybook/csf-tools@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/csf-tools/-/csf-tools-7.4.0.tgz#db5c97ee603da9a68511192d701534e356f9e592" - integrity sha512-bKyOmWPyvT50Neq2wCRr2PmVGLVVm6pOw8WL5t5jueD8sRRzo9QdfhEkqmuSyqdsBdt3SiJKL5oA6dqY5Vl9ww== +"@storybook/csf-tools@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/csf-tools/-/csf-tools-7.4.6.tgz#3987e31d5975dcaa8f3dfa4f5e0fb5cd457cbae6" + integrity sha512-ocKpcIUtTBy6hlLY34RUFQyX403cWpB2gGfqvkHbpGe2BQj7EyV0zpWnjsfVxvw+M9OWlCdxHWDOPUgXM33ELw== dependencies: "@babel/generator" "^7.22.9" "@babel/parser" "^7.22.7" "@babel/traverse" "^7.22.8" "@babel/types" "^7.22.5" "@storybook/csf" "^0.1.0" - "@storybook/types" "7.4.0" + "@storybook/types" "7.4.6" fs-extra "^11.1.0" recast "^0.23.1" ts-dedent "^2.0.0" @@ -2617,14 +2643,14 @@ resolved "https://registry.yarnpkg.com/@storybook/docs-mdx/-/docs-mdx-0.1.0.tgz#33ba0e39d1461caf048b57db354b2cc410705316" integrity sha512-JDaBR9lwVY4eSH5W8EGHrhODjygPd6QImRbwjAuJNEnY0Vw4ie3bPkeGfnacB3OBW6u/agqPv2aRlR46JcAQLg== -"@storybook/docs-tools@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/docs-tools/-/docs-tools-7.4.0.tgz#d9109c9c8ec4e90bb24d1acfcc16834a252618eb" - integrity sha512-DzXmt4JorAOePoS+sjQznf8jLPI9D5mdB1eSXjfvmGBQyyehKTZv5+TXuxYvT3iPN4rW4OPrIrQCSIrbULFdwA== +"@storybook/docs-tools@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/docs-tools/-/docs-tools-7.4.6.tgz#cbba8dadd13adc7a9a3c792261ca875ff12ae451" + integrity sha512-nZj1L/8WwKWWJ41FW4MaKGajZUtrhnr9UwflRCkQJaWhAKmDfOb5M5TqI93uCOULpFPOm5wpoMBz2IHInQ2Lrg== dependencies: - "@storybook/core-common" "7.4.0" - "@storybook/preview-api" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/core-common" "7.4.6" + "@storybook/preview-api" "7.4.6" + "@storybook/types" "7.4.6" "@types/doctrine" "^0.0.3" doctrine "^3.0.0" lodash "^4.17.21" @@ -2634,30 +2660,30 @@ resolved "https://registry.yarnpkg.com/@storybook/global/-/global-5.0.0.tgz#b793d34b94f572c1d7d9e0f44fac4e0dbc9572ed" integrity sha512-FcOqPAXACP0I3oJ/ws6/rrPT9WGhu915Cg8D02a9YxLo0DE9zI+a9A5gRGvmQ09fiWPukqI8ZAEoQEdWUKMQdQ== -"@storybook/instrumenter@7.4.0", "@storybook/instrumenter@^7.0.0-beta.0 || ^7.0.0-rc.0 || ^7.0.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/instrumenter/-/instrumenter-7.4.0.tgz#197335f25a45ecdc2c5f458bff1c2481d7ffe08c" - integrity sha512-jZKxLK0lGKxY8LEul6GP7s+PDlNuXT4JU6MnPY9+SVSo23lP0pAOxo/ojV8WTLf48tcoyL3ztSfbYhxnaJvBfw== +"@storybook/instrumenter@7.4.6", "@storybook/instrumenter@^7.0.0-beta.0 || ^7.0.0-rc.0 || ^7.0.0": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/instrumenter/-/instrumenter-7.4.6.tgz#7a941a31aeae6cc1864689288d66cb282368b602" + integrity sha512-K5atRoVFCl6HEgkSxIbwygpzgE/iROc7BrtJ3z3a7E70sanFr6Jxt6Egu6fz2QkL3ef4EWpXMnle2vhEfG29pA== dependencies: - "@storybook/channels" "7.4.0" - "@storybook/client-logger" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/channels" "7.4.6" + "@storybook/client-logger" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/preview-api" "7.4.0" + "@storybook/preview-api" "7.4.6" -"@storybook/manager-api@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/manager-api/-/manager-api-7.4.0.tgz#aee0153df1583459b7e1e64e1d8c46fb49a584c8" - integrity sha512-sBfkkt0eZGTozeKrbzMtWLEOQrgqdk24OUJlkc2IDaucR1CBNjoCMjNeYg7cLDw0rXE8W3W3AdWtJnfsUbLMAQ== +"@storybook/manager-api@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/manager-api/-/manager-api-7.4.6.tgz#e74bd0a0a983d6b9b7f66dfe0d94d8465f5e7a34" + integrity sha512-inrm3DIbCp8wjXSN/wK6e6i2ysQ/IEmtC7IN0OJ7vdrp+USCooPT448SQTUmVctUGCFmOU3fxXByq8g77oIi7w== dependencies: - "@storybook/channels" "7.4.0" - "@storybook/client-logger" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/channels" "7.4.6" + "@storybook/client-logger" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/csf" "^0.1.0" "@storybook/global" "^5.0.0" - "@storybook/router" "7.4.0" - "@storybook/theming" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/router" "7.4.6" + "@storybook/theming" "7.4.6" + "@storybook/types" "7.4.6" dequal "^2.0.2" lodash "^4.17.21" memoizerific "^1.11.3" @@ -2666,38 +2692,38 @@ telejson "^7.2.0" ts-dedent "^2.0.0" -"@storybook/manager@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/manager/-/manager-7.4.0.tgz#21a825c9145f56ca6c38d3e9d3546b311a6db14e" - integrity sha512-uOSdPBEBKg8WORUZ5HKHb4KnKcTyA5j5Q8MWy/NBaRd22JR3fQkZiKuHer9WJIOQTU+fb6KDmzhZbCTKg5Euog== +"@storybook/manager@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/manager/-/manager-7.4.6.tgz#96acb0ab60e05b74947d7895e04efa557fd8892f" + integrity sha512-kA1hUDxpn1i2SO9OinvLvVXDeL4xgJkModp+pbE8IXv4NJWReNq1ecMeQCzPLS3Sil2gnrullQ9uYXsnZ9bxxA== "@storybook/mdx2-csf@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@storybook/mdx2-csf/-/mdx2-csf-1.1.0.tgz#97f6df04d0bf616991cc1005a073ac004a7281e5" integrity sha512-TXJJd5RAKakWx4BtpwvSNdgTDkKM6RkXU8GK34S/LhidQ5Pjz3wcnqb0TxEkfhK/ztbP8nKHqXFwLfa2CYkvQw== -"@storybook/node-logger@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-7.4.0.tgz#808ed8a63e3bc2f97a2d276b4e8ddaa72b79deb0" - integrity sha512-tWSWkYyAvp6SxjIBaTklg29avzv/3Lv4c0dOG2o5tz79PyZkq9v6sQtwLLoI8EJA9Mo8Z08vaJp8NZyDQ9RCuA== +"@storybook/node-logger@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-7.4.6.tgz#d92eb7e99cb8aefffe67eb63583a21398ce9a0ab" + integrity sha512-djZb310Q27GviDug1XBv0jOEDLCiwr4hhDE0aifCEKZpfNCi/EaP31nbWimFzZwxu4hE/YAPWExzScruR1zw9Q== -"@storybook/postinstall@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/postinstall/-/postinstall-7.4.0.tgz#81f3bef31b566e26d616f9c3ce567f07ff143cc7" - integrity sha512-ZVBZggqkuj7ysfuHSCd/J7ovWV06zY9uWf+VU+Zw7ZeojDT8QHFrCurPsN7D9679j9vRU1/kSzqvAiStALS33g== +"@storybook/postinstall@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/postinstall/-/postinstall-7.4.6.tgz#2d5da361fc8baee1866c80b2244815a9e217b843" + integrity sha512-TqI5BucPAGRWrkh55BYiG2/gHLFtC0In4cuu0GsUzB/1jc4i51npLRorCwhmT7r7YliGl5F7JaP0Bni/qHN3Lg== -"@storybook/preset-react-webpack@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/preset-react-webpack/-/preset-react-webpack-7.4.0.tgz#5d8c1a776fe46ab732a165129da57b89483e1e6b" - integrity sha512-9iZ9lvhRUYtxXmJMqR7txNyatrHryqo6FSKzfpUzmcCySn3d7mu9I6LEPxEir43TkPnBio3W4EsbvtIhjJ5ekA== +"@storybook/preset-react-webpack@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/preset-react-webpack/-/preset-react-webpack-7.4.6.tgz#11c07fbfc06e87d42da87c9e07f05e5a5b9a1339" + integrity sha512-FfJvlk3bJfg66t06YLiyu+1o/DZN3uNfFP37zv5cJux7TpdmJRV/4m9LKQPJOvcnWBQYem8xX8k5cRS29vdW5g== dependencies: "@babel/preset-flow" "^7.22.5" "@babel/preset-react" "^7.22.5" "@pmmmwh/react-refresh-webpack-plugin" "^0.5.5" - "@storybook/core-webpack" "7.4.0" - "@storybook/docs-tools" "7.4.0" - "@storybook/node-logger" "7.4.0" - "@storybook/react" "7.4.0" + "@storybook/core-webpack" "7.4.6" + "@storybook/docs-tools" "7.4.6" + "@storybook/node-logger" "7.4.6" + "@storybook/react" "7.4.6" "@storybook/react-docgen-typescript-plugin" "1.0.6--canary.9.0c3f3b7.0" "@types/node" "^16.0.0" "@types/semver" "^7.3.4" @@ -2708,17 +2734,17 @@ semver "^7.3.7" webpack "5" -"@storybook/preview-api@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/preview-api/-/preview-api-7.4.0.tgz#46818910545735bef43965651eef380a6f481f4b" - integrity sha512-ndXO0Nx+eE7ktVE4EqHpQZ0guX7yYBdruDdJ7B739C0+OoPWsJN7jAzUqq0NXaBcYrdaU5gTy+KnWJUt8R+OyA== +"@storybook/preview-api@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/preview-api/-/preview-api-7.4.6.tgz#a42749ff867216b89849ada6ac0f49f4fa8f03a8" + integrity sha512-byUS/Opt3ytWD4cWz3sNEKw5Yks8MkQgRN+GDSyIomaEAQkLAM0rchPC0MYjwCeUSecV7IIQweNX5RbV4a34BA== dependencies: - "@storybook/channels" "7.4.0" - "@storybook/client-logger" "7.4.0" - "@storybook/core-events" "7.4.0" + "@storybook/channels" "7.4.6" + "@storybook/client-logger" "7.4.6" + "@storybook/core-events" "7.4.6" "@storybook/csf" "^0.1.0" "@storybook/global" "^5.0.0" - "@storybook/types" "7.4.0" + "@storybook/types" "7.4.6" "@types/qs" "^6.9.5" dequal "^2.0.2" lodash "^4.17.21" @@ -2728,10 +2754,10 @@ ts-dedent "^2.0.0" util-deprecate "^1.0.2" -"@storybook/preview@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/preview/-/preview-7.4.0.tgz#a58756ac9b12ea21f203032eca47991946257b53" - integrity sha512-R4LMTvUrVAbcUetRbAXpY3frkwD0eysqHrByiR73040+ngzDwtZOBAy0JfO3jw3WrWv2dn3kWlao5aEwVc9Exw== +"@storybook/preview@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/preview/-/preview-7.4.6.tgz#b0d9f5a843d4c7aea8857f6bc5d7253cc04c7c4b" + integrity sha512-2RPXusJ4CTDrIipIKKvbotD7fP0+8VzoFjImunflIrzN9rni+2rq5eMjqlXAaB+77w064zIR4uDUzI9fxsMDeQ== "@storybook/react-docgen-typescript-plugin@1.0.6--canary.9.0c3f3b7.0": version "1.0.6--canary.9.0c3f3b7.0" @@ -2746,33 +2772,33 @@ react-docgen-typescript "^2.2.2" tslib "^2.0.0" -"@storybook/react-dom-shim@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/react-dom-shim/-/react-dom-shim-7.4.0.tgz#12f137f00f2a209cb49a4084475dd93f23e0678a" - integrity sha512-TLpb8a2hnWJoRLqoXpMADh82BFfRZll6JI2Waf1FjnvJ4SF9eS0zBbxybrjW3lFAHWy2XJi+rwcK8FiPj0iBoQ== +"@storybook/react-dom-shim@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/react-dom-shim/-/react-dom-shim-7.4.6.tgz#7f7e01dbb6abe104ae140e25b7ed98c347a5fb9f" + integrity sha512-DSq8l9FDocUF1ooVI+TF83pddj1LynE/Hv0/y8XZhc3IgJ/HkuOQuUmfz29ezgfAi9gFYUR8raTIBi3/xdoRmw== "@storybook/react-webpack5@^7.0.27": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/react-webpack5/-/react-webpack5-7.4.0.tgz#084be7488809b7874654be4e90da3024c4bdf37b" - integrity sha512-dhcWU1gpY3KgbrHJwd10ND+VdOVU07QVeijRnR0qONnruOCXKawjhTGoWdCOWXkWX5IZjjLczMflnmrQ2eSkjA== + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/react-webpack5/-/react-webpack5-7.4.6.tgz#585256d9e44ba24514a7391ac786379f8f81551a" + integrity sha512-OSwf+E2tRcfBmzCH+WwM7JlfEYjg5Womi1yrtotfcjVXAU6ubHOk2G87zsrKLp/TeCOFM2aHohHBTyWUCejQKQ== dependencies: - "@storybook/builder-webpack5" "7.4.0" - "@storybook/preset-react-webpack" "7.4.0" - "@storybook/react" "7.4.0" + "@storybook/builder-webpack5" "7.4.6" + "@storybook/preset-react-webpack" "7.4.6" + "@storybook/react" "7.4.6" "@types/node" "^16.0.0" -"@storybook/react@7.4.0", "@storybook/react@^7.0.27": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/react/-/react-7.4.0.tgz#18d29aa49f0b784b46613d26a243caf473177403" - integrity sha512-QWsFw/twsNkcWI6brW06sugQQ5dV+fJm4IrEeI28cA4cBHK9G9HKOwCHoXDUWikzZx48XYMpNfs/WyIkuGmEqg== +"@storybook/react@7.4.6", "@storybook/react@^7.0.27": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/react/-/react-7.4.6.tgz#240a78547add8db69b5d2eeae3d6c45feb79559b" + integrity sha512-w0dVo64baFFPTGpUOWFqkKsu6pQincoymegSNgqaBd5DxEyMDRiRoTWSJHMKE9BwgE8SyWhRkP1ak1mkccSOhQ== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/core-client" "7.4.0" - "@storybook/docs-tools" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/core-client" "7.4.6" + "@storybook/docs-tools" "7.4.6" "@storybook/global" "^5.0.0" - "@storybook/preview-api" "7.4.0" - "@storybook/react-dom-shim" "7.4.0" - "@storybook/types" "7.4.0" + "@storybook/preview-api" "7.4.6" + "@storybook/react-dom-shim" "7.4.6" + "@storybook/types" "7.4.6" "@types/escodegen" "^0.0.6" "@types/estree" "^0.0.51" "@types/node" "^16.0.0" @@ -2788,23 +2814,31 @@ type-fest "~2.19" util-deprecate "^1.0.2" -"@storybook/router@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/router/-/router-7.4.0.tgz#627f824bfd9cc4653ee84581fc09373ab1463336" - integrity sha512-IATdtFL5C3ryjNQSwaQfrmiOZiVFoVNMevMoBGDC++g0laSW40TGiNK6fUjUDBKuOgbuDt4Svfbl29k21GefEg== +"@storybook/router@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/router/-/router-7.4.6.tgz#54d3014af26f82d79eae7dc5b0e6a89509b11912" + integrity sha512-Vl1esrHkcHxDKqc+HY7+6JQpBPW3zYvGk0cQ2rxVMhWdLZTAz1hss9DqzN9tFnPyfn0a1Q77EpMySkUrvWKKNQ== dependencies: - "@storybook/client-logger" "7.4.0" + "@storybook/client-logger" "7.4.6" memoizerific "^1.11.3" qs "^6.10.0" -"@storybook/telemetry@7.4.0", "@storybook/telemetry@^7.1.0-alpha.32": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/telemetry/-/telemetry-7.4.0.tgz#04e47a2d9decf7671273130a9af9d231a8c3d2e8" - integrity sha512-oxCB3kIbpiDWuXEtQhk/j6t1/h0KKWAuvxmcwGPxwhEvj/uNtoM+f1qhoDID9waxNo4AccU9Px+1ZJQ+2ejcDg== +"@storybook/store@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/store/-/store-7.4.6.tgz#e83d65af2e0c142d8da941defc252ccc18f504fc" + integrity sha512-tlm9rQ+djkYjEyCuEjaUv+c+jVgwnMEF9mZxnOoA6zrzU2g0S/1oE9/MdVLByGbH67U0NuuP0FcvsWLhAOQzjQ== dependencies: - "@storybook/client-logger" "7.4.0" - "@storybook/core-common" "7.4.0" - "@storybook/csf-tools" "7.4.0" + "@storybook/client-logger" "7.4.6" + "@storybook/preview-api" "7.4.6" + +"@storybook/telemetry@7.4.6", "@storybook/telemetry@^7.1.0-alpha.32": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/telemetry/-/telemetry-7.4.6.tgz#748c978a188c988d688a50635025c12e7e90f924" + integrity sha512-c8p/C1NIH8EMBviZkBCx8MMDk6rrITJ+b29DEp5MaWSRlklIVyhGiC4RPIRv6sxJwlD41PnqWVFtfu2j2eXLdQ== + dependencies: + "@storybook/client-logger" "7.4.6" + "@storybook/core-common" "7.4.6" + "@storybook/csf-tools" "7.4.6" chalk "^4.1.0" detect-package-manager "^2.0.1" fetch-retry "^5.0.2" @@ -2822,25 +2856,24 @@ "@testing-library/user-event" "^13.2.1" ts-dedent "^2.2.0" -"@storybook/theming@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-7.4.0.tgz#f5d9f8f55c41e08c0f50b57d9fb0e159ed595274" - integrity sha512-eLjEf6G3cqlegfutF/iUrec9LrUjKDj7K4ZhGdACWrf7bQcODs99EK62e9/d8GNKr4b+QMSEuM6XNGaqdPnuzQ== +"@storybook/theming@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-7.4.6.tgz#72f7e42a57347d84128cef9abfba5ac1a810118e" + integrity sha512-HW77iJ9ptCMqhoBOYFjRQw7VBap+38fkJGHP5KylEJCyYCgIAm2dEcQmtWpMVYFssSGcb6djfbtAMhYU4TL4Iw== dependencies: "@emotion/use-insertion-effect-with-fallbacks" "^1.0.0" - "@storybook/client-logger" "7.4.0" + "@storybook/client-logger" "7.4.6" "@storybook/global" "^5.0.0" memoizerific "^1.11.3" -"@storybook/types@7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@storybook/types/-/types-7.4.0.tgz#71ce550d4d469f6aaf9777fc7432db9fb67f53f9" - integrity sha512-XyzYkmeklywxvElPrIWLczi/PWtEdgTL6ToT3++FVxptsC2LZKS3Ue+sBcQ9xRZhkRemw4HQHwed5EW3dO8yUg== +"@storybook/types@7.4.6": + version "7.4.6" + resolved "https://registry.yarnpkg.com/@storybook/types/-/types-7.4.6.tgz#536f21b82e1f809052b4d09802f99a580e960175" + integrity sha512-6QLXtMVsFZFpzPkdGWsu/iuc8na9dnS67AMOBKm5qCLPwtUJOYkwhMdFRSSeJthLRpzV7JLAL8Kwvl7MFP3QSw== dependencies: - "@storybook/channels" "7.4.0" + "@storybook/channels" "7.4.6" "@types/babel__core" "^7.0.0" "@types/express" "^4.7.0" - "@types/react" "^16.14.34" file-system-cache "2.3.0" "@svgr/babel-plugin-add-jsx-attribute@8.0.0": @@ -2949,78 +2982,84 @@ "@svgr/plugin-jsx" "8.1.0" "@svgr/plugin-svgo" "8.1.0" -"@swc/core-darwin-arm64@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.83.tgz#eaeafce9bc9b8fce7d7c3d872b160b7660db8149" - integrity sha512-Plz2IKeveVLivbXTSCC3OZjD2MojyKYllhPrn9RotkDIZEFRYJZtW5/Ik1tJW/2rzu5HVKuGYrDKdScVVTbOxQ== - -"@swc/core-darwin-x64@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.83.tgz#45c2d73843e5e2e34e6e9b8e5fd6e19b419b75ae" - integrity sha512-FBGVg5IPF/8jQ6FbK60iDUHjv0H5+LwfpJHKH6wZnRaYWFtm7+pzYgreLu3NTsm3m7/1a7t0+7KURwBGUaJCCw== - -"@swc/core-linux-arm-gnueabihf@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.83.tgz#3dcee525f6667dd92db0640991a3f03764b76dea" - integrity sha512-EZcsuRYhGkzofXtzwDjuuBC/suiX9s7zeg2YYXOVjWwyebb6BUhB1yad3mcykFQ20rTLO9JUyIaiaMYDHGobqw== - -"@swc/core-linux-arm64-gnu@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.83.tgz#3521c8b2f05a5d0348e538af3a5742d607ad6a8d" - integrity sha512-khI41szLHrCD/cFOcN4p2SYvZgHjhhHlcMHz5BksRrDyteSJKu0qtWRZITVom0N/9jWoAleoFhMnFTUs0H8IWA== - -"@swc/core-linux-arm64-musl@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.83.tgz#2c16d47e036176591761187455d4c2c4d984c14c" - integrity sha512-zgT7yNOdbjHcGAwvys79mbfNLK65KBlPJWzeig+Yk7I8TVzmaQge7B6ZS/gwF9/p+8TiLYo/tZ5aF2lqlgdSVw== - -"@swc/core-linux-x64-gnu@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.83.tgz#2eb0222eafeb247b9d1715f106e312566160bca1" - integrity sha512-x+mH0Y3NC/G0YNlFmGi3vGD4VOm7IPDhh+tGrx6WtJp0BsShAbOpxtfU885rp1QweZe4qYoEmGqiEjE2WrPIdA== - -"@swc/core-linux-x64-musl@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.83.tgz#8c4edd4754410cfe662a112a92f0c71d4fbf070a" - integrity sha512-s5AYhAOmetUwUZwS5g9qb92IYgNHHBGiY2mTLImtEgpAeBwe0LPDj6WrujxCBuZnaS55mKRLLOuiMZE5TpjBNA== - -"@swc/core-win32-arm64-msvc@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.83.tgz#153ef6fc6e41e33a47f9f1524fe6bad2fc0158b3" - integrity sha512-yw2rd/KVOGs95lRRB+killLWNaO1dy4uVa8Q3/4wb5txlLru07W1m041fZLzwOg/1Sh0TMjJgGxj0XHGR3ZXhQ== - -"@swc/core-win32-ia32-msvc@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.83.tgz#7757277e8618a638cb89e51a1e0959417eec6441" - integrity sha512-POW+rgZ6KWqBpwPGIRd2/3pcf46P+UrKBm4HLt5IwbHvekJ4avIM8ixJa9kK0muJNVJcDpaZgxaU1ELxtJ1j8w== - -"@swc/core-win32-x64-msvc@1.3.83": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.83.tgz#92da90b84a9b88fdd92b6d1256fd6608e668541f" - integrity sha512-CiWQtkFnZElXQUalaHp+Wacw0Jd+24ncRYhqaJ9YKnEQP1H82CxIIuQqLM8IFaLpn5dpY6SgzaeubWF46hjcLA== +"@swc/core-darwin-arm64@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.91.tgz#3bb751899cd208be261c48190b75c87171be79b4" + integrity sha512-7kHGiQ1he5khcEeJuHDmLZPM3rRL/ith5OTmV6bOPsoHi46kLeixORW+ts1opC3tC9vu6xbk16xgX0QAJchc1w== + +"@swc/core-darwin-x64@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.91.tgz#9860087421ac258f59c5aaede4b76dfe680bb28d" + integrity sha512-8SpU18FbFpZDVzsHsAwdI1thF/picQGxq9UFxa8W+T9SDnbsqwFJv/6RqKJeJoDV6qFdl2OLjuO0OL7xrp0qnQ== + +"@swc/core-linux-arm-gnueabihf@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.91.tgz#ed321346fea49cc07cdb1217b3ae5c7f3f8ba7ae" + integrity sha512-fOq4Cy8UbwX1yf0WB0d8hWZaIKCnPtPGguRqdXGLfwvhjZ9SIErT6PnmGTGRbQCNCIkOZWHKyTU0r8t2dN3haQ== + +"@swc/core-linux-arm64-gnu@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.91.tgz#bdabe0364f2851f7c1446a5da82b2ccc2a021f65" + integrity sha512-fki4ioRP/Esy4vdp8T34RCV+V9dqkRmOt763pf74pdiyFV2dPLXa5lnw/XvR1RTfPGknrYgjEQLCfZlReTryRw== + +"@swc/core-linux-arm64-musl@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.91.tgz#e9e14a8f228bddc68ffc5ab4495000ae8a56ced2" + integrity sha512-XrG+DUUqNtfVLcJ20imby7fpBwQNG5VsEQBzQndSonPyUOa2YkTbBb60YDondfQGDABopuHH8gHN8o2H2/VCnQ== + +"@swc/core-linux-x64-gnu@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.91.tgz#283baa984b370944cec8fe4a3a64a756cc40cccc" + integrity sha512-d11bYhX+YPBr/Frcjc6eVn3C0LuS/9U1Li9EmQ+6s9EpYtYRl2ygSlC8eueLbaiazBnCVYFnc8bU4o0kc5B9sw== + +"@swc/core-linux-x64-musl@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.91.tgz#18d3e773d150061aa2210149d4abff56ff1465fc" + integrity sha512-2SRp5Dke2P4jCQePkDx9trkkTstnRpZJVw5r3jvYdk0zeO6iC4+ZPvvoWXJLigqQv/fZnIiSUfJ6ssOoaEqTzQ== + +"@swc/core-win32-arm64-msvc@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.91.tgz#85a1d2b5c6292c98865ebbc2ad07be23e6869005" + integrity sha512-l9qKXikOxj42UIjbeZpz9xtBmr736jOMqInNP8mVF2/U+ws5sI8zJjcOFFtfis4ru7vWCXhB1wtltdlJYO2vGA== + +"@swc/core-win32-ia32-msvc@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.91.tgz#023501d012e3993933e06a9874e5568d38fbdb24" + integrity sha512-+s+52O0QVPmzOgjEe/rcb0AK6q/J7EHKwAyJCu/FaYO9df5ovE0HJjSKP6HAF0dGPO5hkENrXuNGujofUH9vtQ== + +"@swc/core-win32-x64-msvc@1.3.91": + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.91.tgz#a70898460d3a91e59d14c4a0a1e772fb00643d11" + integrity sha512-7u9HDQhjUC3Gv43EFW84dZtduWCSa4MgltK+Sp9zEGti6WXqDPu/ESjvDsQEVYTBEMEvZs/xVAXPgLVHorV5nQ== "@swc/core@^1.3.49": - version "1.3.83" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.83.tgz#2902e0bc5ee9c2fcdfb241c8b993c216bc730fe5" - integrity sha512-PccHDgGQlFjpExgJxH91qA3a4aifR+axCFJ4RieCoiI0m5gURE4nBhxzTBY5YU/YKTBmPO8Gc5Q6inE3+NquWg== + version "1.3.91" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.91.tgz#4d7978846da67bfbe20486574d07f204d6891805" + integrity sha512-r950d0fdlZ8qbSDyvApn3HyCojiZE8xpgJzQvypeMi32dalYwugdJKWyLB55JIGMRGJ8+lmVvY4MPGkSR3kXgA== dependencies: - "@swc/types" "^0.1.4" + "@swc/counter" "^0.1.1" + "@swc/types" "^0.1.5" optionalDependencies: - "@swc/core-darwin-arm64" "1.3.83" - "@swc/core-darwin-x64" "1.3.83" - "@swc/core-linux-arm-gnueabihf" "1.3.83" - "@swc/core-linux-arm64-gnu" "1.3.83" - "@swc/core-linux-arm64-musl" "1.3.83" - "@swc/core-linux-x64-gnu" "1.3.83" - "@swc/core-linux-x64-musl" "1.3.83" - "@swc/core-win32-arm64-msvc" "1.3.83" - "@swc/core-win32-ia32-msvc" "1.3.83" - "@swc/core-win32-x64-msvc" "1.3.83" - -"@swc/types@^0.1.4": - version "0.1.4" - resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.4.tgz#8d647e111dc97a8e2881bf71c2ee2d011698ff10" - integrity sha512-z/G02d+59gyyUb7KYhKi9jOhicek6QD2oMaotUyG+lUkybpXoV49dY9bj7Ah5Q+y7knK2jU67UTX9FyfGzaxQg== + "@swc/core-darwin-arm64" "1.3.91" + "@swc/core-darwin-x64" "1.3.91" + "@swc/core-linux-arm-gnueabihf" "1.3.91" + "@swc/core-linux-arm64-gnu" "1.3.91" + "@swc/core-linux-arm64-musl" "1.3.91" + "@swc/core-linux-x64-gnu" "1.3.91" + "@swc/core-linux-x64-musl" "1.3.91" + "@swc/core-win32-arm64-msvc" "1.3.91" + "@swc/core-win32-ia32-msvc" "1.3.91" + "@swc/core-win32-x64-msvc" "1.3.91" + +"@swc/counter@^0.1.1": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.2.tgz#bf06d0770e47c6f1102270b744e17b934586985e" + integrity sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw== + +"@swc/types@^0.1.5": + version "0.1.5" + resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.5.tgz#043b731d4f56a79b4897a3de1af35e75d56bc63a" + integrity sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw== "@tanstack/match-sorter-utils@^8.7.0": version "8.8.4" @@ -3029,26 +3068,26 @@ dependencies: remove-accents "0.4.2" -"@tanstack/query-core@4.35.0": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-4.35.0.tgz#61e5cf9363b423ed665740c422902e65619eb7da" - integrity sha512-4GMcKQuLZQi6RFBiBZNsLhl+hQGYScRZ5ZoVq8QAzfqz9M7vcGin/2YdSESwl7WaV+Qzsb5CZOAbMBes4lNTnA== +"@tanstack/query-core@4.35.7": + version "4.35.7" + resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-4.35.7.tgz#31d6f520ab8abedb6024d2d870af8afca764d048" + integrity sha512-PgDJtX75ubFS0WCYFM7DqEoJ4QbxU3S5OH3gJSI40xr7UVVax3/J4CM3XUMOTs+EOT5YGEfssi3tfRVGte4DEw== "@tanstack/react-query-devtools@^4.32.6": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@tanstack/react-query-devtools/-/react-query-devtools-4.35.0.tgz#5c28920f238c01033cb374e4664cd5f0fbccb113" - integrity sha512-tzN0K70idRsqnfLdUcQC3eCrv28kLIAB6/H1zsGdIw7Wmj5VgTxPmpEVc3rHQjKt0LZsvZTLmaLnI6FCI3VUZw== + version "4.35.7" + resolved "https://registry.yarnpkg.com/@tanstack/react-query-devtools/-/react-query-devtools-4.35.7.tgz#782a09b4ebf29fda445b018b462aacc96e864c2f" + integrity sha512-oe3reHNvXBTUvNb9jwLY8EYOXyp8Oq8/c40iwpXBnEkAtJI+RryrCXaGKFTivg72roPcYHzKILQHR9jbX8sn1Q== dependencies: "@tanstack/match-sorter-utils" "^8.7.0" superjson "^1.10.0" use-sync-external-store "^1.2.0" "@tanstack/react-query@^4.32.6": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-4.35.0.tgz#6286d2706e69384accc4d6b9ff8e4becd427db74" - integrity sha512-LLYDNnM9ewYHgjm2rzhk4KG/puN2rdoqCUD+N9+V7SwlsYwJk5ypX58rpkoZAhFyZ+KmFUJ7Iv2lIEOoUqydIg== + version "4.35.7" + resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-4.35.7.tgz#35a1db50156411b2a9eb68a020bae416948939db" + integrity sha512-0MankquP/6EOM2ATfEov6ViiKemey5uTbjGlFMX1xGotwNaqC76YKDMJdHumZupPbZcZPWAeoPGEHQmVKIKoOQ== dependencies: - "@tanstack/query-core" "4.35.0" + "@tanstack/query-core" "4.35.7" use-sync-external-store "^1.2.0" "@testing-library/dom@^8.3.0": @@ -3066,9 +3105,9 @@ pretty-format "^27.0.2" "@testing-library/dom@^9.0.0": - version "9.3.1" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.1.tgz#8094f560e9389fb973fe957af41bf766937a9ee9" - integrity sha512-0DGPd9AR3+iDTjGoMpxIkAsUihHZ3Ai6CneU6bRRrffXMgzCdlNk43jTrD2/5LT6CBb3MWTP8v510JzYtahD2w== + version "9.3.3" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.3.tgz#108c23a5b0ef51121c26ae92eb3179416b0434f5" + integrity sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw== dependencies: "@babel/code-frame" "^7.10.4" "@babel/runtime" "^7.12.5" @@ -3111,9 +3150,9 @@ "@babel/runtime" "^7.12.5" "@testing-library/user-event@^14.4.3": - version "14.4.3" - resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.4.3.tgz#af975e367743fa91989cd666666aec31a8f50591" - integrity sha512-kCUc5MEwaEMakkO5x7aoD+DLi02ehmEM2QCGWvNqAS1dV/fAvORWEjnjsEIvml59M7Y5kCkWN6fCCyPOe8OL6Q== + version "14.5.1" + resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.5.1.tgz#27337d72046d5236b32fd977edee3f74c71d332f" + integrity sha512-UCcUKrUYGj7ClomOo2SpNVvx4/fkd/2BbIHDCle8A0ax+P3bU7yJwDBDrS6ZwdTMARWTGODX1hEsCcO+7beJjg== "@tootallnate/once@2": version "2.0.0" @@ -3126,14 +3165,14 @@ integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== "@types/aria-query@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.1.tgz#3286741fb8f1e1580ac28784add4c7a1d49bdfbc" - integrity sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q== + version "5.0.2" + resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.2.tgz#6f1225829d89794fd9f891989c9ce667422d7f64" + integrity sha512-PHKZuMN+K5qgKIWhBodXzQslTo5P+K/6LqeKXS6O/4liIDdZqaX5RXrCK++LAw+y/nptN48YmUMFiQHRSWYwtQ== "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.1.tgz#916ecea274b0c776fec721e333e55762d3a9614b" - integrity sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.2.tgz#215db4f4a35d710256579784a548907237728756" + integrity sha512-pNpr1T1xLUc2l3xJKuPtsEky3ybxN3m4fJkknfIpTCTfIZCDW57oAg+EfCgIIp2rvCe0Wn++/FfodDS4YXxBwA== dependencies: "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" @@ -3142,39 +3181,39 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.6.4" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" - integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== + version "7.6.5" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.5.tgz#281f4764bcbbbc51fdded0f25aa587b4ce14da95" + integrity sha512-h9yIuWbJKdOPLJTbmSpPzkF67e659PbQDba7ifWm5BJ8xTv+sDmS7rFmywkWOvXedGTivCdeGSIIX8WLcRTz8w== dependencies: "@babel/types" "^7.0.0" "@types/babel__template@*": - version "7.4.1" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" - integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== + version "7.4.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.2.tgz#843e9f1f47c957553b0c374481dc4772921d6a6b" + integrity sha512-/AVzPICMhMOMYoSx9MoKpGDKdBRsIXMNByh1PXSZoa+v6ZoLa8xxtsT/uLQ/NJm0XVAWl/BvId4MlDeXJaeIZQ== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.1.tgz#dd6f1d2411ae677dcb2db008c962598be31d6acf" - integrity sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.2.tgz#4ddf99d95cfdd946ff35d2b65c978d9c9bf2645d" + integrity sha512-ojlGK1Hsfce93J0+kn3H5R73elidKUaZonirN33GSmgTUMpzI/MIFfSpF3haANe3G1bEBS9/9/QEqwTzwqFsKw== dependencies: "@babel/types" "^7.20.7" "@types/body-parser@*": - version "1.19.2" - resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" - integrity sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g== + version "1.19.3" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.3.tgz#fb558014374f7d9e56c8f34bab2042a3a07d25cd" + integrity sha512-oyl4jvAfTGX9Bt6Or4H9ni1Z447/tQuxnZsytsCaExKlmJiU8sFgnIBRzJUpKwB5eWn9HuBYlUlVA74q/yN0eQ== dependencies: "@types/connect" "*" "@types/node" "*" "@types/bonjour@^3.5.9": - version "3.5.10" - resolved "https://registry.yarnpkg.com/@types/bonjour/-/bonjour-3.5.10.tgz#0f6aadfe00ea414edc86f5d106357cda9701e275" - integrity sha512-p7ienRMiS41Nu2/igbJxxLDWrSZ0WxM8UQgCeO9KhoVF7cOVFkrKsiDr1EsJIla8vV3oEEjGcz11jc5yimhzZw== + version "3.5.11" + resolved "https://registry.yarnpkg.com/@types/bonjour/-/bonjour-3.5.11.tgz#fbaa46a1529ea5c5e46cde36e4be6a880db55b84" + integrity sha512-isGhjmBtLIxdHBDl2xGwUzEM8AOyOvWsADWq7rqirdi/ZQoHnLWErHvsThcEzTX8juDRiZtzp2Qkv5bgNh6mAg== dependencies: "@types/node" "*" @@ -3206,9 +3245,9 @@ "@types/node" "*" "@types/debug@^4.1.7": - version "4.1.8" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.8.tgz#cef723a5d0a90990313faec2d1e22aee5eecb317" - integrity sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ== + version "4.1.9" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.9.tgz#906996938bc672aaf2fb8c0d3733ae1dda05b005" + integrity sha512-8Hz50m2eoS56ldRlepxSBa6PWEVCtzUo/92HgLc2qTMnotJNIm7xP+UZhyWoYsyOdd5dxZ+NZLb24rsKyFs2ow== dependencies: "@types/ms" "*" @@ -3223,14 +3262,14 @@ integrity sha512-w5jZ0ee+HaPOaX25X2/2oGR/7rgAQSYII7X7pp0m9KgBfMP7uKfMfTvcpl5Dj+eDBbpxKGiqE+flqDr6XTd2RA== "@types/ejs@^3.1.1": - version "3.1.2" - resolved "https://registry.yarnpkg.com/@types/ejs/-/ejs-3.1.2.tgz#75d277b030bc11b3be38c807e10071f45ebc78d9" - integrity sha512-ZmiaE3wglXVWBM9fyVC17aGPkLo/UgaOjEiI2FXQfyczrCefORPxIe+2dVmnmk3zkVIbizjrlQzmPGhSYGXG5g== + version "3.1.3" + resolved "https://registry.yarnpkg.com/@types/ejs/-/ejs-3.1.3.tgz#ad91d1dd6e24fb60bbf96c534bce58b95eef9b57" + integrity sha512-mv5T/JI/bu+pbfz1o+TLl1NF0NIBbjS0Vl6Ppz1YY9DkXfzZT0lelXpfS5i3ZS3U/p90it7uERQpBvLYoK8e4A== "@types/emscripten@^1.39.6": - version "1.39.7" - resolved "https://registry.yarnpkg.com/@types/emscripten/-/emscripten-1.39.7.tgz#3025183ea56e12bf4d096aadc48ce74ca051233d" - integrity sha512-tLqYV94vuqDrXh515F/FOGtBcRMTPGvVV1LzLbtYDcQmmhtpf/gLYf+hikBbQk8MzOHNz37wpFfJbYAuSn8HqA== + version "1.39.8" + resolved "https://registry.yarnpkg.com/@types/emscripten/-/emscripten-1.39.8.tgz#5e3e81fb37397345cc7c12d189bd72c7d0095af8" + integrity sha512-Rk0HKcMXFUuqT32k1kXHZWgxiMvsyYsmlnjp0rLKa0MMoqXLE3T9dogDBTRfuc3SAsXu97KD3k4SKR1lHqd57w== "@types/escodegen@^0.0.6": version "0.0.6" @@ -3238,25 +3277,25 @@ integrity sha512-AjwI4MvWx3HAOaZqYsjKWyEObT9lcVV0Y0V8nXo6cXzN8ZiMxVhf6F3d/UNvXVGKrEzL/Dluc5p+y9GkzlTWig== "@types/eslint-scope@^3.7.3": - version "3.7.4" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.4.tgz#37fc1223f0786c39627068a12e94d6e6fc61de16" - integrity sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA== + version "3.7.5" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.5.tgz#e28b09dbb1d9d35fdfa8a884225f00440dfc5a3e" + integrity sha512-JNvhIEyxVW6EoMIFIvj93ZOywYFatlpu9deeH6eSx6PE3WHYvHaQtmHmQeNw7aA81bYGBPPQqdtBm6b1SsQMmA== dependencies: "@types/eslint" "*" "@types/estree" "*" "@types/eslint@*": - version "8.44.2" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.2.tgz#0d21c505f98a89b8dd4d37fa162b09da6089199a" - integrity sha512-sdPRb9K6iL5XZOmBubg8yiFp5yS/JdUDQsq5e6h95km91MCYMuvp7mh1fjPEYUhvHepKpZOjnEaMBR4PxjWDzg== + version "8.44.3" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.3.tgz#96614fae4875ea6328f56de38666f582d911d962" + integrity sha512-iM/WfkwAhwmPff3wZuPLYiHX18HI24jU8k1ZSH7P8FHwxTjZ2P6CoX2wnF43oprR+YXJM6UUxATkNvyv/JHd+g== dependencies: "@types/estree" "*" "@types/json-schema" "*" "@types/estree@*", "@types/estree@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194" - integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA== + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.2.tgz#ff02bc3dc8317cd668dfec247b750ba1f1d62453" + integrity sha512-VeiPZ9MMwXjO32/Xu7+OwflfmeoRwkE/qzndw42gGtgJwZopBnzy2gD//NN1+go1mADzkDcqf/KnFRSjTJ8xJA== "@types/estree@^0.0.51": version "0.0.51" @@ -3264,9 +3303,9 @@ integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== "@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.33": - version "4.17.36" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.36.tgz#baa9022119bdc05a4adfe740ffc97b5f9360e545" - integrity sha512-zbivROJ0ZqLAtMzgzIUC4oNqDG9iF0lSsAqpOD9kbs5xcIM3dTiyuHvBc7R8MtWBp3AAWGaovJa+wzWPjLYW7Q== + version "4.17.37" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.37.tgz#7e4b7b59da9142138a2aaa7621f5abedce8c7320" + integrity sha512-ZohaCYTgGFcOP7u6aJOhY9uIZQgZ2vxC2yWoArY+FeDXlqeH66ZVBjgvg+RLVAS/DWNq4Ap9ZXu1+SUQiiWYMg== dependencies: "@types/node" "*" "@types/qs" "*" @@ -3274,9 +3313,9 @@ "@types/send" "*" "@types/express@*", "@types/express@^4.17.13", "@types/express@^4.7.0": - version "4.17.17" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.17.tgz#01d5437f6ef9cfa8668e616e13c2f2ac9a491ae4" - integrity sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q== + version "4.17.18" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.18.tgz#efabf5c4495c1880df1bdffee604b143b29c4a95" + integrity sha512-Sxv8BSLLgsBYmcnGdGjjEjqET2U+AKAdCRODmMiq02FgjwuV75Ut85DRpvFjyw/Mk0vgUOliGRU0UUmuuZHByQ== dependencies: "@types/body-parser" "*" "@types/express-serve-static-core" "^4.17.33" @@ -3289,16 +3328,16 @@ integrity sha512-frsJrz2t/CeGifcu/6uRo4b+SzAwT4NYCVPu1GN8IB9XTzrpPkGuV0tmh9mN+/L0PklAlsC3u5Fxt0ju00LXIw== "@types/graceful-fs@^4.1.3": - version "4.1.6" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae" - integrity sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw== + version "4.1.7" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.7.tgz#30443a2e64fd51113bc3e2ba0914d47109695e2a" + integrity sha512-MhzcwU8aUygZroVwL2jeYk6JisJrPl/oov/gsgGCue9mkgl9wjGbzReYQClxiUgFDnib9FuHqTndccKeZKxTRw== dependencies: "@types/node" "*" "@types/hoist-non-react-statics@*": - version "3.3.1" - resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" - integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA== + version "3.3.2" + resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#dc1e9ded53375d37603c479cc12c693b0878aa2a" + integrity sha512-YIQtIg4PKr7ZyqNPZObpxfHsHEmuB8dXCxd6qVcGuQVDK2bpsF7bYNnBJ4Nn7giuACZg+WewExgrtAJ3XnA4Xw== dependencies: "@types/react" "*" hoist-non-react-statics "^3.3.0" @@ -3309,14 +3348,14 @@ integrity sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg== "@types/http-errors@*": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.1.tgz#20172f9578b225f6c7da63446f56d4ce108d5a65" - integrity sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ== + version "2.0.2" + resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.2.tgz#a86e00bbde8950364f8e7846687259ffcd96e8c2" + integrity sha512-lPG6KlZs88gef6aD85z3HNkztpj7w2R7HmR3gygjfXCQmsLloWNARFkMuzKiiY8FGdh1XDpgBdrSf4aKDiA7Kg== "@types/http-proxy@^1.17.8": - version "1.17.11" - resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.11.tgz#0ca21949a5588d55ac2b659b69035c84bd5da293" - integrity sha512-HC8G7c1WmaF2ekqpnFq626xd3Zz0uvaqFmBJNRZCGEZCXkvSdJoNFn/8Ygbd9fKNQj8UzLdCETaI0UWPAjK7IA== + version "1.17.12" + resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.12.tgz#86e849e9eeae0362548803c37a0a1afc616bd96b" + integrity sha512-kQtujO08dVtQ2wXAuSFfk9ASy3sug4+ogFR8Kd8UgP8PEuc1/G/8yjYRmp//PcDNJEUKOza/MrQu15bouEUCiw== dependencies: "@types/node" "*" @@ -3326,23 +3365,23 @@ integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== "@types/istanbul-lib-report@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#412e0725ef41cde73bfa03e0e833eaff41e0fd63" + integrity sha512-gPQuzaPR5h/djlAv2apEG1HVOyj1IUs7GpfMZixU0/0KXT3pm64ylHuMUI1/Akh+sq/iikxg6Z2j+fcMDXaaTQ== dependencies: "@types/istanbul-lib-coverage" "*" "@types/istanbul-reports@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" - integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.2.tgz#edc8e421991a3b4df875036d381fc0a5a982f549" + integrity sha512-kv43F9eb3Lhj+lr/Hn6OcLCs/sSM8bt+fIaP11rCYngfV6NVjzWXJ17owQtDQTL9tQ8WSLUrGsSJ6rJz0F1w1A== dependencies: "@types/istanbul-lib-report" "*" "@types/jest@*", "@types/jest@^29.5.3": - version "29.5.4" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.4.tgz#9d0a16edaa009a71e6a71a999acd582514dab566" - integrity sha512-PhglGmhWeD46FYOVLt3X7TiWjzwuVGW9wG/4qocPevXMjCmrIc5b6db9WjeGE4QYVpUAWMDv3v0IiBwObY289A== + version "29.5.5" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.5.tgz#727204e06228fe24373df9bae76b90f3e8236a2a" + integrity sha512-ebylz2hnsWR9mYvmBFbXJXr+33UPc4+ZdxyDXh5w0FlPBTfCVN3wPL+kuOiQt3xvrK419v7XWeAs+AeOksafXg== dependencies: expect "^29.0.0" pretty-format "^29.0.0" @@ -3362,9 +3401,9 @@ parse5 "^7.0.0" "@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": - version "7.0.12" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" - integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== + version "7.0.13" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" + integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== "@types/json5@^0.0.29": version "0.0.29" @@ -3372,62 +3411,62 @@ integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== "@types/lodash@^4.14.167": - version "4.14.198" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.198.tgz#4d27465257011aedc741a809f1269941fa2c5d4c" - integrity sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg== + version "4.14.199" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.199.tgz#c3edb5650149d847a277a8961a7ad360c474e9bf" + integrity sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg== "@types/mdx@^2.0.0": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.7.tgz#c7482e995673e01b83f8e96df83b3843ea76401f" - integrity sha512-BG4tyr+4amr3WsSEmHn/fXPqaCba/AYZ7dsaQTiavihQunHSIxk+uAtqsjvicNpyHN6cm+B9RVrUOtW9VzIKHw== + version "2.0.8" + resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.8.tgz#585229ff7057ab30c5e4a23fe126858881d818e5" + integrity sha512-r7/zWe+f9x+zjXqGxf821qz++ld8tp6Z4jUS6qmPZUXH6tfh4riXOhAqb12tWGWAevCFtMt1goLWkQMqIJKpsA== "@types/mime-types@^2.1.0": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@types/mime-types/-/mime-types-2.1.1.tgz#d9ba43490fa3a3df958759adf69396c3532cf2c1" - integrity sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw== + version "2.1.2" + resolved "https://registry.yarnpkg.com/@types/mime-types/-/mime-types-2.1.2.tgz#b4fe6996d2f32975b6603b26b4e4b3b6c92c9901" + integrity sha512-q9QGHMGCiBJCHEvd4ZLdasdqXv570agPsUW0CeIm/B8DzhxsYMerD0l3IlI+EQ1A2RWHY2mmM9x1YIuuWxisCg== "@types/mime@*": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10" - integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA== + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.2.tgz#c1ae807f13d308ee7511a5b81c74f327028e66e8" + integrity sha512-Wj+fqpTLtTbG7c0tH47dkahefpLKEbB+xAZuLq7b4/IDHPl/n6VoXcyUQ2bypFlbSwvCr0y+bD4euTTqTJsPxQ== "@types/mime@^1": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" - integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== + version "1.3.3" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.3.tgz#bbe64987e0eb05de150c305005055c7ad784a9ce" + integrity sha512-Ys+/St+2VF4+xuY6+kDIXGxbNRO0mesVg0bbxEfB97Od1Vjpjx9KD1qxs64Gcb3CWPirk9Xe+PT4YiiHQ9T+eg== "@types/minimist@^1.2.2": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" - integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== + version "1.2.3" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.3.tgz#dd249cef80c6fff2ba6a0d4e5beca913e04e25f8" + integrity sha512-ZYFzrvyWUNhaPomn80dsMNgMeXxNWZBdkuG/hWlUvXvbdUH8ZERNBGXnU87McuGcWDsyzX2aChCv/SVN348k3A== "@types/ms@*": - version "0.7.31" - resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" - integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + version "0.7.32" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.32.tgz#f6cd08939ae3ad886fcc92ef7f0109dacddf61ab" + integrity sha512-xPSg0jm4mqgEkNhowKgZFBNtwoEwF6gJ4Dhww+GFpm3IgtNseHQZ5IqdNwnquZEoANxyDAKDRAdVo4Z72VvD/g== "@types/node-fetch@^2.6.4": - version "2.6.4" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.4.tgz#1bc3a26de814f6bf466b25aeb1473fa1afe6a660" - integrity sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg== + version "2.6.6" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.6.tgz#b72f3f4bc0c0afee1c0bc9cff68e041d01e3e779" + integrity sha512-95X8guJYhfqiuVVhRFxVQcf4hW/2bCuoPwDasMf/531STFoNoWTT7YDnWdXHEZKqAGUigmpG31r2FE70LwnzJw== dependencies: "@types/node" "*" - form-data "^3.0.0" + form-data "^4.0.0" "@types/node@*": - version "20.6.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.0.tgz#9d7daa855d33d4efec8aea88cd66db1c2f0ebe16" - integrity sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg== + version "20.8.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.2.tgz#d76fb80d87d0d8abfe334fc6d292e83e5524efc4" + integrity sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w== "@types/node@^16.0.0": - version "16.18.50" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.50.tgz#93003cf0251a2ecd26dad6dc757168d648519805" - integrity sha512-OiDU5xRgYTJ203v4cprTs0RwOCd5c5Zjv+K5P8KSqfiCsB1W3LcamTUMcnQarpq5kOYbhHfSOgIEJvdPyb5xyw== + version "16.18.57" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.57.tgz#1ba31c0e5c403aab90a3b7826576e6782ded779b" + integrity sha512-piPoDozdPaX1hNWFJQzzgWqE40gh986VvVx/QO9RU4qYRE55ld7iepDVgZ3ccGUw0R4wge0Oy1dd+3xOQNkkUQ== "@types/normalize-package-data@^2.4.0": - version "2.4.1" - resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" - integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw== + version "2.4.2" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.2.tgz#9b0e3e8533fe5024ad32d6637eb9589988b6fdca" + integrity sha512-lqa4UEhhv/2sjjIQgjX8B+RBjj47eo0mzGasklVJ78UKGQY1r0VpB9XHDaZZO9qzEFDdy4MrXLuEaSmPrPSe/A== "@types/parse-json@^4.0.0": version "4.0.0" @@ -3440,9 +3479,9 @@ integrity sha512-VjID5MJb1eGKthz2qUerWT8+R4b9N+CHvGCzg9fn4kWZgaF9AhdYikQio3R7wV8YY1NsQKPaCwKz1Yff+aHNUQ== "@types/prop-types@*": - version "15.7.5" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf" - integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w== + version "15.7.8" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.8.tgz#805eae6e8f41bd19e88917d2ea200dc992f405d3" + integrity sha512-kMpQpfZKSCBqltAJwskgePRaYRFukDkm1oItcAbC3gNELR20XIBcN9VRgg4+m8DKsTfkWeA4m4Imp4DDuWy7FQ== "@types/qs@*", "@types/qs@^6.9.5": version "6.9.8" @@ -3450,30 +3489,21 @@ integrity sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg== "@types/range-parser@*": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" - integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== + version "1.2.5" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.5.tgz#38bd1733ae299620771bd414837ade2e57757498" + integrity sha512-xrO9OoVPqFuYyR/loIHjnbvvyRZREYKLjxV4+dY6v3FQR3stQ9ZxIGkaclF7YhI9hfjpuTbu14hZEy94qKLtOA== "@types/react-dom@^18.0.0", "@types/react-dom@^18.2.6": - version "18.2.7" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.7.tgz#67222a08c0a6ae0a0da33c3532348277c70abb63" - integrity sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA== + version "18.2.8" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.8.tgz#338f1b0a646c9f10e0a97208c1d26b9f473dffd6" + integrity sha512-bAIvO5lN/U8sPGvs1Xm61rlRHHaq5rp5N3kp9C+NJ/Q41P8iqjkXSu0+/qu8POsjH9pNWb0OYabFez7taP7omw== dependencies: "@types/react" "*" "@types/react@*", "@types/react@>=16", "@types/react@^18.2.14": - version "18.2.21" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.21.tgz#774c37fd01b522d0b91aed04811b58e4e0514ed9" - integrity sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA== - dependencies: - "@types/prop-types" "*" - "@types/scheduler" "*" - csstype "^3.0.2" - -"@types/react@^16.14.34": - version "16.14.46" - resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.46.tgz#42ac91aece416176e6b6127cd9ec9e381ea67e16" - integrity sha512-Am4pyXMrr6cWWw/TN3oqHtEZl0j+G6Up/O8m65+xF/3ZaUgkv1GAtTPWw4yNRmH0HJXmur6xKCKoMo3rBGynuw== + version "18.2.24" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.24.tgz#3c7d68c02e0205a472f04abe4a0c1df35d995c05" + integrity sha512-Ee0Jt4sbJxMu1iDcetZEIKQr99J1Zfb6D4F3qfUWoR1JpInkY1Wdg4WwCyBjL257D0+jGqSl1twBjV8iCaC0Aw== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -3485,50 +3515,50 @@ integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA== "@types/scheduler@*": - version "0.16.3" - resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5" - integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ== + version "0.16.4" + resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.4.tgz#fedc3e5b15c26dc18faae96bf1317487cb3658cf" + integrity sha512-2L9ifAGl7wmXwP4v3pN4p2FLhD0O1qsJpvKmNin5VA8+UvNVb447UDaAEV6UdrkA+m/Xs58U1RFps44x6TFsVQ== "@types/semver@^7.3.12", "@types/semver@^7.3.4": - version "7.5.1" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.1.tgz#0480eeb7221eb9bc398ad7432c9d7e14b1a5a367" - integrity sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg== + version "7.5.3" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.3.tgz#9a726e116beb26c24f1ccd6850201e1246122e04" + integrity sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw== "@types/send@*": - version "0.17.1" - resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.1.tgz#ed4932b8a2a805f1fe362a70f4e62d0ac994e301" - integrity sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q== + version "0.17.2" + resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.2.tgz#af78a4495e3c2b79bfbdac3955fdd50e03cc98f2" + integrity sha512-aAG6yRf6r0wQ29bkS+x97BIs64ZLxeE/ARwyS6wrldMm3C1MdKwCcnnEwMC1slI8wuxJOpiUH9MioC0A0i+GJw== dependencies: "@types/mime" "^1" "@types/node" "*" "@types/serve-index@^1.9.1": - version "1.9.1" - resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.1.tgz#1b5e85370a192c01ec6cec4735cf2917337a6278" - integrity sha512-d/Hs3nWDxNL2xAczmOVZNj92YZCS6RGxfBPjKzuu/XirCgXdpKEb88dYNbrYGint6IVWLNP+yonwVAuRC0T2Dg== + version "1.9.2" + resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.2.tgz#cb26e775678a8526b73a5d980a147518740aaecd" + integrity sha512-asaEIoc6J+DbBKXtO7p2shWUpKacZOoMBEGBgPG91P8xhO53ohzHWGCs4ScZo5pQMf5ukQzVT9fhX1WzpHihig== dependencies: "@types/express" "*" "@types/serve-static@*", "@types/serve-static@^1.13.10": - version "1.15.2" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.2.tgz#3e5419ecd1e40e7405d34093f10befb43f63381a" - integrity sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw== + version "1.15.3" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.3.tgz#2cfacfd1fd4520bbc3e292cca432d5e8e2e3ee61" + integrity sha512-yVRvFsEMrv7s0lGhzrggJjNOSmZCdgCjw9xWrPr/kNNLp6FaDfMC1KaYl3TSJ0c58bECwNBMoQrZJ8hA8E1eFg== dependencies: "@types/http-errors" "*" "@types/mime" "*" "@types/node" "*" "@types/set-cookie-parser@^2.4.0": - version "2.4.3" - resolved "https://registry.yarnpkg.com/@types/set-cookie-parser/-/set-cookie-parser-2.4.3.tgz#963a7437ed026c6adec2a71478ed6e3df2837160" - integrity sha512-7QhnH7bi+6KAhBB+Auejz1uV9DHiopZqu7LfR/5gZZTkejJV5nYeZZpgfFoE0N8aDsXuiYpfKyfyMatCwQhyTQ== + version "2.4.4" + resolved "https://registry.yarnpkg.com/@types/set-cookie-parser/-/set-cookie-parser-2.4.4.tgz#3c36c9147960cca0fc7c508aacb18ea41f6b5003" + integrity sha512-xCfTC/eL/GmvMC24b42qJpYSTdCIBwWcfskDF80ztXtnU6pKXyvuZP2EConb2K9ps0s7gMhCa0P1foy7wiItMA== dependencies: "@types/node" "*" "@types/sockjs@^0.3.33": - version "0.3.33" - resolved "https://registry.yarnpkg.com/@types/sockjs/-/sockjs-0.3.33.tgz#570d3a0b99ac995360e3136fd6045113b1bd236f" - integrity sha512-f0KEEe05NvUnat+boPTZ0dgaLZ4SfSouXUgv5noUiefG2ajgKjmETo9ZJyuqsl7dfl2aHlLJUiki6B4ZYldiiw== + version "0.3.34" + resolved "https://registry.yarnpkg.com/@types/sockjs/-/sockjs-0.3.34.tgz#43e10e549b36d2ba2589278f00f81b5d7ccda167" + integrity sha512-R+n7qBFnm/6jinlteC9DBL5dGiDGjWAvjo4viUanpnc/dG1y7uDoacXPIQ/PQEg1fI912SMHIa014ZjRpvDw4g== dependencies: "@types/node" "*" @@ -3538,18 +3568,18 @@ integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== "@types/styled-components@^5.1.26": - version "5.1.27" - resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.27.tgz#1915eedba0d52f26ba5a383fccb7fe50e2e71106" - integrity sha512-oY9c1SdztRRF0QDQdwXEenfAjGN4WGUkaMpx5hvdTbYYqw01qoY2GrHi+kAR6SVofynzD6KbGoF5ITP0zh5pvg== + version "5.1.28" + resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.28.tgz#3b86c4d373924ff6976de788843cab445d9ab15b" + integrity sha512-nu0VKNybkjvUqJAXWtRqKd7j3iRUl8GbYSTvZNuIBJcw/HUp1Y4QUXNLlj7gcnRV/t784JnHAlvRnSnE3nPbJA== dependencies: "@types/hoist-non-react-statics" "*" "@types/react" "*" csstype "^3.0.2" "@types/stylis@^4.0.2": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.2.0.tgz#199a3f473f0c3a6f6e4e1b17cdbc967f274bdc6b" - integrity sha512-n4sx2bqL0mW1tvDf/loQ+aMX7GQD3lc3fkCMC55VFNDu/vBOabO+LTIeXKM14xK0ppk5TUGcWRjiSpIlUpghKw== + version "4.2.1" + resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.2.1.tgz#867fcb0f81719d9ecef533fdda03e32083b959f6" + integrity sha512-OSaMrXUKxVigGlKRrET39V2xdhzlztQ9Aqumn1WbCBKHOi9ry7jKSd7rkyj0GzmWaU960Rd+LpOFpLfx5bMQAg== "@types/testing-library__jest-dom@^5.9.1": version "5.14.9" @@ -3559,9 +3589,9 @@ "@types/jest" "*" "@types/tough-cookie@*": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397" - integrity sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw== + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.3.tgz#3d06b6769518450871fbc40770b7586334bdfd90" + integrity sha512-THo502dA5PzG/sfQH+42Lw3fvmYkceefOspdCwpHRul8ik2Jv1K8I5OZz1AT3/rs46kwgMCe9bSBmDLYkkOMGg== "@types/unist@^2.0.0": version "2.0.8" @@ -3569,28 +3599,28 @@ integrity sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw== "@types/ws@^8.5.5": - version "8.5.5" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.5.tgz#af587964aa06682702ee6dcbc7be41a80e4b28eb" - integrity sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg== + version "8.5.6" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.6.tgz#e9ad51f0ab79b9110c50916c9fcbddc36d373065" + integrity sha512-8B5EO9jLVCy+B58PLHvLDuOD8DRVMgQzq8d55SjLCOn9kqGyqOvy27exVaTio1q1nX5zLu8/6N0n2ThSxOM6tg== dependencies: "@types/node" "*" "@types/yargs-parser@*": - version "21.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" - integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + version "21.0.1" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.1.tgz#07773d7160494d56aa882d7531aac7319ea67c3b" + integrity sha512-axdPBuLuEJt0c4yI5OZssC19K2Mq1uKdrfZBzuxLvaztgqUtFYZUNw7lETExPYJR9jdEoIg4mb7RQKRQzOkeGQ== "@types/yargs@^16.0.0": - version "16.0.5" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.5.tgz#12cc86393985735a283e387936398c2f9e5f88e3" - integrity sha512-AxO/ADJOBFJScHbWhq2xAhlWP24rY4aCEG/NFaMvbT3X2MgRsLjhjQwsn0Zi5zn0LG9jUhCCZMeX9Dkuw6k+vQ== + version "16.0.6" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.6.tgz#cc0c63684d68d23498cf0b5f32aa4c3fb437c638" + integrity sha512-oTP7/Q13GSPrgcwEwdlnkoZSQ1Hg9THe644qq8PG6hhJzjZ3qj1JjEFPIwWV/IXVs5XGIVqtkNOS9kh63WIJ+A== dependencies: "@types/yargs-parser" "*" "@types/yargs@^17.0.8": - version "17.0.24" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.24.tgz#b3ef8d50ad4aa6aecf6ddc97c580a00f5aa11902" - integrity sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw== + version "17.0.26" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.26.tgz#388e5002a8b284ad7b4599ba89920a6d74d8d79a" + integrity sha512-Y3vDy2X6zw/ZCumcwLpdhM5L7jmyGpmBCTYMHDLqT2IKVMYRRLdv6ZakA+wxhra6Z/3bwhNbNl9bDGXaFU+6rw== dependencies: "@types/yargs-parser" "*" @@ -3903,7 +3933,7 @@ acorn@^7.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.1.0, acorn@^8.7.1, acorn@^8.8.1, acorn@^8.8.2, acorn@^8.9.0: +acorn@^8.1.0, acorn@^8.10.0, acorn@^8.7.1, acorn@^8.8.1, acorn@^8.8.2, acorn@^8.9.0: version "8.10.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== @@ -4140,7 +4170,7 @@ array.prototype.tosorted@^1.1.1: es-shim-unscopables "^1.0.0" get-intrinsic "^1.2.1" -arraybuffer.prototype.slice@^1.0.1: +arraybuffer.prototype.slice@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12" integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== @@ -4227,12 +4257,12 @@ babel-core@^7.0.0-bridge.0: resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== -babel-jest@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.6.4.tgz#98dbc45d1c93319c82a8ab4a478b670655dd2585" - integrity sha512-meLj23UlSLddj6PC+YTOFRgDAtjnZom8w/ACsrx0gtPtv5cJZk0A5Unk5bV4wixD7XaPCN1fQvpww8czkZURmw== +babel-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" + integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== dependencies: - "@jest/transform" "^29.6.4" + "@jest/transform" "^29.7.0" "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.1.1" babel-preset-jest "^29.6.3" @@ -4289,12 +4319,12 @@ babel-plugin-polyfill-corejs2@^0.4.5: semver "^6.3.1" babel-plugin-polyfill-corejs3@^0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.3.tgz#b4f719d0ad9bb8e0c23e3e630c0c8ec6dd7a1c52" - integrity sha512-z41XaniZL26WLrvjy7soabMXrfPWARN25PZoriDEiLMxAp50AUW3t35BGQUMg5xK3UrpVTtagIDklxYa+MhiNA== + version "0.8.4" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.4.tgz#1fac2b1dcef6274e72b3c72977ed8325cb330591" + integrity sha512-9l//BZZsPR+5XjyJMPtZSK4jv0BsTO1zDac2GC6ygx9WLGlcsnRd1Co0B2zT5fF5Ic6BZy+9m3HNZ3QcOeDKfg== dependencies: "@babel/helper-define-polyfill-provider" "^0.4.2" - core-js-compat "^3.31.0" + core-js-compat "^3.32.2" babel-plugin-polyfill-regenerator@^0.5.2: version "0.5.2" @@ -4467,6 +4497,13 @@ browser-assert@^1.2.1: resolved "https://registry.yarnpkg.com/browser-assert/-/browser-assert-1.2.1.tgz#9aaa5a2a8c74685c2ae05bfe46efd606f068c200" integrity sha512-nfulgvOR6S4gt9UKCeGJOuSGBPGiFT6oQ/2UBnvTY/5aQ1PnksW72fhZkM30DzoRRv2WpwZf1vHHEr3mtuXIWQ== +browser-image-compression@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/browser-image-compression/-/browser-image-compression-2.0.2.tgz#4d5ef8882e9e471d6d923715ceb9034499d14eaa" + integrity sha512-pBLlQyUf6yB8SmmngrcOw3EoS4RpQ1BcylI3T9Yqn7+4nrQTXJD4sJDe5ODnJdrvNMaio5OicFo75rDyJD2Ucw== + dependencies: + uzip "0.20201231.0" + browserify-zlib@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d" @@ -4474,15 +4511,15 @@ browserify-zlib@^0.1.4: dependencies: pako "~0.2.0" -browserslist@^4.14.5, browserslist@^4.21.10, browserslist@^4.21.9: - version "4.21.10" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.10.tgz#dbbac576628c13d3b2231332cb2ec5a46e015bb0" - integrity sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ== +browserslist@^4.14.5, browserslist@^4.21.9, browserslist@^4.22.1: + version "4.22.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.1.tgz#ba91958d1a59b87dab6fed8dfbcb3da5e2e9c619" + integrity sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ== dependencies: - caniuse-lite "^1.0.30001517" - electron-to-chromium "^1.4.477" + caniuse-lite "^1.0.30001541" + electron-to-chromium "^1.4.535" node-releases "^2.0.13" - update-browserslist-db "^1.0.11" + update-browserslist-db "^1.0.13" bs-logger@0.x: version "0.2.6" @@ -4590,10 +4627,10 @@ camelize@^1.0.0: resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.1.tgz#89b7e16884056331a35d6b5ad064332c91daa6c3" integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ== -caniuse-lite@^1.0.30001517: - version "1.0.30001532" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001532.tgz#c6a4d5d2da6d2b967f0ee5e12e7f680db6ad2fca" - integrity sha512-FbDFnNat3nMnrROzqrsg314zhqN5LGQ1kyyMk2opcrwGbVGpHRhgCWtAgD5YJUqNAiQ+dklreil/c3Qf1dfCTw== +caniuse-lite@^1.0.30001541: + version "1.0.30001543" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001543.tgz#478a3e9dddbb353c5ab214b0ecb0dbed529ed1d8" + integrity sha512-qxdO8KPWPQ+Zk6bvNpPeQIOH47qZSYdFZd6dXQzb2KzhnSXju4Kd7H1PkSJx6NICSMgo/IhRZRhhfPTHYpJUCA== case-sensitive-paths-webpack-plugin@^2.4.0: version "2.4.0" @@ -4666,9 +4703,9 @@ chrome-trace-event@^1.0.2: integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== ci-info@^3.2.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91" - integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw== + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cjs-module-lexer@^1.0.0: version "1.2.3" @@ -4695,9 +4732,9 @@ cli-cursor@^3.1.0: restore-cursor "^3.1.0" cli-spinners@^2.5.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.0.tgz#5881d0ad96381e117bbe07ad91f2008fe6ffd8db" - integrity sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g== + version "2.9.1" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.1.tgz#9c0b9dad69a6d47cbb4333c14319b060ed395a35" + integrity sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ== cli-table3@^0.6.1: version "0.6.3" @@ -4893,11 +4930,6 @@ content-type@~1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== -convert-source-map@^1.1.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" - integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== - convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" @@ -4937,17 +4969,17 @@ copy-webpack-plugin@^11.0.0: schema-utils "^4.0.0" serialize-javascript "^6.0.0" -core-js-compat@^3.31.0: - version "3.32.2" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.32.2.tgz#8047d1a8b3ac4e639f0d4f66d4431aa3b16e004c" - integrity sha512-+GjlguTDINOijtVRUxrQOv3kfu9rl+qPNdX2LTbJ/ZyVTuxK+ksVSAGX1nHstu4hrv1En/uPTtWgq2gI5wt4AQ== +core-js-compat@^3.31.0, core-js-compat@^3.32.2: + version "3.33.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.33.0.tgz#24aa230b228406450b2277b7c8bfebae932df966" + integrity sha512-0w4LcLXsVEuNkIqwjjf9rjCoPhK8uqA4tMRh4Ge26vfLtUutshn+aRJU21I9LCJlh2QQHfisNToLjw1XEJLTWw== dependencies: - browserslist "^4.21.10" + browserslist "^4.22.1" core-js-pure@^3.23.3: - version "3.32.2" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.32.2.tgz#b7dbdac528625cf87eb0523b532eb61551b9a6d1" - integrity sha512-Y2rxThOuNywTjnX/PgA5vWM6CZ9QB9sz9oGeCixV8MqXZO70z/5SHzf9EeBrEBK0PN36DnEBBu9O/aGWzKuMZQ== + version "3.33.0" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.33.0.tgz#938a28754b4d82017a7a8cbd2727b1abecc63591" + integrity sha512-FKSIDtJnds/YFIEaZ4HszRX7hkxGpNKM7FC9aJ9WLJbSd3lD4vOltFuVIBLR8asSx9frkTSqL0dw90SKQxgKrg== core-util-is@~1.0.0: version "1.0.3" @@ -4966,15 +4998,28 @@ cosmiconfig@^7.0.1: yaml "^1.10.0" cosmiconfig@^8.1.3, cosmiconfig@^8.2.0: - version "8.3.5" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.5.tgz#3b3897ddd042d022d5a207d4c8832e54f5301977" - integrity sha512-A5Xry3xfS96wy2qbiLkQLAg4JUrR2wvfybxj6yqLmrUfMAvhS3MZxIP2oQn0grgYIvJqzpeTEWu4vK0t+12NNw== + version "8.3.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.6.tgz#060a2b871d66dba6c8538ea1118ba1ac16f5fae3" + integrity sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA== dependencies: import-fresh "^3.3.0" js-yaml "^4.1.0" parse-json "^5.2.0" path-type "^4.0.0" +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" + cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -5114,9 +5159,9 @@ data-urls@^3.0.2: whatwg-url "^11.0.0" dayjs@^1.11.9: - version "1.11.9" - resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.9.tgz#9ca491933fadd0a60a2c19f6c237c03517d71d1a" - integrity sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA== + version "1.11.10" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0" + integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ== debug@2.6.9, debug@^2.6.9: version "2.6.9" @@ -5228,16 +5273,26 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" +define-data-property@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.0.tgz#0db13540704e1d8d479a0656cf781267531b9451" + integrity sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g== + dependencies: + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== -define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.0.tgz#52988570670c9eacedd8064f4a990f2405849bd5" - integrity sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA== +define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0, define-properties@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== dependencies: + define-data-property "^1.0.1" has-property-descriptors "^1.0.0" object-keys "^1.1.1" @@ -5491,10 +5546,10 @@ ejs@^3.1.8: dependencies: jake "^10.8.5" -electron-to-chromium@^1.4.477: - version "1.4.513" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.513.tgz#41a50bf749aa7d8058ffbf7a131fc3327a7b1675" - integrity sha512-cOB0xcInjm+E5qIssHeXJ29BaUyWpMyFKT5RB3bsLENDheCja0wMkHJyiPl0NBE/VzDI7JDuNEQWhe6RitEUcw== +electron-to-chromium@^1.4.535: + version "1.4.540" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.540.tgz#c685f2f035e93eb21dd6a9cfe2c735bad8f77401" + integrity sha512-aoCqgU6r9+o9/S7wkcSbmPRFi7OWZWiXS9rtjEd+Ouyu/Xyw5RSq2XN8s5Qp8IaFOLiRrhQCphCIjAxgG3eCAg== emittery@^0.13.1: version "0.13.1" @@ -5579,17 +5634,17 @@ error-stack-parser@^2.0.6: stackframe "^1.3.4" es-abstract@^1.22.1: - version "1.22.1" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.1.tgz#8b4e5fc5cefd7f1660f0f8e1a52900dfbc9d9ccc" - integrity sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw== + version "1.22.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.2.tgz#90f7282d91d0ad577f505e423e52d4c1d93c1b8a" + integrity sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA== dependencies: array-buffer-byte-length "^1.0.0" - arraybuffer.prototype.slice "^1.0.1" + arraybuffer.prototype.slice "^1.0.2" available-typed-arrays "^1.0.5" call-bind "^1.0.2" es-set-tostringtag "^2.0.1" es-to-primitive "^1.2.1" - function.prototype.name "^1.1.5" + function.prototype.name "^1.1.6" get-intrinsic "^1.2.1" get-symbol-description "^1.0.0" globalthis "^1.0.3" @@ -5605,23 +5660,23 @@ es-abstract@^1.22.1: is-regex "^1.1.4" is-shared-array-buffer "^1.0.2" is-string "^1.0.7" - is-typed-array "^1.1.10" + is-typed-array "^1.1.12" is-weakref "^1.0.2" object-inspect "^1.12.3" object-keys "^1.1.1" object.assign "^4.1.4" - regexp.prototype.flags "^1.5.0" - safe-array-concat "^1.0.0" + regexp.prototype.flags "^1.5.1" + safe-array-concat "^1.0.1" safe-regex-test "^1.0.0" - string.prototype.trim "^1.2.7" - string.prototype.trimend "^1.0.6" - string.prototype.trimstart "^1.0.6" + string.prototype.trim "^1.2.8" + string.prototype.trimend "^1.0.7" + string.prototype.trimstart "^1.0.7" typed-array-buffer "^1.0.0" typed-array-byte-length "^1.0.0" typed-array-byte-offset "^1.0.0" typed-array-length "^1.0.4" unbox-primitive "^1.0.2" - which-typed-array "^1.1.10" + which-typed-array "^1.1.11" es-get-iterator@^1.1.3: version "1.1.3" @@ -5639,13 +5694,13 @@ es-get-iterator@^1.1.3: stop-iteration-iterator "^1.0.0" es-iterator-helpers@^1.0.12: - version "1.0.14" - resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.14.tgz#19cd7903697d97e21198f3293b55e8985791c365" - integrity sha512-JgtVnwiuoRuzLvqelrvN3Xu7H9bu2ap/kQ2CrM62iidP8SKuD99rWU3CJy++s7IVL2qb/AjXPGR/E7i9ngd/Cw== + version "1.0.15" + resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz#bd81d275ac766431d19305923707c3efd9f1ae40" + integrity sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g== dependencies: asynciterator.prototype "^1.0.0" call-bind "^1.0.2" - define-properties "^1.2.0" + define-properties "^1.2.1" es-abstract "^1.22.1" es-set-tostringtag "^2.0.1" function-bind "^1.1.1" @@ -5655,8 +5710,8 @@ es-iterator-helpers@^1.0.12: has-proto "^1.0.1" has-symbols "^1.0.3" internal-slot "^1.0.5" - iterator.prototype "^1.1.0" - safe-array-concat "^1.0.0" + iterator.prototype "^1.1.2" + safe-array-concat "^1.0.1" es-module-lexer@^1.2.1: version "1.3.1" @@ -5694,9 +5749,9 @@ esbuild-plugin-alias@^0.2.1: integrity sha512-jyfL/pwPqaFXyKnj8lP8iLk6Z0m099uXR45aSN8Av1XD4vhvQutxxPzgA2bTcAwQpa1zCXDcWOlhFgyP3GKqhQ== esbuild-register@^3.4.0: - version "3.4.2" - resolved "https://registry.yarnpkg.com/esbuild-register/-/esbuild-register-3.4.2.tgz#1e39ee0a77e8f320a9790e68c64c3559620b9175" - integrity sha512-kG/XyTDyz6+YDuyfB9ZoSIOOmgyFCH+xPRtsCa8W85HLRV5Csp+o3jWVbOSHgSLfyLc5DmP+KFDNwty4mEjC+Q== + version "3.5.0" + resolved "https://registry.yarnpkg.com/esbuild-register/-/esbuild-register-3.5.0.tgz#449613fb29ab94325c722f560f800dd946dc8ea8" + integrity sha512-+4G/XmakeBAsvJuDugJvtyF1x+XJT4FMocynNpxrvEBViirpfUn2PgNpCHedfWhF4WokNsO/OvMKrmJOIJsI5A== dependencies: debug "^4.3.4" @@ -5774,9 +5829,9 @@ eslint-import-resolver-node@^0.3.7: resolve "^1.22.4" eslint-import-resolver-typescript@^3.5.5: - version "3.6.0" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz#36f93e1eb65a635e688e16cae4bead54552e3bbd" - integrity sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg== + version "3.6.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz#7b983680edd3f1c5bce1a5829ae0bc2d57fe9efa" + integrity sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg== dependencies: debug "^4.3.4" enhanced-resolve "^5.12.0" @@ -5856,9 +5911,9 @@ eslint-plugin-react@^7.32.2: string.prototype.matchall "^4.0.8" eslint-plugin-storybook@^0.6.12: - version "0.6.13" - resolved "https://registry.yarnpkg.com/eslint-plugin-storybook/-/eslint-plugin-storybook-0.6.13.tgz#897a9f6a9bb88c63b02f05850f30c28a9848a3f7" - integrity sha512-smd+CS0WH1jBqUEJ3znGS7DU4ayBE9z6lkQAK2yrSUv1+rq8BT/tiI5C/rKE7rmiqiAfojtNYZRhzo5HrulccQ== + version "0.6.14" + resolved "https://registry.yarnpkg.com/eslint-plugin-storybook/-/eslint-plugin-storybook-0.6.14.tgz#dfc2b58700e45eb4a13c172dda2973c2e033cd71" + integrity sha512-IeYigPur/MvESNDo43Z+Z5UvlcEVnt0dDZmnw1odi9X2Th1R3bpGyOZsHXb9bp1pFecOpRUuoMG5xdID2TwwOg== dependencies: "@storybook/csf" "^0.0.1" "@typescript-eslint/utils" "^5.45.0" @@ -5887,14 +5942,14 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== eslint@^8.44.0: - version "8.49.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.49.0.tgz#09d80a89bdb4edee2efcf6964623af1054bf6d42" - integrity sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ== + version "8.50.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.50.0.tgz#2ae6015fee0240fcd3f83e1e25df0287f487d6b2" + integrity sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" "@eslint/eslintrc" "^2.1.2" - "@eslint/js" "8.49.0" + "@eslint/js" "8.50.0" "@humanwhocodes/config-array" "^0.11.11" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" @@ -6021,16 +6076,16 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect@^29.0.0, expect@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.6.4.tgz#a6e6f66d4613717859b2fe3da98a739437b6f4b8" - integrity sha512-F2W2UyQ8XYyftHT57dtfg8Ue3X5qLgm2sSug0ivvLRH/VKNRL/pDxg/TH7zVzbQB0tu80clNFy6LU7OS/VSEKA== +expect@^29.0.0, expect@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== dependencies: - "@jest/expect-utils" "^29.6.4" + "@jest/expect-utils" "^29.7.0" jest-get-type "^29.6.3" - jest-matcher-utils "^29.6.4" - jest-message-util "^29.6.3" - jest-util "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" express@^4.17.3: version "4.18.2" @@ -6283,19 +6338,19 @@ flat-cache@^3.0.4: rimraf "^3.0.2" flatted@^3.2.7: - version "3.2.7" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" - integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + version "3.2.9" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" + integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== flow-parser@0.*: - version "0.216.1" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.216.1.tgz#eeba9b0b689deeccc34a6b7d2b1f97b8f943afc0" - integrity sha512-wstw46/C/8bRv/8RySCl15lK376j8DHxm41xFjD9eVL+jSS1UmVpbdLdA0LzGuS2v5uGgQiBLEj6mgSJQwW+MA== + version "0.217.2" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.217.2.tgz#3a4aade40ea55a863295120a0b0da8a960967ad6" + integrity sha512-O+nt/FLXa1hTwtW0O9h36iZjbL84G8e1uByx5dDXMC97AJEbZXwJ4ohfaE8BNWrYFyYX0NGfz1o8AtLQvaaD/Q== follow-redirects@^1.0.0: - version "1.15.2" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" - integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + version "1.15.3" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" + integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== for-each@^0.3.3: version "0.3.3" @@ -6338,15 +6393,6 @@ fork-ts-checker-webpack-plugin@^8.0.0: semver "^7.3.5" tapable "^2.2.1" -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -6397,9 +6443,9 @@ fs-minipass@^2.0.0: minipass "^3.0.0" fs-monkey@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.4.tgz#ee8c1b53d3fe8bb7e5d2c5c5dfc0168afdd2f747" - integrity sha512-INM/fWAxMICjttnD0DX1rBvinKskj5G1w+oy/pnm9u/tSlnBrzFonJMcalKJ30P8RRsPzKcCG7Q8l0jx5Fh9YQ== + version "1.0.5" + resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.5.tgz#fe450175f0db0d7ea758102e1d84096acb925788" + integrity sha512-8uMbBjrhzW76TYgEV27Y5E//W2f/lTFmx78P2w19FZSxarhI/798APGQyuGCwmkNxgwGRhrLfvWyLBvNtuOmew== fs-readdir-recursive@^1.1.0: version "1.1.0" @@ -6421,7 +6467,7 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -function.prototype.name@^1.1.5: +function.prototype.name@^1.1.5, function.prototype.name@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== @@ -6490,9 +6536,9 @@ get-symbol-description@^1.0.0: get-intrinsic "^1.1.1" get-tsconfig@^4.5.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.0.tgz#06ce112a1463e93196aa90320c35df5039147e34" - integrity sha512-pmjiZ7xtB8URYm74PlGJozDNyhvsVLUcpBa8DZBG3bWHwaHa9bPiRpiSfovw+fjhwONSCWKRyk+JQHEGZmMrzw== + version "4.7.2" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.2.tgz#0dcd6fb330391d46332f4c6c1bf89a6514c2ddce" + integrity sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A== dependencies: resolve-pkg-maps "^1.0.0" @@ -6534,12 +6580,12 @@ glob-to-regexp@^0.4.1: integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== glob@^10.0.0: - version "10.3.4" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.4.tgz#c85c9c7ab98669102b6defda76d35c5b1ef9766f" - integrity sha512-6LFElP3A+i/Q8XQKEvZjkEWEOTgAIALR9AO2rwT8bgPhDd1anmqDJDZ6lLddI4ehxxxR1S5RIqKe1uapMQfYaQ== + version "10.3.10" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b" + integrity sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g== dependencies: foreground-child "^3.1.0" - jackspeak "^2.0.3" + jackspeak "^2.3.5" minimatch "^9.0.1" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" path-scurry "^1.10.1" @@ -6578,9 +6624,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.19.0: - version "13.21.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.21.0.tgz#163aae12f34ef502f5153cfbdd3600f36c63c571" - integrity sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg== + version "13.22.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.22.0.tgz#0c9fcb9c48a2494fbb5edbfee644285543eba9d8" + integrity sha512-H1Ddc/PbZHTDVJSnj8kWptIRSD6AM3pK+mKytuIVF4uoBV7rshFlhhvA58ceJ5wp3Er58w6zj7bykMpYXt3ETw== dependencies: type-fest "^0.20.2" @@ -6636,10 +6682,10 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -"graphql@^15.0.0 || ^16.0.0": - version "16.8.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.0.tgz#374478b7f27b2dc6153c8f42c1b80157f79d79d4" - integrity sha512-0oKGaR+y3qcS5mCu1vb7KG+a89vjn06C7Ihq/dDl3jA+A8B3TKomvi3CiEcVLJQGalbu8F52LxkOym7U5sSfbg== +graphql@^16.8.1: + version "16.8.1" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07" + integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw== gunzip-maybe@^1.4.2: version "1.4.2" @@ -6715,21 +6761,19 @@ has-tostringtag@^1.0.0: has-symbols "^1.0.2" has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" + version "1.0.4" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.4.tgz#2eb2860e000011dae4f1406a86fe80e530fb2ec6" + integrity sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ== he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -headers-polyfill@^3.1.0, headers-polyfill@^3.2.0: - version "3.2.3" - resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-3.2.3.tgz#ac656b4415b83f989fea3595931399fe9f055c7e" - integrity sha512-oj6MO8sdFQ9gQQedSVdMGh96suxTNp91vPQu7C4qx/57FqYsA5TiNr92nhIZwVQq8zygn4nu3xS1aEqpakGqdw== +headers-polyfill@3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-3.2.5.tgz#6e67d392c9d113d37448fe45014e0afdd168faed" + integrity sha512-tUCGvt191vNSQgttSyJoibR+VO+I6+iCHIUdhzEMJKE+EAL8BwCN7fUOZlY4ofOelNHsK+gEjxB/B+9N3EWtdA== hoist-non-react-statics@^3.3.0: version "3.3.2" @@ -7289,7 +7333,7 @@ is-symbol@^1.0.2, is-symbol@^1.0.3: dependencies: has-symbols "^1.0.2" -is-typed-array@^1.1.10, is-typed-array@^1.1.3, is-typed-array@^1.1.9: +is-typed-array@^1.1.10, is-typed-array@^1.1.12, is-typed-array@^1.1.3, is-typed-array@^1.1.9: version "1.1.12" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== @@ -7370,9 +7414,9 @@ istanbul-lib-instrument@^5.0.4: semver "^6.3.0" istanbul-lib-instrument@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.0.tgz#7a8af094cbfff1d5bb280f62ce043695ae8dd5b8" - integrity sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw== + version "6.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz#71e87707e8041428732518c6fb5211761753fbdf" + integrity sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA== dependencies: "@babel/core" "^7.12.3" "@babel/parser" "^7.14.7" @@ -7406,17 +7450,18 @@ istanbul-reports@^3.1.3, istanbul-reports@^3.1.4: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -iterator.prototype@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.1.tgz#ab5b790e23ec00658f5974e032a2b05188bd3a5c" - integrity sha512-9E+nePc8C9cnQldmNl6bgpTY6zI4OPRZd97fhJ/iVZ1GifIUDVV5F6x1nEDqpe8KaMEZGT4xgrwKQDxXnjOIZQ== +iterator.prototype@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.2.tgz#5e29c8924f01916cb9335f1ff80619dcff22b0c0" + integrity sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w== dependencies: - define-properties "^1.2.0" + define-properties "^1.2.1" get-intrinsic "^1.2.1" has-symbols "^1.0.3" - reflect.getprototypeof "^1.0.3" + reflect.getprototypeof "^1.0.4" + set-function-name "^2.0.1" -jackspeak@2.1.1, jackspeak@^2.0.3: +jackspeak@2.1.1, jackspeak@^2.3.5: version "2.1.1" resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.1.1.tgz#2a42db4cfbb7e55433c28b6f75d8b796af9669cd" integrity sha512-juf9stUEwUaILepraGOWIJTLwg48bUnBmRqd2ln2Os1sW987zeoj/hzhbvRB95oMuS2ZTpjULmdwHNX4rzZIZw== @@ -7435,150 +7480,149 @@ jake@^10.8.5: filelist "^1.0.4" minimatch "^3.1.2" -jest-changed-files@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.6.3.tgz#97cfdc93f74fb8af2a1acb0b78f836f1fb40c449" - integrity sha512-G5wDnElqLa4/c66ma5PG9eRjE342lIbF6SUnTJi26C3J28Fv2TVY2rOyKB9YGbSA5ogwevgmxc4j4aVjrEK6Yg== +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== dependencies: execa "^5.0.0" - jest-util "^29.6.3" + jest-util "^29.7.0" p-limit "^3.1.0" -jest-circus@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.6.4.tgz#f074c8d795e0cc0f2ebf0705086b1be6a9a8722f" - integrity sha512-YXNrRyntVUgDfZbjXWBMPslX1mQ8MrSG0oM/Y06j9EYubODIyHWP8hMUbjbZ19M3M+zamqEur7O80HODwACoJw== +jest-circus@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" + integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== dependencies: - "@jest/environment" "^29.6.4" - "@jest/expect" "^29.6.4" - "@jest/test-result" "^29.6.4" + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/test-result" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" dedent "^1.0.0" is-generator-fn "^2.0.0" - jest-each "^29.6.3" - jest-matcher-utils "^29.6.4" - jest-message-util "^29.6.3" - jest-runtime "^29.6.4" - jest-snapshot "^29.6.4" - jest-util "^29.6.3" + jest-each "^29.7.0" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" p-limit "^3.1.0" - pretty-format "^29.6.3" + pretty-format "^29.7.0" pure-rand "^6.0.0" slash "^3.0.0" stack-utils "^2.0.3" -jest-cli@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.6.4.tgz#ad52f2dfa1b0291de7ec7f8d7c81ac435521ede0" - integrity sha512-+uMCQ7oizMmh8ZwRfZzKIEszFY9ksjjEQnTEMTaL7fYiL3Kw4XhqT9bYh+A4DQKUb67hZn2KbtEnDuHvcgK4pQ== +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== dependencies: - "@jest/core" "^29.6.4" - "@jest/test-result" "^29.6.4" + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" "@jest/types" "^29.6.3" chalk "^4.0.0" + create-jest "^29.7.0" exit "^0.1.2" - graceful-fs "^4.2.9" import-local "^3.0.2" - jest-config "^29.6.4" - jest-util "^29.6.3" - jest-validate "^29.6.3" - prompts "^2.0.1" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" yargs "^17.3.1" -jest-config@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.6.4.tgz#eff958ee41d4e1ee7a6106d02b74ad9fc427d79e" - integrity sha512-JWohr3i9m2cVpBumQFv2akMEnFEPVOh+9L2xIBJhJ0zOaci2ZXuKJj0tgMKQCBZAKA09H049IR4HVS/43Qb19A== +jest-config@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" + integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== dependencies: "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^29.6.4" + "@jest/test-sequencer" "^29.7.0" "@jest/types" "^29.6.3" - babel-jest "^29.6.4" + babel-jest "^29.7.0" chalk "^4.0.0" ci-info "^3.2.0" deepmerge "^4.2.2" glob "^7.1.3" graceful-fs "^4.2.9" - jest-circus "^29.6.4" - jest-environment-node "^29.6.4" + jest-circus "^29.7.0" + jest-environment-node "^29.7.0" jest-get-type "^29.6.3" jest-regex-util "^29.6.3" - jest-resolve "^29.6.4" - jest-runner "^29.6.4" - jest-util "^29.6.3" - jest-validate "^29.6.3" + jest-resolve "^29.7.0" + jest-runner "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" micromatch "^4.0.4" parse-json "^5.2.0" - pretty-format "^29.6.3" + pretty-format "^29.7.0" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.6.4.tgz#85aaa6c92a79ae8cd9a54ebae8d5b6d9a513314a" - integrity sha512-9F48UxR9e4XOEZvoUXEHSWY4qC4zERJaOfrbBg9JpbJOO43R1vN76REt/aMGZoY6GD5g84nnJiBIVlscegefpw== +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== dependencies: chalk "^4.0.0" diff-sequences "^29.6.3" jest-get-type "^29.6.3" - pretty-format "^29.6.3" + pretty-format "^29.7.0" -jest-docblock@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.6.3.tgz#293dca5188846c9f7c0c2b1bb33e5b11f21645f2" - integrity sha512-2+H+GOTQBEm2+qFSQ7Ma+BvyV+waiIFxmZF5LdpBsAEjWX8QYjSCa4FrkIYtbfXUJJJnFCYrOtt6TZ+IAiTjBQ== +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== dependencies: detect-newline "^3.0.0" -jest-each@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.6.3.tgz#1956f14f5f0cb8ae0b2e7cabc10bb03ec817c142" - integrity sha512-KoXfJ42k8cqbkfshW7sSHcdfnv5agDdHCPA87ZBdmHP+zJstTJc0ttQaJ/x7zK6noAL76hOuTIJ6ZkQRS5dcyg== +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== dependencies: "@jest/types" "^29.6.3" chalk "^4.0.0" jest-get-type "^29.6.3" - jest-util "^29.6.3" - pretty-format "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" jest-environment-jsdom@^29.6.2: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.6.4.tgz#0daf44454041f9e1ef7fa82eb1bd43426a82eb1c" - integrity sha512-K6wfgUJ16DoMs02JYFid9lOsqfpoVtyJxpRlnTxUHzvZWBnnh2VNGRB9EC1Cro96TQdq5TtSjb3qUjNaJP9IyA== + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" + integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== dependencies: - "@jest/environment" "^29.6.4" - "@jest/fake-timers" "^29.6.4" + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" "@jest/types" "^29.6.3" "@types/jsdom" "^20.0.0" "@types/node" "*" - jest-mock "^29.6.3" - jest-util "^29.6.3" + jest-mock "^29.7.0" + jest-util "^29.7.0" jsdom "^20.0.0" -jest-environment-node@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.6.4.tgz#4ce311549afd815d3cafb49e60a1e4b25f06d29f" - integrity sha512-i7SbpH2dEIFGNmxGCpSc2w9cA4qVD+wfvg2ZnfQ7XVrKL0NA5uDVBIiGH8SR4F0dKEv/0qI5r+aDomDf04DpEQ== +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== dependencies: - "@jest/environment" "^29.6.4" - "@jest/fake-timers" "^29.6.4" + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" - jest-mock "^29.6.3" - jest-util "^29.6.3" + jest-mock "^29.7.0" + jest-util "^29.7.0" jest-get-type@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== -jest-haste-map@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.6.4.tgz#97143ce833829157ea7025204b08f9ace609b96a" - integrity sha512-12Ad+VNTDHxKf7k+M65sviyynRoZYuL1/GTuhEVb8RYsNSNln71nANRb/faSyWvx0j+gHcivChXHIoMJrGYjog== +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== dependencies: "@jest/types" "^29.6.3" "@types/graceful-fs" "^4.1.3" @@ -7587,8 +7631,8 @@ jest-haste-map@^29.6.4: fb-watchman "^2.0.0" graceful-fs "^4.2.9" jest-regex-util "^29.6.3" - jest-util "^29.6.3" - jest-worker "^29.6.4" + jest-util "^29.7.0" + jest-worker "^29.7.0" micromatch "^4.0.4" walker "^1.0.8" optionalDependencies: @@ -7604,28 +7648,28 @@ jest-junit@^16.0.0: uuid "^8.3.2" xml "^1.0.1" -jest-leak-detector@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.6.3.tgz#b9661bc3aec8874e59aff361fa0c6d7cd507ea01" - integrity sha512-0kfbESIHXYdhAdpLsW7xdwmYhLf1BRu4AA118/OxFm0Ho1b2RcTmO4oF6aAMaxpxdxnJ3zve2rgwzNBD4Zbm7Q== +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== dependencies: jest-get-type "^29.6.3" - pretty-format "^29.6.3" + pretty-format "^29.7.0" -jest-matcher-utils@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.6.4.tgz#327db7ababea49455df3b23e5d6109fe0c709d24" - integrity sha512-KSzwyzGvK4HcfnserYqJHYi7sZVqdREJ9DMPAKVbS98JsIAvumihaNUbjrWw0St7p9IY7A9UskCW5MYlGmBQFQ== +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== dependencies: chalk "^4.0.0" - jest-diff "^29.6.4" + jest-diff "^29.7.0" jest-get-type "^29.6.3" - pretty-format "^29.6.3" + pretty-format "^29.7.0" -jest-message-util@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.6.3.tgz#bce16050d86801b165f20cfde34dc01d3cf85fbf" - integrity sha512-FtzaEEHzjDpQp51HX4UMkPZjy46ati4T5pEMyM6Ik48ztu4T9LQplZ6OsimHx7EuM9dfEh5HJa6D3trEftu3dA== +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== dependencies: "@babel/code-frame" "^7.12.13" "@jest/types" "^29.6.3" @@ -7633,7 +7677,7 @@ jest-message-util@^29.6.3: chalk "^4.0.0" graceful-fs "^4.2.9" micromatch "^4.0.4" - pretty-format "^29.6.3" + pretty-format "^29.7.0" slash "^3.0.0" stack-utils "^2.0.3" @@ -7645,14 +7689,14 @@ jest-mock@^27.0.6: "@jest/types" "^27.5.1" "@types/node" "*" -jest-mock@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.6.3.tgz#433f3fd528c8ec5a76860177484940628bdf5e0a" - integrity sha512-Z7Gs/mOyTSR4yPsaZ72a/MtuK6RnC3JYqWONe48oLaoEcYwEDxqvbXz85G4SJrm2Z5Ar9zp6MiHF4AlFlRM4Pg== +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== dependencies: "@jest/types" "^29.6.3" "@types/node" "*" - jest-util "^29.6.3" + jest-util "^29.7.0" jest-pnp-resolver@^1.2.2: version "1.2.3" @@ -7664,67 +7708,67 @@ jest-regex-util@^29.6.3: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== -jest-resolve-dependencies@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.4.tgz#20156b33c7eacbb6bb77aeba4bed0eab4a3f8734" - integrity sha512-7+6eAmr1ZBF3vOAJVsfLj1QdqeXG+WYhidfLHBRZqGN24MFRIiKG20ItpLw2qRAsW/D2ZUUmCNf6irUr/v6KHA== +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== dependencies: jest-regex-util "^29.6.3" - jest-snapshot "^29.6.4" + jest-snapshot "^29.7.0" -jest-resolve@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.6.4.tgz#e34cb06f2178b429c38455d98d1a07572ac9faa3" - integrity sha512-fPRq+0vcxsuGlG0O3gyoqGTAxasagOxEuyoxHeyxaZbc9QNek0AmJWSkhjlMG+mTsj+8knc/mWb3fXlRNVih7Q== +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== dependencies: chalk "^4.0.0" graceful-fs "^4.2.9" - jest-haste-map "^29.6.4" + jest-haste-map "^29.7.0" jest-pnp-resolver "^1.2.2" - jest-util "^29.6.3" - jest-validate "^29.6.3" + jest-util "^29.7.0" + jest-validate "^29.7.0" resolve "^1.20.0" resolve.exports "^2.0.0" slash "^3.0.0" -jest-runner@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.6.4.tgz#b3b8ccb85970fde0fae40c73ee11eb75adccfacf" - integrity sha512-SDaLrMmtVlQYDuG0iSPYLycG8P9jLI+fRm8AF/xPKhYDB2g6xDWjXBrR5M8gEWsK6KVFlebpZ4QsrxdyIX1Jaw== +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== dependencies: - "@jest/console" "^29.6.4" - "@jest/environment" "^29.6.4" - "@jest/test-result" "^29.6.4" - "@jest/transform" "^29.6.4" + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" emittery "^0.13.1" graceful-fs "^4.2.9" - jest-docblock "^29.6.3" - jest-environment-node "^29.6.4" - jest-haste-map "^29.6.4" - jest-leak-detector "^29.6.3" - jest-message-util "^29.6.3" - jest-resolve "^29.6.4" - jest-runtime "^29.6.4" - jest-util "^29.6.3" - jest-watcher "^29.6.4" - jest-worker "^29.6.4" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.6.4.tgz#b0bc495c9b6b12a0a7042ac34ca9bb85f8cd0ded" - integrity sha512-s/QxMBLvmwLdchKEjcLfwzP7h+jsHvNEtxGP5P+Fl1FMaJX2jMiIqe4rJw4tFprzCwuSvVUo9bn0uj4gNRXsbA== +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== dependencies: - "@jest/environment" "^29.6.4" - "@jest/fake-timers" "^29.6.4" - "@jest/globals" "^29.6.4" + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" "@jest/source-map" "^29.6.3" - "@jest/test-result" "^29.6.4" - "@jest/transform" "^29.6.4" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" @@ -7732,46 +7776,46 @@ jest-runtime@^29.6.4: collect-v8-coverage "^1.0.0" glob "^7.1.3" graceful-fs "^4.2.9" - jest-haste-map "^29.6.4" - jest-message-util "^29.6.3" - jest-mock "^29.6.3" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" jest-regex-util "^29.6.3" - jest-resolve "^29.6.4" - jest-snapshot "^29.6.4" - jest-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.6.4.tgz#9833eb6b66ff1541c7fd8ceaa42d541f407b4876" - integrity sha512-VC1N8ED7+4uboUKGIDsbvNAZb6LakgIPgAF4RSpF13dN6YaMokfRqO+BaqK4zIh6X3JffgwbzuGqDEjHm/MrvA== +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== dependencies: "@babel/core" "^7.11.6" "@babel/generator" "^7.7.2" "@babel/plugin-syntax-jsx" "^7.7.2" "@babel/plugin-syntax-typescript" "^7.7.2" "@babel/types" "^7.3.3" - "@jest/expect-utils" "^29.6.4" - "@jest/transform" "^29.6.4" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" "@jest/types" "^29.6.3" babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^29.6.4" + expect "^29.7.0" graceful-fs "^4.2.9" - jest-diff "^29.6.4" + jest-diff "^29.7.0" jest-get-type "^29.6.3" - jest-matcher-utils "^29.6.4" - jest-message-util "^29.6.3" - jest-util "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" natural-compare "^1.4.0" - pretty-format "^29.6.3" + pretty-format "^29.7.0" semver "^7.5.3" -jest-util@^29.0.0, jest-util@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.3.tgz#e15c3eac8716440d1ed076f09bc63ace1aebca63" - integrity sha512-QUjna/xSy4B32fzcKTSz1w7YYzgiHrjjJjevdRf61HYk998R5vVMMNmrHESYZVDS5DSWs+1srPLPKxXPkeSDOA== +jest-util@^29.0.0, jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== dependencies: "@jest/types" "^29.6.3" "@types/node" "*" @@ -7780,30 +7824,30 @@ jest-util@^29.0.0, jest-util@^29.6.3: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.6.3.tgz#a75fca774cfb1c5758c70d035d30a1f9c2784b4d" - integrity sha512-e7KWZcAIX+2W1o3cHfnqpGajdCs1jSM3DkXjGeLSNmCazv1EeI1ggTeK5wdZhF+7N+g44JI2Od3veojoaumlfg== +jest-validate@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== dependencies: "@jest/types" "^29.6.3" camelcase "^6.2.0" chalk "^4.0.0" jest-get-type "^29.6.3" leven "^3.1.0" - pretty-format "^29.6.3" + pretty-format "^29.7.0" -jest-watcher@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.6.4.tgz#633eb515ae284aa67fd6831f1c9d1b534cf0e0ba" - integrity sha512-oqUWvx6+On04ShsT00Ir9T4/FvBeEh2M9PTubgITPxDa739p4hoQweWPRGyYeaojgT0xTpZKF0Y/rSY1UgMxvQ== +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== dependencies: - "@jest/test-result" "^29.6.4" + "@jest/test-result" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" emittery "^0.13.1" - jest-util "^29.6.3" + jest-util "^29.7.0" string-length "^4.0.1" jest-worker@^27.4.5: @@ -7815,25 +7859,25 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" -jest-worker@^29.6.4: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.6.4.tgz#f34279f4afc33c872b470d4af21b281ac616abd3" - integrity sha512-6dpvFV4WjcWbDVGgHTWo/aupl8/LbBx2NSKfiwqf79xC/yeJjKHT1+StcKy/2KTmW16hE68ccKVOtXf+WZGz7Q== +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== dependencies: "@types/node" "*" - jest-util "^29.6.3" + jest-util "^29.7.0" merge-stream "^2.0.0" supports-color "^8.0.0" jest@^29.6.2: - version "29.6.4" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.6.4.tgz#7c48e67a445ba264b778253b5d78d4ebc9d0a622" - integrity sha512-tEFhVQFF/bzoYV1YuGyzLPZ6vlPrdfvDmmAxudA1dLEuiztqg2Rkx20vkKY32xiDROcD2KXlgZ7Cu8RPeEHRKw== + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== dependencies: - "@jest/core" "^29.6.4" + "@jest/core" "^29.7.0" "@jest/types" "^29.6.3" import-local "^3.0.2" - jest-cli "^29.6.4" + jest-cli "^29.7.0" js-levenshtein@^1.1.6: version "1.1.6" @@ -8390,9 +8434,9 @@ minipass@^5.0.0: integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== "minipass@^5.0.0 || ^6.0.2 || ^7.0.0": - version "7.0.3" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.3.tgz#05ea638da44e475037ed94d1c7efcc76a25e1974" - integrity sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg== + version "7.0.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" + integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== minizlib@^2.1.1: version "2.1.2" @@ -8429,11 +8473,6 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== -ms@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -8452,20 +8491,20 @@ msw-storybook-addon@^1.8.0: is-node-process "^1.0.1" msw@^1.2.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/msw/-/msw-1.3.0.tgz#dc1f80a79f4719610e45a87e77d1ec32720bbb6d" - integrity sha512-nnWAZlQyQOKeYRblCpseT1kSPt1aF5e/jHz1hn/18IxbsMFreSVV1cJriT0uV+YG6+wvwFRMHXU3zVuMvuwERQ== + version "1.3.2" + resolved "https://registry.yarnpkg.com/msw/-/msw-1.3.2.tgz#35e0271293e893fc3c55116e90aad5d955c66899" + integrity sha512-wKLhFPR+NitYTkQl5047pia0reNGgf0P6a1eTnA5aNlripmiz0sabMvvHcicE8kQ3/gZcI0YiPFWmYfowfm3lA== dependencies: "@mswjs/cookies" "^0.2.2" - "@mswjs/interceptors" "^0.17.5" + "@mswjs/interceptors" "^0.17.10" "@open-draft/until" "^1.0.3" "@types/cookie" "^0.4.1" "@types/js-levenshtein" "^1.1.1" chalk "^4.1.1" chokidar "^3.4.2" cookie "^0.4.2" - graphql "^15.0.0 || ^16.0.0" - headers-polyfill "^3.2.0" + graphql "^16.8.1" + headers-polyfill "3.2.5" inquirer "^8.2.0" is-node-process "^1.2.0" js-levenshtein "^1.1.6" @@ -9081,9 +9120,9 @@ postcss-value-parser@^4.0.2, postcss-value-parser@^4.1.0, postcss-value-parser@^ integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.27, postcss@^8.4.29: - version "8.4.29" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.29.tgz#33bc121cf3b3688d4ddef50be869b2a54185a1dd" - integrity sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw== + version "8.4.31" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" + integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== dependencies: nanoid "^3.3.6" picocolors "^1.0.0" @@ -9116,10 +9155,10 @@ pretty-format@^27.0.2: ansi-styles "^5.0.0" react-is "^17.0.1" -pretty-format@^29.0.0, pretty-format@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.6.3.tgz#d432bb4f1ca6f9463410c3fb25a0ba88e594ace7" - integrity sha512-ZsBgjVhFAj5KeK+nHfF1305/By3lechHQSMWCTl8iHSbfOm2TN5nHEtFc/+W7fAyUeCs2n5iow72gld4gW0xDw== +pretty-format@^29.0.0, pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== dependencies: "@jest/schemas" "^29.6.3" ansi-styles "^5.0.0" @@ -9232,9 +9271,9 @@ puppeteer-core@^2.1.1: ws "^6.1.0" pure-rand@^6.0.0: - version "6.0.3" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.3.tgz#3c9e6b53c09e52ac3cedffc85ab7c1c7094b38cb" - integrity sha512-KddyFewCsO0j3+np81IQ+SweXLDnDQTs5s67BOnrYmYe/yNmUhttQyGsYzy8yUnoljGAQ9sl38YB4vH8ur7Y+w== + version "6.0.4" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.4.tgz#50b737f6a925468679bff00ad20eade53f37d5c7" + integrity sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA== qs@6.11.0: version "6.11.0" @@ -9397,19 +9436,19 @@ react-remove-scroll@2.5.5: use-sidecar "^1.1.2" react-router-dom@^6.14.2: - version "6.15.0" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.15.0.tgz#6da7db61e56797266fbbef0d5e324d6ac443ee40" - integrity sha512-aR42t0fs7brintwBGAv2+mGlCtgtFQeOzK0BM1/OiqEzRejOZtpMZepvgkscpMUnKb8YO84G7s3LsHnnDNonbQ== + version "6.16.0" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.16.0.tgz#86f24658da35eb66727e75ecbb1a029e33ee39d9" + integrity sha512-aTfBLv3mk/gaKLxgRDUPbPw+s4Y/O+ma3rEN1u8EgEpLpPe6gNjIsWt9rxushMHHMb7mSwxRGdGlGdvmFsyPIg== dependencies: - "@remix-run/router" "1.8.0" - react-router "6.15.0" + "@remix-run/router" "1.9.0" + react-router "6.16.0" -react-router@6.15.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.15.0.tgz#bf2cb5a4a7ed57f074d4ea88db0d95033f39cac8" - integrity sha512-NIytlzvzLwJkCQj2HLefmeakxxWHWAP+02EGqWEZy+DgfHHKQMUoBBjUQLOtFInBMhWtb3hiUy6MfFgwLjXhqg== +react-router@6.16.0: + version "6.16.0" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.16.0.tgz#abbf3d5bdc9c108c9b822a18be10ee004096fb81" + integrity sha512-VT4Mmc4jj5YyjpOi5jOf0I+TYzGpvzERy4ckNSvSh2RArv8LLoCxlsZ2D+tc7zgjxcY34oTz2hZaeX5RVprKqA== dependencies: - "@remix-run/router" "1.8.0" + "@remix-run/router" "1.9.0" react-style-singleton@^2.2.1: version "2.2.1" @@ -9538,7 +9577,7 @@ redent@^4.0.0: indent-string "^5.0.0" strip-indent "^4.0.0" -reflect.getprototypeof@^1.0.3: +reflect.getprototypeof@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.4.tgz#aaccbf41aca3821b87bb71d9dcbc7ad0ba50a3f3" integrity sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw== @@ -9551,9 +9590,9 @@ reflect.getprototypeof@^1.0.3: which-builtin-type "^1.1.3" regenerate-unicode-properties@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz#7c3192cab6dd24e21cb4461e5ddd7dd24fa8374c" - integrity sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ== + version "10.1.1" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz#6b0e05489d9076b04c436f318d9b067bba459480" + integrity sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q== dependencies: regenerate "^1.4.2" @@ -9574,14 +9613,14 @@ regenerator-transform@^0.15.2: dependencies: "@babel/runtime" "^7.8.4" -regexp.prototype.flags@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz#fe7ce25e7e4cca8db37b6634c8a2c7009199b9cb" - integrity sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA== +regexp.prototype.flags@^1.5.0, regexp.prototype.flags@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e" + integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== dependencies: call-bind "^1.0.2" define-properties "^1.2.0" - functions-have-names "^1.2.3" + set-function-name "^2.0.0" regexpu-core@^5.3.1: version "5.3.2" @@ -9691,9 +9730,9 @@ resolve.exports@^2.0.0: integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== resolve@^1.10.0, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.4: - version "1.22.4" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.4.tgz#1dc40df46554cdaf8948a486a10f6ba1e2026c34" - integrity sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg== + version "1.22.6" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.6.tgz#dd209739eca3aef739c626fea1b4f3c506195362" + integrity sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw== dependencies: is-core-module "^2.13.0" path-parse "^1.0.7" @@ -9766,7 +9805,7 @@ rxjs@^7.5.5: dependencies: tslib "^2.1.0" -safe-array-concat@^1.0.0: +safe-array-concat@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c" integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q== @@ -9776,11 +9815,6 @@ safe-array-concat@^1.0.0: has-symbols "^1.0.3" isarray "^2.0.5" -safe-buffer@5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" - integrity sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== - safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -9893,17 +9927,6 @@ serialize-javascript@^6.0.0, serialize-javascript@^6.0.1: dependencies: randombytes "^2.1.0" -serve-favicon@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/serve-favicon/-/serve-favicon-2.5.0.tgz#935d240cdfe0f5805307fdfe967d88942a2cbcf0" - integrity sha512-FMW2RvqNr03x+C0WxTyu6sOv21oOjkq5j8tjquWccwa6ScNyGFOGJVpuS1NmTVGBAHS07xnSKotgf2ehQmf9iA== - dependencies: - etag "~1.8.1" - fresh "0.5.2" - ms "2.1.1" - parseurl "~1.3.2" - safe-buffer "5.1.1" - serve-index@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" @@ -9932,6 +9955,15 @@ set-cookie-parser@^2.4.6: resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== +set-function-name@^2.0.0, set-function-name@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a" + integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== + dependencies: + define-data-property "^1.0.1" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.0" + setprototypeof@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" @@ -10101,9 +10133,9 @@ spdx-expression-parse@^3.0.0: spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.13" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz#7189a474c46f8d47c7b0da4b987bb45e908bd2d5" - integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w== + version "3.0.15" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.15.tgz#142460aabaca062bc7cd4cc87b7d50725ed6a4ba" + integrity sha512-lpT8hSQp9jAKp9mhtBU4Xjon8LPGBvLIuBiSVhMEtmLecTh2mO0tlqrAMp47tBXzMr13NJMQ2lf7RpQGLJ3HsQ== spdy-transport@^3.0.0: version "3.0.0" @@ -10168,11 +10200,11 @@ store2@^2.14.2: integrity sha512-siT1RiqlfQnGqgT/YzXVUNsom9S0H1OX+dpdGN1xkyYATo4I6sep5NmsRD/40s3IIOvlCq6akxkqG82urIZW1w== storybook@^7.1.1: - version "7.4.0" - resolved "https://registry.yarnpkg.com/storybook/-/storybook-7.4.0.tgz#f1b64222e3d474bc6e258eb7e48c675685829873" - integrity sha512-jSwbyxHlr2dTY51Pv0mzenjrMDJNZH7DQhHu4ZezpjV+QK/rLCnD+Gt/7iDSaNlsmZJejQcmURDoEybWggMOqw== + version "7.4.6" + resolved "https://registry.yarnpkg.com/storybook/-/storybook-7.4.6.tgz#f688649af6c2cd1329dd120d8f61a930f76262d0" + integrity sha512-YkFSpnR47j5zz7yElA+2axLjXN7K7TxDGJRHHlqXmG5iQ0PXzmjrj2RxMDKFz4Ybp/QjEUoJ4rx//ESEY0Nb5A== dependencies: - "@storybook/cli" "7.4.0" + "@storybook/cli" "7.4.6" stream-shift@^1.0.0: version "1.0.1" @@ -10209,9 +10241,9 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: strip-ansi "^6.0.1" string.prototype.matchall@^4.0.8: - version "4.0.9" - resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.9.tgz#148779de0f75d36b13b15885fec5cadde994520d" - integrity sha512-6i5hL3MqG/K2G43mWXWgP+qizFW/QH/7kCNN13JrJS5q48FN5IKksLDscexKP3dnmB6cdm9jlNgAsWNLpSykmA== + version "4.0.10" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz#a1553eb532221d4180c51581d6072cd65d1ee100" + integrity sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ== dependencies: call-bind "^1.0.2" define-properties "^1.2.0" @@ -10220,9 +10252,10 @@ string.prototype.matchall@^4.0.8: has-symbols "^1.0.3" internal-slot "^1.0.5" regexp.prototype.flags "^1.5.0" + set-function-name "^2.0.0" side-channel "^1.0.4" -string.prototype.trim@^1.2.7: +string.prototype.trim@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== @@ -10231,7 +10264,7 @@ string.prototype.trim@^1.2.7: define-properties "^1.2.0" es-abstract "^1.22.1" -string.prototype.trimend@^1.0.6: +string.prototype.trimend@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== @@ -10240,7 +10273,7 @@ string.prototype.trimend@^1.0.6: define-properties "^1.2.0" es-abstract "^1.22.1" -string.prototype.trimstart@^1.0.6: +string.prototype.trimstart@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== @@ -10315,9 +10348,9 @@ style-search@^0.1.0: integrity sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg== styled-components@^6.0.2: - version "6.0.7" - resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-6.0.7.tgz#1cf4a5e6b6181b29f941934df54af19b7ef05ab0" - integrity sha512-xIwWuiRMYR43mskVsW9MGTRjSo7ol4bcVjT595fGUp3OLBJOlOgaiKaxsHdC4a2HqWKqKnh0CmcRbk5ogyDjTg== + version "6.0.8" + resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-6.0.8.tgz#90617ad60de39772e03a81c8f3b8e66c12f51c44" + integrity sha512-AwI02MTWZwqjzfXgR5QcbmcSn5xVjY4N2TLjSuYnmuBGF3y7GicHz3ysbpUq2EMJP5M8/Nc22vcmF3V3WNZDFA== dependencies: "@babel/cli" "^7.21.0" "@babel/core" "^7.21.0" @@ -10406,9 +10439,9 @@ stylis@^4.3.0: integrity sha512-E87pIogpwUsUwXw7dNyU4QDjdgVMy52m+XEOPEKUn161cCzWjjhPSQhByfd1CcNvrOLnXQ6OnnZDwnJrz/Z4YQ== superjson@^1.10.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/superjson/-/superjson-1.13.1.tgz#a0b6ab5d22876f6207fcb9d08b0cb2acad8ee5cd" - integrity sha512-AVH2eknm9DEd3qvxM4Sq+LTCkSXE2ssfh1t11MHMXyYXFQyQ1HLgVvV+guLTsaQnJU3gnaVo34TohHPulY/wLg== + version "1.13.3" + resolved "https://registry.yarnpkg.com/superjson/-/superjson-1.13.3.tgz#3bd64046f6c0a47062850bb3180ef352a471f930" + integrity sha512-mJiVjfd2vokfDxsQPOwJ/PtanO87LhpYY88ubI5dUB1Ab58Txbyje3+jpm+/83R/fevaq/107NNhtYBLuoTrFg== dependencies: copy-anything "^3.0.2" @@ -10579,9 +10612,9 @@ terser-webpack-plugin@^5.3.1, terser-webpack-plugin@^5.3.7: terser "^5.16.8" terser@^5.10.0, terser@^5.16.8: - version "5.19.4" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.19.4.tgz#941426fa482bf9b40a0308ab2b3cd0cf7c775ebd" - integrity sha512-6p1DjHeuluwxDXcuT9VR8p64klWJKo1ILiy19s6C9+0Bh2+NWTX6nD9EPppiER4ICkHDVB1RkVpin/YW2nQn/g== + version "5.21.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.21.0.tgz#d2b27e92b5e56650bc83b6defa00a110f0b124b2" + integrity sha512-WtnFKrxu9kaoXuiZFSGrcAvvBqAdmKx0SFNmVNYdJamMu9yyN3I/QF0FbH4QcqJQ+y1CJnzxGIKH0cSj+FGYRw== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -10934,11 +10967,11 @@ unpipe@1.0.0, unpipe@~1.0.0: integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== unplugin@^1.3.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.4.0.tgz#b771373aa1bc664f50a044ee8009bd3a7aa04d85" - integrity sha512-5x4eIEL6WgbzqGtF9UV8VEC/ehKptPXDS6L2b0mv4FRMkJxRtjaJfOWDd6a8+kYbqsjklix7yWP0N3SUepjXcg== + version "1.5.0" + resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.5.0.tgz#8938ae84defe62afc7757df9ca05d27160f6c20c" + integrity sha512-9ZdRwbh/4gcm1JTOkp9lAkIDrtOyOxgHmY7cjuwI8L/2RTikMcVG25GsZwNAgRuap3iDw2jeq7eoqtAsz5rW3A== dependencies: - acorn "^8.9.0" + acorn "^8.10.0" chokidar "^3.5.3" webpack-sources "^3.2.3" webpack-virtual-modules "^0.5.0" @@ -10948,10 +10981,10 @@ untildify@^4.0.0: resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== -update-browserslist-db@^1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz#9a2a641ad2907ae7b3616506f4b977851db5b940" - integrity sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA== +update-browserslist-db@^1.0.13: + version "1.0.13" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" + integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== dependencies: escalade "^3.1.1" picocolors "^1.0.0" @@ -10972,9 +11005,9 @@ url-parse@^1.5.3: requires-port "^1.0.0" url@^0.11.0: - version "0.11.2" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.2.tgz#02f250a6e0d992b781828cd456d44f49bf2e19dd" - integrity sha512-7yIgNnrST44S7PJ5+jXbdIupfU1nWUdQJBFBeJRclPXiWgCvrSq5Frw8lr/i//n5sqDfzoKmBymMS81l4U/7cg== + version "0.11.3" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.3.tgz#6f495f4b935de40ce4a0a52faee8954244f3d3ad" + integrity sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw== dependencies: punycode "^1.4.1" qs "^6.11.2" @@ -11038,18 +11071,23 @@ uuid@^8.3.2: integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== uuid@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" - integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + +uzip@0.20201231.0: + version "0.20201231.0" + resolved "https://registry.yarnpkg.com/uzip/-/uzip-0.20201231.0.tgz#9e64b065b9a8ebf26eb7583fe8e77e1d9a15ed14" + integrity sha512-OZeJfZP+R0z9D6TmBgLq2LHzSSptGMGDGigGiEe0pr8UBe/7fdflgHlHBNDASTXB5jnFuxHpNaJywSg8YFeGng== v8-to-istanbul@^9.0.0, v8-to-istanbul@^9.0.1: - version "9.1.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz#1b83ed4e397f58c85c266a570fc2558b5feb9265" - integrity sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA== + version "9.1.2" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.1.2.tgz#51168df21c8ca01c83285f27316549b2c51a5b46" + integrity sha512-ZGBe7VAivuuoQXTeckpbYKTdtjXGcm3ZUHXC0PAk0CzFyuYvwi73a58iEKI3GkGD1c3EHc+EgfR1w5pgbfzJlQ== dependencies: "@jridgewell/trace-mapping" "^0.3.12" "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" + convert-source-map "^2.0.0" validate-npm-package-license@^3.0.1: version "3.0.4" @@ -11334,7 +11372,7 @@ which-collection@^1.0.1: is-weakmap "^2.0.1" is-weakset "^2.0.1" -which-typed-array@^1.1.10, which-typed-array@^1.1.11, which-typed-array@^1.1.2, which-typed-array@^1.1.9: +which-typed-array@^1.1.11, which-typed-array@^1.1.2, which-typed-array@^1.1.9: version "1.1.11" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.11.tgz#99d691f23c72aab6768680805a271b69761ed61a" integrity sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew== @@ -11425,9 +11463,9 @@ ws@^6.1.0: async-limiter "~1.0.0" ws@^8.11.0, ws@^8.13.0, ws@^8.2.3: - version "8.14.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.1.tgz#4b9586b4f70f9e6534c7bb1d3dc0baa8b8cf01e0" - integrity sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A== + version "8.14.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" + integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== xml-name-validator@^4.0.0: version "4.0.0"