-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 티켓 재고 레디스 큐 사용하여 관리하도록 변경 및 추가
- Loading branch information
1 parent
0fcce86
commit 0bbe180
Showing
23 changed files
with
318 additions
and
418 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
21 changes: 0 additions & 21 deletions
21
.../src/main/java/com/festago/ticketing/application/command/TicketQuantityUpdateService.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
.../src/main/java/com/festago/ticketing/application/command/TicketSequenceUpdateService.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,21 @@ | ||
package com.festago.ticketing.application.command; | ||
|
||
import com.festago.ticket.domain.NewTicket; | ||
import com.festago.ticketing.repository.TicketSequenceRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class TicketSequenceUpdateService { | ||
|
||
private final TicketSequenceRepository ticketSequenceRepository; | ||
|
||
public void putOrDeleteTicketSequence(NewTicket ticket) { | ||
if (ticket.isEmptyAmount()) { | ||
ticketSequenceRepository.delete(ticket); | ||
} else { | ||
ticketSequenceRepository.put(ticket); | ||
} | ||
} | ||
} |
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
36 changes: 0 additions & 36 deletions
36
backend/src/main/java/com/festago/ticketing/domain/TicketQuantity.java
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
backend/src/main/java/com/festago/ticketing/domain/TicketSequence.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,38 @@ | ||
package com.festago.ticketing.domain; | ||
|
||
import com.festago.common.exception.BadRequestException; | ||
|
||
/** | ||
* 티켓의 재고와 순서를 관리하는 도메인 <br/> 해당 도메인을 구현하는 구현체는 반드시 원자적인 연산을 사용해야 한다. <br/> | ||
*/ | ||
public interface TicketSequence { | ||
|
||
/** | ||
* 티켓의 매진 여부를 반환한다. | ||
* | ||
* @return 티켓이 매진이면 true, 매진이 아니면 false | ||
*/ | ||
boolean isSoldOut(); | ||
|
||
/** | ||
* 티켓의 재고를 하나 감소시키고 순서를 반환한다. <br/> 해당 메서드의 연산은 atomic 해야 한다. <br/> 티켓의 재고가 비어있을 때 해당 메서드를 호출하면 BadRequestException을 | ||
* 던져야 한다. <br/> | ||
* | ||
* @throws BadRequestException 티켓의 재고가 비어있으면 | ||
*/ | ||
int reserve() throws BadRequestException; | ||
|
||
/** | ||
* 티켓의 재고를 하나 증가시키고 인자로 들어온 순서를 다시 보관한다. <br/> 해당 메서드의 연산은 atomic 해야 한다. <br/> | ||
* | ||
* @param sequence 티켓의 순서 | ||
*/ | ||
void cancel(int sequence); | ||
|
||
/** | ||
* 티켓의 남은 재고를 반환한다. <br/> | ||
* | ||
* @return 티켓의 남은 재고 | ||
*/ | ||
int getQuantity(); | ||
} |
6 changes: 0 additions & 6 deletions
6
backend/src/main/java/com/festago/ticketing/domain/TicketingSequenceGenerator.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
...c/main/java/com/festago/ticketing/infrastructure/RedisTicketingSequenceEventListener.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
...d/src/main/java/com/festago/ticketing/infrastructure/RedisTicketingSequenceGenerator.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.