-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] feat: 상품 검색 기능 구현 #445
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
53d6cf8
feat: 상품 검색 기능 controller 및 dto 추가
Go-Jaecheol 358fd33
feat: 검색어가 포함된 상품들을 조회하는 ProductRepository 메서드 추가
Go-Jaecheol c051a4b
feat: 상품 검색 기능 구현
Go-Jaecheol 99a3095
test: 상품 검색 관련 ProductRepository 테스트 추가
Go-Jaecheol a93b966
test: 상품 검색 관련 인수 테스트 추가
Go-Jaecheol f98f02c
style: 개행 적용
Go-Jaecheol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
backend/src/main/java/com/funeat/product/dto/SearchProductDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.funeat.product.dto; | ||
|
||
import com.funeat.product.domain.Product; | ||
|
||
public class SearchProductDto { | ||
|
||
private final Long id; | ||
private final String name; | ||
private final String categoryType; | ||
|
||
public SearchProductDto(final Long id, final String name, final String categoryType) { | ||
this.id = id; | ||
this.name = name; | ||
this.categoryType = categoryType; | ||
} | ||
|
||
public static SearchProductDto toDto(final Product product) { | ||
return new SearchProductDto(product.getId(), product.getName(), product.getCategory().getType().getName()); | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getCategoryType() { | ||
return categoryType; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
backend/src/main/java/com/funeat/product/dto/SearchProductResultDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.funeat.product.dto; | ||
|
||
import com.funeat.product.domain.Product; | ||
|
||
public class SearchProductResultDto { | ||
|
||
private final Long id; | ||
private final String name; | ||
private final Long price; | ||
private final String image; | ||
private final Double averageRating; | ||
private final Long reviewCount; | ||
private final String categoryType; | ||
|
||
public SearchProductResultDto(final Long id, final String name, final Long price, final String image, | ||
final Double averageRating, final Long reviewCount, final String categoryType) { | ||
this.id = id; | ||
this.name = name; | ||
this.price = price; | ||
this.image = image; | ||
this.averageRating = averageRating; | ||
this.reviewCount = reviewCount; | ||
this.categoryType = categoryType; | ||
} | ||
|
||
public static SearchProductResultDto toDto(final Product product, final Long reviewCount) { | ||
return new SearchProductResultDto(product.getId(), product.getName(), product.getPrice(), product.getImage(), | ||
product.getAverageRating(), reviewCount, product.getCategory().getType().getName()); | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Long getPrice() { | ||
return price; | ||
} | ||
|
||
public String getImage() { | ||
return image; | ||
} | ||
|
||
public Double getAverageRating() { | ||
return averageRating; | ||
} | ||
|
||
public Long getReviewCount() { | ||
return reviewCount; | ||
} | ||
|
||
public String getCategoryType() { | ||
return categoryType; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
backend/src/main/java/com/funeat/product/dto/SearchProductResultsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.funeat.product.dto; | ||
|
||
import com.funeat.common.dto.PageDto; | ||
import java.util.List; | ||
|
||
public class SearchProductResultsResponse { | ||
|
||
private final PageDto page; | ||
private final List<SearchProductResultDto> products; | ||
|
||
public SearchProductResultsResponse(final PageDto page, final List<SearchProductResultDto> products) { | ||
this.page = page; | ||
this.products = products; | ||
} | ||
|
||
public static SearchProductResultsResponse toResponse(final PageDto page, | ||
final List<SearchProductResultDto> products) { | ||
return new SearchProductResultsResponse(page, products); | ||
} | ||
|
||
public PageDto getPage() { | ||
return page; | ||
} | ||
|
||
public List<SearchProductResultDto> getProducts() { | ||
return products; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/funeat/product/dto/SearchProductsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.funeat.product.dto; | ||
|
||
import com.funeat.common.dto.PageDto; | ||
import java.util.List; | ||
|
||
public class SearchProductsResponse { | ||
|
||
private final PageDto page; | ||
private final List<SearchProductDto> products; | ||
|
||
public SearchProductsResponse(final PageDto page, final List<SearchProductDto> products) { | ||
this.page = page; | ||
this.products = products; | ||
} | ||
|
||
public static SearchProductsResponse toResponse(final PageDto page, final List<SearchProductDto> products) { | ||
return new SearchProductsResponse(page, products); | ||
} | ||
|
||
public PageDto getPage() { | ||
return page; | ||
} | ||
|
||
public List<SearchProductDto> getProducts() { | ||
return products; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍👍👍👍👍👍