forked from hanghae-skillup/redis_1st
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReservationRequest.java
More file actions
42 lines (34 loc) · 1.07 KB
/
ReservationRequest.java
File metadata and controls
42 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.example.reservation.request;
import lombok.Getter;
import java.util.List;
import static com.example.exception.BusinessError.*;
@Getter
public class ReservationRequest {
private Long memberId;
private Long screeningId;
private List<Long> seatIds;
public ReservationRequest(Long memberId, Long screeningId, List<Long> seatIds) {
this.memberId = memberId;
this.screeningId = screeningId;
this.seatIds = seatIds;
}
private void validate() {
if (memberId == null) {
throw USER_LOGIN_ERROR.exception();
}
if (screeningId == null) {
throw RESERVATION_SCREENING_SELECT_ERROR.exception();
}
if (seatIds.isEmpty()) {
throw RESERVATION_SEAT_SELECT_ERROR.exception();
}
}
public ReservationServiceRequest toServiceRequest() {
this.validate();
return ReservationServiceRequest.builder()
.memberId(memberId)
.screeningId(screeningId)
.seatIds(seatIds)
.build();
}
}