-
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.
Merge branch 'feat/DEV-299' into feat/DEV-312
- Loading branch information
Showing
39 changed files
with
855 additions
and
252 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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
.../com/tiketeer/Tiketeer/domain/member/controller/dto/GetMemberAllPurchasesResponseDto.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,51 @@ | ||
package com.tiketeer.Tiketeer.domain.member.controller.dto; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
import com.tiketeer.Tiketeer.domain.member.usecase.dto.GetMemberAllPurchasesResultDto; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
public final class GetMemberAllPurchasesResponseDto { | ||
private final UUID purchaseId; | ||
private final UUID ticketingId; | ||
private final String title; | ||
private final LocalDateTime eventTime; | ||
private final LocalDateTime createdAt; | ||
private final String category; | ||
private final String thumbnailPath; | ||
private final List<GetMemberAllPurchasesResultDto.PurchaseItem> purchaseItems; | ||
|
||
@Builder | ||
public GetMemberAllPurchasesResponseDto(UUID purchaseId, UUID ticketingId, String title, | ||
LocalDateTime eventTime, LocalDateTime createdAt, String category, String thumbnailPath, | ||
List<GetMemberAllPurchasesResultDto.PurchaseItem> purchaseItems) { | ||
this.purchaseId = purchaseId; | ||
this.ticketingId = ticketingId; | ||
this.title = title; | ||
this.eventTime = eventTime; | ||
this.createdAt = createdAt; | ||
this.category = category; | ||
this.thumbnailPath = thumbnailPath; | ||
this.purchaseItems = purchaseItems; | ||
} | ||
|
||
public static GetMemberAllPurchasesResponseDto convertFromDto(GetMemberAllPurchasesResultDto dto) { | ||
return GetMemberAllPurchasesResponseDto.builder() | ||
.purchaseId(dto.getPurchaseId()) | ||
.ticketingId(dto.getTicketingId()) | ||
.title(dto.getTitle()) | ||
.eventTime(dto.getEventTime()) | ||
.createdAt(dto.getCreatedAt()) | ||
.category(dto.getCategory()) | ||
.thumbnailPath(dto.getThumbnailPath()) | ||
.purchaseItems(dto.getPurchaseItems()) | ||
.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
34 changes: 34 additions & 0 deletions
34
src/main/java/com/tiketeer/Tiketeer/domain/member/usecase/GetMemberPurchaseUseCase.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,34 @@ | ||
package com.tiketeer.Tiketeer.domain.member.usecase; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import com.tiketeer.Tiketeer.domain.member.exception.MemberNotFoundException; | ||
import com.tiketeer.Tiketeer.domain.member.repository.MemberRepository; | ||
import com.tiketeer.Tiketeer.domain.member.usecase.dto.GetMemberPurchaseCommandDto; | ||
import com.tiketeer.Tiketeer.domain.member.usecase.dto.GetMemberPurchaseResultDto; | ||
import com.tiketeer.Tiketeer.domain.purchase.exception.PurchaseNotFoundException; | ||
import com.tiketeer.Tiketeer.domain.purchase.repository.PurchaseRepository; | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
public class GetMemberPurchaseUseCase { | ||
private final MemberRepository memberRepository; | ||
private final PurchaseRepository purchaseRepository; | ||
|
||
@Autowired | ||
public GetMemberPurchaseUseCase(MemberRepository memberRepository, PurchaseRepository purchaseRepository) { | ||
this.memberRepository = memberRepository; | ||
this.purchaseRepository = purchaseRepository; | ||
} | ||
|
||
public GetMemberPurchaseResultDto getMemberPurchases(GetMemberPurchaseCommandDto command) { | ||
var member = memberRepository.findByEmail(command.getMemberEmail()).orElseThrow(MemberNotFoundException::new); | ||
var results = purchaseRepository.findWithTicketingByMember(member); | ||
if (results.isEmpty()) { | ||
throw new PurchaseNotFoundException(); | ||
} | ||
return new GetMemberPurchaseResultDto(results.getFirst()); | ||
} | ||
} |
Oops, something went wrong.