@teacinema/contracts 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/ts/booking.ts +155 -0
- package/gen/ts/screening.ts +1 -0
- package/package.json +1 -1
- package/proto/booking.proto +97 -0
- package/proto/screening.proto +1 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -15,4 +15,5 @@ exports.PROTO_PATHS = {
|
|
|
15
15
|
SCREENING: (0, path_1.join)(__dirname, '../../proto/screening.proto'),
|
|
16
16
|
PAYMENT: (0, path_1.join)(__dirname, '../../proto/payment.proto'),
|
|
17
17
|
REFUND: (0, path_1.join)(__dirname, '../../proto/refund.proto'),
|
|
18
|
+
BOOKING: (0, path_1.join)(__dirname, '../../proto/booking.proto'),
|
|
18
19
|
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.8.3
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: booking.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "booking.v1";
|
|
12
|
+
|
|
13
|
+
export interface GetUserBookingsRequest {
|
|
14
|
+
userId: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GetUserBookingsResponse {
|
|
18
|
+
bookings: BookingItem[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CreateReservationRequest {
|
|
22
|
+
userId: string;
|
|
23
|
+
screeningId: string;
|
|
24
|
+
seats: SeatInput[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CreateReservationResponse {
|
|
28
|
+
orderId: string;
|
|
29
|
+
ticketIds: string[];
|
|
30
|
+
amount: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface SeatInput {
|
|
34
|
+
seatId: string;
|
|
35
|
+
price: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ConfirmBookingRequest {
|
|
39
|
+
bookingId: string;
|
|
40
|
+
userId: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ConfirmBookingResponse {
|
|
44
|
+
ok: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CancelBookingRequest {
|
|
48
|
+
bookingId: string;
|
|
49
|
+
userId: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CancelBookingResponse {
|
|
53
|
+
ok: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ListReservedSeatsRequest {
|
|
57
|
+
hallId: string;
|
|
58
|
+
screeningId: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ListReservedSeatsResponse {
|
|
62
|
+
reservedSeatIds: string[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface BookingSeatInfo {
|
|
66
|
+
id: string;
|
|
67
|
+
row: number;
|
|
68
|
+
number: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface BookingMovieInfo {
|
|
72
|
+
id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
poster: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface BookingTheaterInfo {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface BookingHallInfo {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface BookingItem {
|
|
88
|
+
id: string;
|
|
89
|
+
screeningDate: string;
|
|
90
|
+
screeningTime: string;
|
|
91
|
+
movie: BookingMovieInfo | undefined;
|
|
92
|
+
theater: BookingTheaterInfo | undefined;
|
|
93
|
+
hall: BookingHallInfo | undefined;
|
|
94
|
+
seats: BookingSeatInfo[];
|
|
95
|
+
qrCode: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const BOOKING_V1_PACKAGE_NAME = "booking.v1";
|
|
99
|
+
|
|
100
|
+
export interface BookingServiceClient {
|
|
101
|
+
getUserBookings(request: GetUserBookingsRequest): Observable<GetUserBookingsResponse>;
|
|
102
|
+
|
|
103
|
+
createReservation(request: CreateReservationRequest): Observable<CreateReservationResponse>;
|
|
104
|
+
|
|
105
|
+
confirmBooking(request: ConfirmBookingRequest): Observable<ConfirmBookingResponse>;
|
|
106
|
+
|
|
107
|
+
cancelBooking(request: CancelBookingRequest): Observable<CancelBookingResponse>;
|
|
108
|
+
|
|
109
|
+
listReservedSeats(request: ListReservedSeatsRequest): Observable<ListReservedSeatsResponse>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface BookingServiceController {
|
|
113
|
+
getUserBookings(
|
|
114
|
+
request: GetUserBookingsRequest,
|
|
115
|
+
): Promise<GetUserBookingsResponse> | Observable<GetUserBookingsResponse> | GetUserBookingsResponse;
|
|
116
|
+
|
|
117
|
+
createReservation(
|
|
118
|
+
request: CreateReservationRequest,
|
|
119
|
+
): Promise<CreateReservationResponse> | Observable<CreateReservationResponse> | CreateReservationResponse;
|
|
120
|
+
|
|
121
|
+
confirmBooking(
|
|
122
|
+
request: ConfirmBookingRequest,
|
|
123
|
+
): Promise<ConfirmBookingResponse> | Observable<ConfirmBookingResponse> | ConfirmBookingResponse;
|
|
124
|
+
|
|
125
|
+
cancelBooking(
|
|
126
|
+
request: CancelBookingRequest,
|
|
127
|
+
): Promise<CancelBookingResponse> | Observable<CancelBookingResponse> | CancelBookingResponse;
|
|
128
|
+
|
|
129
|
+
listReservedSeats(
|
|
130
|
+
request: ListReservedSeatsRequest,
|
|
131
|
+
): Promise<ListReservedSeatsResponse> | Observable<ListReservedSeatsResponse> | ListReservedSeatsResponse;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function BookingServiceControllerMethods() {
|
|
135
|
+
return function (constructor: Function) {
|
|
136
|
+
const grpcMethods: string[] = [
|
|
137
|
+
"getUserBookings",
|
|
138
|
+
"createReservation",
|
|
139
|
+
"confirmBooking",
|
|
140
|
+
"cancelBooking",
|
|
141
|
+
"listReservedSeats",
|
|
142
|
+
];
|
|
143
|
+
for (const method of grpcMethods) {
|
|
144
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
145
|
+
GrpcMethod("BookingService", method)(constructor.prototype[method], method, descriptor);
|
|
146
|
+
}
|
|
147
|
+
const grpcStreamMethods: string[] = [];
|
|
148
|
+
for (const method of grpcStreamMethods) {
|
|
149
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
150
|
+
GrpcStreamMethod("BookingService", method)(constructor.prototype[method], method, descriptor);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const BOOKING_SERVICE_NAME = "BookingService";
|
package/gen/ts/screening.ts
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package booking.v1;
|
|
4
|
+
|
|
5
|
+
service BookingService {
|
|
6
|
+
rpc GetUserBookings (GetUserBookingsRequest) returns (GetUserBookingsResponse);
|
|
7
|
+
rpc CreateReservation (CreateReservationRequest) returns (CreateReservationResponse);
|
|
8
|
+
rpc ConfirmBooking (ConfirmBookingRequest) returns (ConfirmBookingResponse);
|
|
9
|
+
rpc CancelBooking (CancelBookingRequest) returns (CancelBookingResponse);
|
|
10
|
+
|
|
11
|
+
rpc ListReservedSeats (ListReservedSeatsRequest) returns (ListReservedSeatsResponse);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message GetUserBookingsRequest {
|
|
15
|
+
string user_id = 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message GetUserBookingsResponse {
|
|
19
|
+
repeated BookingItem bookings = 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message CreateReservationRequest {
|
|
23
|
+
string user_id = 1;
|
|
24
|
+
string screening_id = 2;
|
|
25
|
+
repeated SeatInput seats = 3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message CreateReservationResponse {
|
|
29
|
+
string order_id = 1;
|
|
30
|
+
repeated string ticket_ids = 2;
|
|
31
|
+
int32 amount = 3;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message SeatInput {
|
|
35
|
+
string seat_id = 1;
|
|
36
|
+
int32 price = 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message ConfirmBookingRequest {
|
|
40
|
+
string booking_id = 1;
|
|
41
|
+
string user_id = 2;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message ConfirmBookingResponse {
|
|
45
|
+
bool ok = 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
message CancelBookingRequest {
|
|
49
|
+
string booking_id = 1;
|
|
50
|
+
string user_id = 2;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message CancelBookingResponse {
|
|
54
|
+
bool ok = 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message ListReservedSeatsRequest {
|
|
58
|
+
string hall_id = 1;
|
|
59
|
+
string screening_id = 2;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message ListReservedSeatsResponse {
|
|
63
|
+
repeated string reserved_seat_ids = 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
message BookingSeatInfo {
|
|
67
|
+
string id = 1;
|
|
68
|
+
int32 row = 2;
|
|
69
|
+
int32 number = 3;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
message BookingMovieInfo {
|
|
73
|
+
string id = 1;
|
|
74
|
+
string title = 2;
|
|
75
|
+
string poster = 3;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message BookingTheaterInfo {
|
|
79
|
+
string id = 1;
|
|
80
|
+
string name = 2;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message BookingHallInfo {
|
|
84
|
+
string id = 1;
|
|
85
|
+
string name = 2;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
message BookingItem {
|
|
89
|
+
string id = 1;
|
|
90
|
+
string screening_date = 2;
|
|
91
|
+
string screening_time = 3;
|
|
92
|
+
BookingMovieInfo movie = 4;
|
|
93
|
+
BookingTheaterInfo theater = 5;
|
|
94
|
+
BookingHallInfo hall = 6;
|
|
95
|
+
repeated BookingSeatInfo seats = 7;
|
|
96
|
+
string qr_code = 8;
|
|
97
|
+
}
|