-
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 pull request #124 from Tiketeer/migration
DB Migration
- Loading branch information
Showing
103 changed files
with
2,983 additions
and
1,557 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 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(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...java/com/tiketeer/Tiketeer/domain/member/controller/dto/GetMemberPurchaseResponseDto.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.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.GetMemberPurchaseResultDto; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
public final class GetMemberPurchaseResponseDto { | ||
private final UUID purchaseId; | ||
private final UUID ticketingId; | ||
private final String title; | ||
private final String location; | ||
private final LocalDateTime eventTime; | ||
private final LocalDateTime createdAt; | ||
private final String category; | ||
private final int runningMinute; | ||
private final String thumbnailPath; | ||
private final List<GetMemberPurchaseResultDto.PurchaseItem> purchaseItems; | ||
|
||
@Builder | ||
public GetMemberPurchaseResponseDto(UUID purchaseId, UUID ticketingId, String title, String location, | ||
LocalDateTime eventTime, LocalDateTime createdAt, String category, | ||
int runningMinute, String thumbnailPath, | ||
List<GetMemberPurchaseResultDto.PurchaseItem> purchaseItems) { | ||
this.purchaseId = purchaseId; | ||
this.ticketingId = ticketingId; | ||
this.title = title; | ||
this.location = location; | ||
this.eventTime = eventTime; | ||
this.createdAt = createdAt; | ||
this.category = category; | ||
this.runningMinute = runningMinute; | ||
this.thumbnailPath = thumbnailPath; | ||
this.purchaseItems = purchaseItems; | ||
} | ||
|
||
public static GetMemberPurchaseResponseDto convertFromDto(GetMemberPurchaseResultDto dto) { | ||
return GetMemberPurchaseResponseDto.builder() | ||
.purchaseId(dto.getPurchaseId()) | ||
.ticketingId(dto.getTicketingId()) | ||
.title(dto.getTitle()) | ||
.location(dto.getLocation()) | ||
.eventTime(dto.getEventTime()) | ||
.createdAt(dto.getCreatedAt()) | ||
.category(dto.getCategory()) | ||
.runningMinute(dto.getRunningMinutes()) | ||
.thumbnailPath(dto.getThumbnailPath()) | ||
.purchaseItems(dto.getPurchaseItems()) | ||
.build(); | ||
} | ||
} |
59 changes: 0 additions & 59 deletions
59
...ava/com/tiketeer/Tiketeer/domain/member/controller/dto/GetMemberPurchasesResponseDto.java
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
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()); | ||
} | ||
} |
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.