@nemma-training/contracts 1.1.10 → 1.2.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.
@@ -4,4 +4,5 @@ export declare const PROTO_PATHS: {
4
4
  readonly USERS: string;
5
5
  readonly MOVIE: string;
6
6
  readonly CATEGORY: string;
7
+ readonly THEATER: string;
7
8
  };
@@ -8,4 +8,5 @@ exports.PROTO_PATHS = {
8
8
  USERS: (0, node_path_1.join)(__dirname, '../../proto/users.proto'),
9
9
  MOVIE: (0, node_path_1.join)(__dirname, '../../proto/movie.proto'),
10
10
  CATEGORY: (0, node_path_1.join)(__dirname, '../../proto/category.proto'),
11
+ THEATER: (0, node_path_1.join)(__dirname, '../../proto/theater.proto'),
11
12
  };
package/gen/ts/movie.ts CHANGED
@@ -35,7 +35,7 @@ export interface Movie {
35
35
  title: string;
36
36
  slug: string;
37
37
  poster: string;
38
- ratingAge: string;
38
+ ratingAge: number;
39
39
  releaseDate: Timestamp | undefined;
40
40
  }
41
41
 
@@ -47,7 +47,7 @@ export interface MovieDetails {
47
47
  poster: string;
48
48
  banner: string;
49
49
  duration: number;
50
- ratingAge: string;
50
+ ratingAge: number;
51
51
  country: string;
52
52
  releaseDate: Timestamp | undefined;
53
53
  }
@@ -0,0 +1,78 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.1
4
+ // protoc v3.21.12
5
+ // source: theater.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
11
+
12
+ export const protobufPackage = "theater.v1";
13
+
14
+ export interface ListTheatersResponse {
15
+ theaters: Theater[];
16
+ }
17
+
18
+ export interface GetTheaterRequest {
19
+ id: string;
20
+ }
21
+
22
+ export interface GetTheaterResponse {
23
+ theater: Theater | undefined;
24
+ }
25
+
26
+ export interface CreateTheaterRequest {
27
+ name: string;
28
+ address: string;
29
+ }
30
+
31
+ export interface CreateTheaterResponse {
32
+ ok: boolean;
33
+ }
34
+
35
+ export interface Theater {
36
+ id: string;
37
+ name: string;
38
+ address: string;
39
+ }
40
+
41
+ export const THEATER_V1_PACKAGE_NAME = "theater.v1";
42
+
43
+ export interface TheaterServiceClient {
44
+ listTheaters(request: Empty): Observable<ListTheatersResponse>;
45
+
46
+ getTheater(request: GetTheaterRequest): Observable<GetTheaterResponse>;
47
+
48
+ createTheater(request: CreateTheaterRequest): Observable<CreateTheaterResponse>;
49
+ }
50
+
51
+ export interface TheaterServiceController {
52
+ listTheaters(request: Empty): Promise<ListTheatersResponse> | Observable<ListTheatersResponse> | ListTheatersResponse;
53
+
54
+ getTheater(
55
+ request: GetTheaterRequest,
56
+ ): Promise<GetTheaterResponse> | Observable<GetTheaterResponse> | GetTheaterResponse;
57
+
58
+ createTheater(
59
+ request: CreateTheaterRequest,
60
+ ): Promise<CreateTheaterResponse> | Observable<CreateTheaterResponse> | CreateTheaterResponse;
61
+ }
62
+
63
+ export function TheaterServiceControllerMethods() {
64
+ return function (constructor: Function) {
65
+ const grpcMethods: string[] = ["listTheaters", "getTheater", "createTheater"];
66
+ for (const method of grpcMethods) {
67
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
68
+ GrpcMethod("TheaterService", 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("TheaterService", method)(constructor.prototype[method], method, descriptor);
74
+ }
75
+ };
76
+ }
77
+
78
+ export const THEATER_SERVICE_NAME = "TheaterService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nemma-training/contracts",
3
- "version": "1.1.10",
3
+ "version": "1.2.0",
4
4
  "description": "Protobuf contract ts and go definitions for Nemma microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/proto/movie.proto CHANGED
@@ -35,7 +35,7 @@ message Movie {
35
35
  string title = 2;
36
36
  string slug = 3;
37
37
  string poster = 4;
38
- string rating_age = 5;
38
+ int32 rating_age = 5;
39
39
  google.protobuf.Timestamp release_date = 6;
40
40
  }
41
41
 
@@ -47,7 +47,7 @@ message MovieDetails {
47
47
  string poster = 5;
48
48
  string banner = 6;
49
49
  int32 duration = 7;
50
- string rating_age= 8;
50
+ int32 rating_age= 8;
51
51
  string country = 9;
52
52
  google.protobuf.Timestamp release_date = 10;
53
53
  }
@@ -0,0 +1,39 @@
1
+ syntax = "proto3";
2
+
3
+ package theater.v1;
4
+
5
+ import "google/protobuf/empty.proto";
6
+
7
+ service TheaterService {
8
+ rpc ListTheaters (google.protobuf.Empty) returns (ListTheatersResponse);
9
+ rpc GetTheater (GetTheaterRequest) returns (GetTheaterResponse);
10
+
11
+ rpc CreateTheater (CreateTheaterRequest) returns (CreateTheaterResponse);
12
+ }
13
+
14
+ message ListTheatersResponse {
15
+ repeated Theater theaters = 1;
16
+ }
17
+
18
+ message GetTheaterRequest {
19
+ string id = 1;
20
+ }
21
+
22
+ message GetTheaterResponse {
23
+ Theater theater = 1;
24
+ }
25
+
26
+ message CreateTheaterRequest {
27
+ string name = 1;
28
+ string address = 2;
29
+ }
30
+
31
+ message CreateTheaterResponse {
32
+ bool ok = 1;
33
+ }
34
+
35
+ message Theater {
36
+ string id = 1;
37
+ string name = 2;
38
+ string address = 3;
39
+ }