@airticketss/contracts 1.2.2 → 1.3.0
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/airport.ts +1 -1
- package/gen/ts/plane.ts +78 -0
- package/gen/ts/seat.ts +73 -0
- package/package.json +1 -1
- package/proto/airport.proto +1 -1
- package/proto/plane.proto +41 -0
- package/proto/seat.proto +35 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -9,4 +9,6 @@ exports.PROTO_PATHS = {
|
|
|
9
9
|
FLIGHT: (0, path_1.join)(__dirname, "../../proto/flight.proto"),
|
|
10
10
|
AIRLINE: (0, path_1.join)(__dirname, "../../proto/airline.proto"),
|
|
11
11
|
AIRPORT: (0, path_1.join)(__dirname, "../../proto/airport.proto"),
|
|
12
|
+
PLANE: (0, path_1.join)(__dirname, "../../proto/plane.proto"),
|
|
13
|
+
SEAT: (0, path_1.join)(__dirname, "../../proto/seat.proto"),
|
|
12
14
|
};
|
package/gen/ts/airport.ts
CHANGED
package/gen/ts/plane.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.12.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: plane.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "plane.v1";
|
|
12
|
+
|
|
13
|
+
export interface CreatePlaneRequest {
|
|
14
|
+
name: string;
|
|
15
|
+
airportId: string;
|
|
16
|
+
layout: RowLayout[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CreatePlaneResponse {
|
|
20
|
+
plane: Plane | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface GetPlaneRequest {
|
|
24
|
+
id: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface GetPlaneResponse {
|
|
28
|
+
plane: Plane | undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface Plane {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
airportId: string;
|
|
35
|
+
layout: RowLayout[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface RowLayout {
|
|
39
|
+
row: number;
|
|
40
|
+
columns: number;
|
|
41
|
+
class: string;
|
|
42
|
+
price: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const PLANE_V1_PACKAGE_NAME = "plane.v1";
|
|
46
|
+
|
|
47
|
+
export interface PlaneServiceClient {
|
|
48
|
+
createPlane(request: CreatePlaneRequest): Observable<CreatePlaneResponse>;
|
|
49
|
+
|
|
50
|
+
getPlane(request: GetPlaneRequest): Observable<GetPlaneResponse>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PlaneServiceController {
|
|
54
|
+
createPlane(
|
|
55
|
+
request: CreatePlaneRequest,
|
|
56
|
+
): Promise<CreatePlaneResponse> | Observable<CreatePlaneResponse> | CreatePlaneResponse;
|
|
57
|
+
|
|
58
|
+
getPlane(request: GetPlaneRequest): Promise<GetPlaneResponse> | Observable<GetPlaneResponse> | GetPlaneResponse;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function PlaneServiceControllerMethods() {
|
|
62
|
+
return function (constructor: Function) {
|
|
63
|
+
const grpcMethods: string[] = ["createPlane", "getPlane"];
|
|
64
|
+
for (const method of grpcMethods) {
|
|
65
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
66
|
+
GrpcMethod("PlaneService", method)(constructor.prototype[method], method, descriptor);
|
|
67
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
68
|
+
}
|
|
69
|
+
const grpcStreamMethods: string[] = [];
|
|
70
|
+
for (const method of grpcStreamMethods) {
|
|
71
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
72
|
+
GrpcStreamMethod("PlaneService", method)(constructor.prototype[method], method, descriptor);
|
|
73
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const PLANE_SERVICE_NAME = "PlaneService";
|
package/gen/ts/seat.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.12.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: seat.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "seat.v1";
|
|
12
|
+
|
|
13
|
+
export interface GetSeatRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GetSeatResponse {
|
|
18
|
+
seat: Seat | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ListSeatsRequest {
|
|
22
|
+
planeId: string;
|
|
23
|
+
flightId: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ListSeatsResponse {
|
|
27
|
+
seat: Seat[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Seat {
|
|
31
|
+
id: string;
|
|
32
|
+
row: number;
|
|
33
|
+
number: number;
|
|
34
|
+
price: number;
|
|
35
|
+
status: string;
|
|
36
|
+
type: string;
|
|
37
|
+
planeId: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const SEAT_V1_PACKAGE_NAME = "seat.v1";
|
|
41
|
+
|
|
42
|
+
export interface SeatServiceClient {
|
|
43
|
+
getSeat(request: GetSeatRequest): Observable<GetSeatResponse>;
|
|
44
|
+
|
|
45
|
+
listSeatsByPlnae(request: ListSeatsRequest): Observable<ListSeatsResponse>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface SeatServiceController {
|
|
49
|
+
getSeat(request: GetSeatRequest): Promise<GetSeatResponse> | Observable<GetSeatResponse> | GetSeatResponse;
|
|
50
|
+
|
|
51
|
+
listSeatsByPlnae(
|
|
52
|
+
request: ListSeatsRequest,
|
|
53
|
+
): Promise<ListSeatsResponse> | Observable<ListSeatsResponse> | ListSeatsResponse;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function SeatServiceControllerMethods() {
|
|
57
|
+
return function (constructor: Function) {
|
|
58
|
+
const grpcMethods: string[] = ["getSeat", "listSeatsByPlnae"];
|
|
59
|
+
for (const method of grpcMethods) {
|
|
60
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
61
|
+
GrpcMethod("SeatService", method)(constructor.prototype[method], method, descriptor);
|
|
62
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
63
|
+
}
|
|
64
|
+
const grpcStreamMethods: string[] = [];
|
|
65
|
+
for (const method of grpcStreamMethods) {
|
|
66
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
67
|
+
GrpcStreamMethod("SeatService", method)(constructor.prototype[method], method, descriptor);
|
|
68
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const SEAT_SERVICE_NAME = "SeatService";
|
package/package.json
CHANGED
package/proto/airport.proto
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package plane.v1;
|
|
4
|
+
|
|
5
|
+
service PlaneService {
|
|
6
|
+
rpc CreatePlane (CreatePlaneRequest) returns (CreatePlaneResponse);
|
|
7
|
+
|
|
8
|
+
rpc GetPlane (GetPlaneRequest) returns (GetPlaneResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message CreatePlaneRequest {
|
|
12
|
+
string name = 1;
|
|
13
|
+
string airport_id = 2;
|
|
14
|
+
repeated RowLayout layout = 3;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
message CreatePlaneResponse {
|
|
18
|
+
Plane plane = 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message GetPlaneRequest {
|
|
22
|
+
string id = 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message GetPlaneResponse {
|
|
26
|
+
Plane plane = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message Plane {
|
|
30
|
+
string id = 1;
|
|
31
|
+
string name = 2;
|
|
32
|
+
string airport_id = 3;
|
|
33
|
+
repeated RowLayout layout = 4;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message RowLayout {
|
|
37
|
+
int32 row = 1;
|
|
38
|
+
int32 columns = 2;
|
|
39
|
+
string class = 3;
|
|
40
|
+
int32 price = 4;
|
|
41
|
+
}
|
package/proto/seat.proto
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package seat.v1;
|
|
4
|
+
|
|
5
|
+
service SeatService {
|
|
6
|
+
rpc GetSeat (GetSeatRequest) returns (GetSeatResponse);
|
|
7
|
+
rpc ListSeatsByPlnae (ListSeatsRequest) returns (ListSeatsResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message GetSeatRequest {
|
|
11
|
+
string id = 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message GetSeatResponse {
|
|
15
|
+
Seat seat = 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message ListSeatsRequest {
|
|
19
|
+
string plane_id = 1;
|
|
20
|
+
string flight_id = 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message ListSeatsResponse {
|
|
24
|
+
repeated Seat seat = 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message Seat {
|
|
28
|
+
string id = 1;
|
|
29
|
+
int32 row = 2;
|
|
30
|
+
int32 number = 3;
|
|
31
|
+
int32 price = 4;
|
|
32
|
+
string status = 5;
|
|
33
|
+
string type = 6;
|
|
34
|
+
string plane_id = 7;
|
|
35
|
+
}
|