-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75cac87
commit c76fa4a
Showing
34 changed files
with
673 additions
and
88 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
14 changes: 0 additions & 14 deletions
14
app/api/show-api/src/main/java/com/example/publish/message/ReserveShowServiceMessage.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
...api/src/main/java/com/example/publish/message/TicketingAlertsToReserveServiceMessage.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,27 @@ | ||
package com.example.publish.message; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.Builder; | ||
import org.example.dto.response.TicketingAlertsDomainResponse; | ||
|
||
@Builder | ||
public record TicketingAlertsToReserveServiceMessage( | ||
String userFcmToken, | ||
String name, | ||
UUID showId, | ||
List<LocalDateTime> reserveAts | ||
) { | ||
|
||
public static TicketingAlertsToReserveServiceMessage from( | ||
TicketingAlertsDomainResponse responses | ||
) { | ||
return TicketingAlertsToReserveServiceMessage.builder() | ||
.userFcmToken(responses.userFcmToken()) | ||
.name(responses.name()) | ||
.showId(responses.showId()) | ||
.reserveAts(responses.reservedAts()) | ||
.build(); | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
...how-api/src/main/java/com/example/publish/message/TicketingReservationServiceMessage.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
13 changes: 0 additions & 13 deletions
13
...rc/main/java/com/example/show/controller/dto/request/ShowAlertRegistrationApiRequest.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...ain/java/com/example/show/controller/dto/request/TicketingAlertReservationApiRequest.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,29 @@ | ||
package com.example.show.controller.dto.request; | ||
|
||
import com.example.show.controller.vo.TicketingAlertTimeApiType; | ||
import com.example.show.controller.vo.TicketingApiType; | ||
import com.example.show.service.dto.request.TicketingAlertReservationServiceRequest; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import org.example.util.ValidateStatus; | ||
|
||
public record TicketingAlertReservationApiRequest( | ||
|
||
@Schema(description = "공연 티켓팅 알림 시간 선택") | ||
List<TicketingAlertTimeApiType> alertTimes | ||
) { | ||
|
||
public TicketingAlertReservationServiceRequest toServiceRequest( | ||
UUID userId, | ||
UUID showId, | ||
TicketingApiType type | ||
) { | ||
return TicketingAlertReservationServiceRequest.builder() | ||
.userId(userId) | ||
.showId(showId) | ||
.type(type) | ||
.alertTimes(ValidateStatus.checkNullOrEmpty(alertTimes)) | ||
.build(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...n/java/com/example/show/controller/dto/response/TicketingAlertReservationApiResponse.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,31 @@ | ||
package com.example.show.controller.dto.response; | ||
|
||
import com.example.show.service.dto.response.TicketingAlertReservationServiceResponse; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record TicketingAlertReservationApiResponse( | ||
@Schema(description = "공연 알림 예약 상태") | ||
TicketingAlertReservationStatusApiResponse alertReservationStatus, | ||
|
||
@Schema(description = "공연 알림 예약 가능 여부") | ||
TicketingAlertReservationAvailabilityApiResponse alertReservationAvailability | ||
) { | ||
public static TicketingAlertReservationApiResponse from( | ||
TicketingAlertReservationServiceResponse response | ||
) { | ||
var alertReservationStatus = TicketingAlertReservationStatusApiResponse.from( | ||
response.alertReservationStatus() | ||
); | ||
var alertReservationAvailability = TicketingAlertReservationAvailabilityApiResponse.from( | ||
response.alertReservationAvailability() | ||
); | ||
|
||
return TicketingAlertReservationApiResponse.builder() | ||
.alertReservationStatus(alertReservationStatus) | ||
.alertReservationAvailability(alertReservationAvailability) | ||
.build(); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...xample/show/controller/dto/response/TicketingAlertReservationAvailabilityApiResponse.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,28 @@ | ||
package com.example.show.controller.dto.response; | ||
|
||
import com.example.show.service.dto.response.TicketingAlertReservationAvailabilityServiceResponse; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record TicketingAlertReservationAvailabilityApiResponse( | ||
@Schema(description = "공연 티켓팅 24 시간 전") | ||
boolean canReserve24, | ||
|
||
@Schema(description = "공연 티켓팅 6 시간 전") | ||
boolean canReserve6, | ||
|
||
@Schema(description = "공연 티켓팅 1 시간 전") | ||
boolean canReserve1 | ||
) { | ||
|
||
public static TicketingAlertReservationAvailabilityApiResponse from( | ||
TicketingAlertReservationAvailabilityServiceResponse response | ||
) { | ||
return TicketingAlertReservationAvailabilityApiResponse.builder() | ||
.canReserve24(response.canReserve24()) | ||
.canReserve6(response.canReserve6()) | ||
.canReserve1(response.canReserve1()) | ||
.build(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
.../com/example/show/controller/dto/response/TicketingAlertReservationStatusApiResponse.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,29 @@ | ||
package com.example.show.controller.dto.response; | ||
|
||
import com.example.show.service.dto.response.TicketingAlertReservationStatusServiceResponse; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record TicketingAlertReservationStatusApiResponse( | ||
|
||
@Schema(description = "공연 티켓팅 24 시간 전") | ||
boolean before24, | ||
|
||
@Schema(description = "공연 티켓팅 6 시간 전") | ||
boolean before6, | ||
|
||
@Schema(description = "공연 티켓팅 1 시간 전") | ||
boolean before1 | ||
) { | ||
|
||
public static TicketingAlertReservationStatusApiResponse from( | ||
TicketingAlertReservationStatusServiceResponse response | ||
) { | ||
return TicketingAlertReservationStatusApiResponse.builder() | ||
.before24(response.before24()) | ||
.before6(response.before6()) | ||
.before1(response.before1()) | ||
.build(); | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
app/api/show-api/src/main/java/com/example/show/controller/vo/ShowAlertTimeApiType.java
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
app/api/show-api/src/main/java/com/example/show/controller/vo/TicketingAlertTimeApiType.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,47 @@ | ||
package com.example.show.controller.vo; | ||
|
||
import java.time.Duration; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import org.example.vo.TicketingAlertTime; | ||
|
||
public enum TicketingAlertTimeApiType { | ||
BEFORE_24(24), | ||
BEFORE_6(6), | ||
BEFORE_1(1); | ||
|
||
private final int time; | ||
|
||
TicketingAlertTimeApiType(int time) { | ||
this.time = time; | ||
} | ||
|
||
public TicketingAlertTime toDomainType() { | ||
return switch (this) { | ||
case BEFORE_24 -> TicketingAlertTime.BEFORE_24; | ||
case BEFORE_6 -> TicketingAlertTime.BEFORE_6; | ||
case BEFORE_1 -> TicketingAlertTime.BEFORE_1; | ||
}; | ||
} | ||
|
||
public static List<TicketingAlertTime> availableReserveTimeToDomainType(LocalDateTime ticketingAt) { | ||
long hoursDifference = Duration.between(LocalDateTime.now(), ticketingAt).toHours(); | ||
|
||
return ALL_ALERT_TIMES.stream() | ||
.filter(alertTime -> { | ||
return switch (alertTime) { | ||
case BEFORE_24 -> hoursDifference >= 24; | ||
case BEFORE_6 -> hoursDifference >= 6; | ||
case BEFORE_1 -> hoursDifference >= 1; | ||
}; | ||
}) | ||
.toList(); | ||
} | ||
|
||
private static final List<TicketingAlertTime> ALL_ALERT_TIMES = List.of( | ||
TicketingAlertTime.BEFORE_24, | ||
TicketingAlertTime.BEFORE_6, | ||
TicketingAlertTime.BEFORE_1 | ||
); | ||
|
||
} |
Oops, something went wrong.