@teacinema/contracts 1.3.3 → 1.4.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 +2 -0
- package/dist/proto/paths.js +2 -0
- package/gen/ts/payment.ts +78 -0
- package/gen/ts/screening.ts +129 -0
- package/package.json +1 -1
- package/proto/payment.proto +40 -0
- package/proto/screening.proto +84 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -12,4 +12,6 @@ exports.PROTO_PATHS = {
|
|
|
12
12
|
THEATER: (0, path_1.join)(__dirname, '../../proto/theater.proto'),
|
|
13
13
|
HALL: (0, path_1.join)(__dirname, '../../proto/hall.proto'),
|
|
14
14
|
SEAT: (0, path_1.join)(__dirname, '../../proto/seat.proto'),
|
|
15
|
+
SCREENING: (0, path_1.join)(__dirname, '../../proto/screening.proto'),
|
|
16
|
+
PAYMENT: (0, path_1.join)(__dirname, '../../proto/payment.proto'),
|
|
15
17
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
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: payment.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "payment.v1";
|
|
12
|
+
|
|
13
|
+
export interface CreatePaymentRequest {
|
|
14
|
+
userId: string;
|
|
15
|
+
screeningId: string;
|
|
16
|
+
seats: SeatInput[];
|
|
17
|
+
paymentMethodId?: string | undefined;
|
|
18
|
+
savePaymentMethod: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CreatePaymentResponse {
|
|
22
|
+
url: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ProcessPaymentEventRequest {
|
|
26
|
+
event: string;
|
|
27
|
+
paymentId: string;
|
|
28
|
+
bookingId: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
savePaymentMethod: boolean;
|
|
31
|
+
providerPaymentId: string;
|
|
32
|
+
cardFirst6: string;
|
|
33
|
+
cardLast4: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ProcessPaymentEventResponse {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SeatInput {
|
|
41
|
+
seatId: string;
|
|
42
|
+
price: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
|
|
46
|
+
|
|
47
|
+
export interface PaymentServiceClient {
|
|
48
|
+
createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
|
|
49
|
+
|
|
50
|
+
processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PaymentServiceController {
|
|
54
|
+
createPayment(
|
|
55
|
+
request: CreatePaymentRequest,
|
|
56
|
+
): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
|
|
57
|
+
|
|
58
|
+
processPaymentEvent(
|
|
59
|
+
request: ProcessPaymentEventRequest,
|
|
60
|
+
): Promise<ProcessPaymentEventResponse> | Observable<ProcessPaymentEventResponse> | ProcessPaymentEventResponse;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function PaymentServiceControllerMethods() {
|
|
64
|
+
return function (constructor: Function) {
|
|
65
|
+
const grpcMethods: string[] = ["createPayment", "processPaymentEvent"];
|
|
66
|
+
for (const method of grpcMethods) {
|
|
67
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
68
|
+
GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
69
|
+
}
|
|
70
|
+
const grpcStreamMethods: string[] = [];
|
|
71
|
+
for (const method of grpcStreamMethods) {
|
|
72
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
73
|
+
GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const PAYMENT_SERVICE_NAME = "PaymentService";
|
|
@@ -0,0 +1,129 @@
|
|
|
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: screening.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "screening.v1";
|
|
12
|
+
|
|
13
|
+
export interface CreateScreeningRequest {
|
|
14
|
+
movieId: string;
|
|
15
|
+
hallId: string;
|
|
16
|
+
startAt: string;
|
|
17
|
+
endAt: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CreateScreeningResponse {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface GetScreeningsRequest {
|
|
25
|
+
theaterId?: string | undefined;
|
|
26
|
+
date?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface GetScreeningsResponse {
|
|
30
|
+
screenings: Screening[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface GetScreeningsByMovieRequest {
|
|
34
|
+
movieId: string;
|
|
35
|
+
date?: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface GetScreeningsByMovieResponse {
|
|
39
|
+
screenings: Screening[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface GetScreeningRequest {
|
|
43
|
+
id: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface GetScreeningResponse {
|
|
47
|
+
screening: Screening | undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Screening {
|
|
51
|
+
id: string;
|
|
52
|
+
startAt: string;
|
|
53
|
+
endAt: string;
|
|
54
|
+
theater: Theater | undefined;
|
|
55
|
+
hall: Hall | undefined;
|
|
56
|
+
movie: Movie | undefined;
|
|
57
|
+
seatTypes: SeatType[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface Movie {
|
|
61
|
+
id: string;
|
|
62
|
+
title: string;
|
|
63
|
+
slug: string;
|
|
64
|
+
duration: number;
|
|
65
|
+
banner: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface Theater {
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
address: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface Hall {
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface SeatType {
|
|
80
|
+
type: string;
|
|
81
|
+
price: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const SCREENING_V1_PACKAGE_NAME = "screening.v1";
|
|
85
|
+
|
|
86
|
+
export interface ScreeningServiceClient {
|
|
87
|
+
createScreening(request: CreateScreeningRequest): Observable<CreateScreeningResponse>;
|
|
88
|
+
|
|
89
|
+
getScreenings(request: GetScreeningsRequest): Observable<GetScreeningsResponse>;
|
|
90
|
+
|
|
91
|
+
getScreeningsByMovie(request: GetScreeningsByMovieRequest): Observable<GetScreeningsByMovieResponse>;
|
|
92
|
+
|
|
93
|
+
getScreening(request: GetScreeningRequest): Observable<GetScreeningResponse>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ScreeningServiceController {
|
|
97
|
+
createScreening(
|
|
98
|
+
request: CreateScreeningRequest,
|
|
99
|
+
): Promise<CreateScreeningResponse> | Observable<CreateScreeningResponse> | CreateScreeningResponse;
|
|
100
|
+
|
|
101
|
+
getScreenings(
|
|
102
|
+
request: GetScreeningsRequest,
|
|
103
|
+
): Promise<GetScreeningsResponse> | Observable<GetScreeningsResponse> | GetScreeningsResponse;
|
|
104
|
+
|
|
105
|
+
getScreeningsByMovie(
|
|
106
|
+
request: GetScreeningsByMovieRequest,
|
|
107
|
+
): Promise<GetScreeningsByMovieResponse> | Observable<GetScreeningsByMovieResponse> | GetScreeningsByMovieResponse;
|
|
108
|
+
|
|
109
|
+
getScreening(
|
|
110
|
+
request: GetScreeningRequest,
|
|
111
|
+
): Promise<GetScreeningResponse> | Observable<GetScreeningResponse> | GetScreeningResponse;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function ScreeningServiceControllerMethods() {
|
|
115
|
+
return function (constructor: Function) {
|
|
116
|
+
const grpcMethods: string[] = ["createScreening", "getScreenings", "getScreeningsByMovie", "getScreening"];
|
|
117
|
+
for (const method of grpcMethods) {
|
|
118
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
119
|
+
GrpcMethod("ScreeningService", method)(constructor.prototype[method], method, descriptor);
|
|
120
|
+
}
|
|
121
|
+
const grpcStreamMethods: string[] = [];
|
|
122
|
+
for (const method of grpcStreamMethods) {
|
|
123
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
124
|
+
GrpcStreamMethod("ScreeningService", method)(constructor.prototype[method], method, descriptor);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const SCREENING_SERVICE_NAME = "ScreeningService";
|
package/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package payment.v1;
|
|
4
|
+
|
|
5
|
+
service PaymentService {
|
|
6
|
+
rpc CreatePayment (CreatePaymentRequest) returns (CreatePaymentResponse);
|
|
7
|
+
rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message CreatePaymentRequest {
|
|
11
|
+
string user_id = 1;
|
|
12
|
+
string screening_id = 2;
|
|
13
|
+
repeated SeatInput seats = 3;
|
|
14
|
+
optional string payment_method_id = 4;
|
|
15
|
+
bool save_payment_method = 5;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message CreatePaymentResponse {
|
|
19
|
+
string url = 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message ProcessPaymentEventRequest {
|
|
23
|
+
string event = 1;
|
|
24
|
+
string payment_id = 2;
|
|
25
|
+
string booking_id = 3;
|
|
26
|
+
string user_id = 4;
|
|
27
|
+
bool save_payment_method = 5;
|
|
28
|
+
string provider_payment_id = 6;
|
|
29
|
+
string card_first6 = 7;
|
|
30
|
+
string card_last4 = 8;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message ProcessPaymentEventResponse {
|
|
34
|
+
bool ok = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message SeatInput {
|
|
38
|
+
string seat_id = 1;
|
|
39
|
+
int32 price = 2;
|
|
40
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package screening.v1;
|
|
4
|
+
|
|
5
|
+
service ScreeningService {
|
|
6
|
+
rpc CreateScreening (CreateScreeningRequest) returns (CreateScreeningResponse);
|
|
7
|
+
|
|
8
|
+
rpc GetScreenings (GetScreeningsRequest) returns (GetScreeningsResponse);
|
|
9
|
+
rpc GetScreeningsByMovie (GetScreeningsByMovieRequest) returns (GetScreeningsByMovieResponse);
|
|
10
|
+
rpc GetScreening (GetScreeningRequest) returns (GetScreeningResponse);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message CreateScreeningRequest {
|
|
14
|
+
string movie_id = 1;
|
|
15
|
+
string hall_id = 2;
|
|
16
|
+
string start_at = 3;
|
|
17
|
+
string end_at = 4;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
message CreateScreeningResponse {
|
|
21
|
+
bool ok = 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
message GetScreeningsRequest {
|
|
25
|
+
optional string theater_id = 1;
|
|
26
|
+
optional string date = 2;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message GetScreeningsResponse {
|
|
30
|
+
repeated Screening screenings = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message GetScreeningsByMovieRequest {
|
|
34
|
+
string movie_id = 1;
|
|
35
|
+
optional string date = 2;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message GetScreeningsByMovieResponse {
|
|
39
|
+
repeated Screening screenings = 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message GetScreeningRequest {
|
|
43
|
+
string id = 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message GetScreeningResponse {
|
|
47
|
+
Screening screening = 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message Screening {
|
|
51
|
+
string id = 1;
|
|
52
|
+
string start_at = 2;
|
|
53
|
+
string end_at = 3;
|
|
54
|
+
|
|
55
|
+
Theater theater = 4;
|
|
56
|
+
Hall hall = 5;
|
|
57
|
+
Movie movie = 6;
|
|
58
|
+
|
|
59
|
+
repeated SeatType seat_types = 7;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message Movie {
|
|
63
|
+
string id = 1;
|
|
64
|
+
string title = 2;
|
|
65
|
+
string slug = 3;
|
|
66
|
+
int32 duration = 4;
|
|
67
|
+
string banner = 5;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
message Theater {
|
|
71
|
+
string id = 1;
|
|
72
|
+
string name = 2;
|
|
73
|
+
string address = 3;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
message Hall {
|
|
77
|
+
string id = 1;
|
|
78
|
+
string name = 2;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
message SeatType {
|
|
82
|
+
string type = 1;
|
|
83
|
+
int32 price = 2;
|
|
84
|
+
}
|