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

[DEV-320] ticketing 전체 조회 EP 마이그레이션 #118

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ void getAllTicketingsSuccess() throws Exception {
var member = testHelper.createMember("[email protected]", RoleEnum.SELLER);
var ticketingCnt = 3;
var ticketingsInDb = createTicketings(member, ticketingCnt);
ticketingsInDb.forEach(ticketing -> {
createTickets(ticketing, 3);
});
ticketingsInDb.forEach(this::createTickets);

// when
AtomicReference<ResultActions> result = new AtomicReference<>();
Expand Down Expand Up @@ -140,7 +138,7 @@ void getTicketingSuccess() throws Exception {
var member = testHelper.createMember("[email protected]", RoleEnum.SELLER);
var ticketingInDb = createTicketings(member, 1).getFirst();
var stock = 10;
createTickets(ticketingInDb, stock);
createTickets(ticketingInDb);

// when
AtomicReference<ResultActions> result = new AtomicReference<>();
Expand Down Expand Up @@ -323,10 +321,14 @@ private List<Ticketing> createTicketings(Member member, int count) {
return ticketingRepository.saveAll(ticketings);
}

private List<Ticket> createTickets(Ticketing ticketing, int stock) {
return ticketRepository.saveAll(Arrays.stream(new int[stock])
.mapToObj(i -> Ticket.builder().ticketing(ticketing).build())
.toList());
private List<Ticket> createTickets(Ticketing ticketing) {
return ticketRepository.saveAll(
Arrays.asList(
new Ticket(1000, 10, 10, "Bronze", "", ticketing),
new Ticket(2000, 10, 10, "Silver", "", ticketing),
new Ticket(3000, 10, 10, "Gold", "", ticketing)
)
);
}

private CreateTicketingCommandDto createCreateTicketingCommand(String email, String title, int runningMinutes) {
Expand Down
Loading