-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: 특정 판매자 페이지(판매자 정보와 판매 상품 불러오기) (#57)
- Loading branch information
Showing
4 changed files
with
114 additions
and
2 deletions.
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
52 changes: 52 additions & 0 deletions
52
src/main/java/umc/unimade/domain/accounts/dto/SellerPageResponse.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,52 @@ | ||
package umc.unimade.domain.accounts.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
import umc.unimade.domain.accounts.entity.Seller; | ||
import umc.unimade.domain.products.entity.Products; | ||
|
||
import java.util.List; | ||
|
||
// TODO - md 찜 수, 상품 찜 수, 접속한 buyer가 해당 seller 찜한 여부, + 설명창,인스타 (?) | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class SellerPageResponse { | ||
private String profileImage; | ||
private String name; | ||
private String phone; | ||
private Page<ProductsResponse> products; | ||
|
||
public static SellerPageResponse of(Seller seller, Page<ProductsResponse> products) { | ||
return SellerPageResponse.builder() | ||
.profileImage(seller.getProfileImage()) | ||
.name(seller.getName()) | ||
.phone(seller.getPhone()) | ||
.products(products) | ||
.build(); | ||
} | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public static class ProductsResponse { | ||
private Long productId; | ||
private String name; | ||
private Long price; | ||
private String imageUrl; | ||
|
||
public static ProductsResponse from(Products product) { | ||
return ProductsResponse.builder() | ||
.productId(product.getId()) | ||
.name(product.getName()) | ||
.price(product.getPrice()) | ||
.imageUrl(product.getProductImages().isEmpty() ? null : product.getProductImages().get(0).getImageUrl()) | ||
.build(); | ||
} | ||
} | ||
} |
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