Skip to content
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

[Feature/427] 테마샵 기능 구현 #433

Open
wants to merge 21 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
974d055
:sparkles: Feat: 테마 엔티티 type 구현
hosung-222 Jan 1, 2025
14ab965
:sparkles: Feat: 테마 엔티티 구현 Theme.class
hosung-222 Jan 1, 2025
4dd6408
:sparkles: Feat: 테마 구매 내역 연결 엔티티 구현
hosung-222 Jan 1, 2025
b46dfaa
:sparkles: Feat: 테마 상세 사진 여러장 저장을 위한 엔티티 구현
hosung-222 Jan 1, 2025
33fe500
:sparkles: Feat: 테마 샵 관련 JPA 레파지토리 구현
hosung-222 Jan 1, 2025
759bd31
:sparkles: Feat: 테마 샵 관련 도메인 서비스 구조 생성
hosung-222 Jan 1, 2025
760bf23
:sparkles: Feat: 테마 조회 API 명세
hosung-222 Jan 2, 2025
e2cacfd
:sparkles: Feat: 테마 판매 상태 Enum 추가
hosung-222 Jan 2, 2025
a4c23b8
:sparkles: Feat: 테마 판매 상태와 종류 별 조회 도메인 기능 구현
hosung-222 Jan 2, 2025
b5cedc8
:sparkles: Feat: 조회된 테마를 dto로 변환하는 Converter 구현
hosung-222 Jan 2, 2025
7ae826e
:sparkles: Feat: 타입별 판매중인 테마 조회 API 구현
hosung-222 Jan 2, 2025
7e05b1b
:sparkles: Feat: 테마 상세 조회 API 스펙 명세
hosung-222 Jan 4, 2025
6c6f9f5
:recycle: Recycle: 테마 상세 조회에 보유 여부 추가
hosung-222 Jan 4, 2025
b1ff6a5
:recycle: Recycle: 테마 판매 상태 세분화
hosung-222 Jan 4, 2025
cbf9f54
:sparkles: Feat: 테마 상태, id로 조회하는 도메인 로직 구현
hosung-222 Jan 4, 2025
d13b4c9
:sparkles: Feat: 테마 구매 정보를 반환하는 도메인 로직 구현
hosung-222 Jan 4, 2025
cb2fbce
:sparkles: Feat: 테마 정보 없음에 대한 error code
hosung-222 Jan 4, 2025
a770a82
:sparkles: Feat: DB에 저장되지 않는 테마 소유 여부 필드 추가
hosung-222 Jan 4, 2025
fa86a1c
:sparkles: Feat: 테마 정보와 해당 테마의 소유 여부를 반환하는 비즈니스 로직 구현
hosung-222 Jan 4, 2025
66bca3f
:sparkles: Feat: 테마 정보 -> DTO 컨버터 구현
hosung-222 Jan 4, 2025
13f4cfe
:sparkles: Feat: 테마 상세 정보 (보유여부 포함) 를 조회하는 API 구현
hosung-222 Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
✨ Feat: 테마 정보 -> DTO 컨버터 구현
Builder 패턴을 활용한 변환 코드 작성

- 관련 : #427
hosung-222 committed Jan 4, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 66bca3f034b59cc2f2dc42fdf5e55d795bf10b63
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

import com.namo.spring.application.external.api.shop.dto.ThemeResponse;
import com.namo.spring.db.mysql.domains.shop.entity.Theme;
import com.namo.spring.db.mysql.domains.shop.entity.ThemeDetailImage;

public class ThemeConverter {

@@ -33,4 +34,19 @@ public static ThemeResponse.ThemePreviewDto toThemeResponseDto(Theme theme) {
.previewImageUrl(theme.getPreviewImageUrl())
.build();
}

public static ThemeResponse.ThemeInfoDto toThemeInfoDto(Theme theme) {
List<String> detailImages = theme.getDetailImages().stream()
.map(ThemeDetailImage::getImageUrl)
.toList();

return ThemeResponse.ThemeInfoDto.builder()
.id(theme.getId())
.name(theme.getName())
.description(theme.getDescription())
.price(theme.getPrice())
.detailImages(detailImages)
.isOwned(theme.isOwned())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -23,11 +23,24 @@ public class ThemeManageService {
private final ThemeService themeService;
private final MemberThemeService memberThemeService;

/**
* 테마 타입에 따른 테마 목록을 반환 합니다.
* @param themeType (프로필, 배경)
* @param page
* @param size
* @return
*/
public Page<Theme> getSellingThemesByType(ThemeType themeType, int page, int size) {
Pageable pageable = PageRequest.of(page - 1, size);
return themeService.findByTypeAndStatus(themeType, pageable, ThemeStatus.SELLING);
}

/**
* 테마 정보와 소유 여부를 반환 합니다.
* @param memberId
* @param themeId
* @return
*/
public Theme getThemeByIdWithOwnership(Long memberId, Long themeId) {
Theme theme = themeService.findByIdAndStatus(themeId, ThemeStatus.SELLING)
.orElseThrow(() -> new ThemeException(ErrorStatus.NOT_FOUND_THEME));