@sakura-skytree/leaf-eats-contracts 1.2.3 → 1.2.5

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.
@@ -3,4 +3,7 @@ export declare const PROTO_PATHS: {
3
3
  readonly SESSION: string;
4
4
  readonly PROFILE: string;
5
5
  readonly RESTAURANT: string;
6
+ readonly CATEGORY: string;
7
+ readonly MENU: string;
8
+ readonly MEDIA: string;
6
9
  };
@@ -6,5 +6,8 @@ exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
7
  SESSION: (0, path_1.join)(__dirname, '../../proto/session.proto'),
8
8
  PROFILE: (0, path_1.join)(__dirname, '../../proto/profile.proto'),
9
- RESTAURANT: (0, path_1.join)(__dirname, '../../proto/restaurant.proto')
9
+ RESTAURANT: (0, path_1.join)(__dirname, '../../proto/restaurant.proto'),
10
+ CATEGORY: (0, path_1.join)(__dirname, '../../proto/category.proto'),
11
+ MENU: (0, path_1.join)(__dirname, '../../proto/menu.proto'),
12
+ MEDIA: (0, path_1.join)(__dirname, '../../proto/media.proto'),
10
13
  };
@@ -0,0 +1,85 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v7.35.1
5
+ // source: category.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "category.v1";
12
+
13
+ export interface CreateCategoryRequest {
14
+ restaurantId: string;
15
+ title: string;
16
+ }
17
+
18
+ export interface CreateCategoryResponse {
19
+ category: Category | undefined;
20
+ }
21
+
22
+ export interface GetRestaurantCategoriesRequest {
23
+ restaurantId: string;
24
+ }
25
+
26
+ export interface GetRestaurantCategoriesResponse {
27
+ categories: Category[];
28
+ }
29
+
30
+ export interface DeleteCategoryRequest {
31
+ id: string;
32
+ }
33
+
34
+ export interface DeleteCategoryResponse {
35
+ ok: boolean;
36
+ }
37
+
38
+ export interface Category {
39
+ id: string;
40
+ title: string;
41
+ }
42
+
43
+ export const CATEGORY_V1_PACKAGE_NAME = "category.v1";
44
+
45
+ export interface CategoryServiceClient {
46
+ createCategory(request: CreateCategoryRequest): Observable<CreateCategoryResponse>;
47
+
48
+ getRestaurantCategories(request: GetRestaurantCategoriesRequest): Observable<GetRestaurantCategoriesResponse>;
49
+
50
+ deleteCategory(request: DeleteCategoryRequest): Observable<DeleteCategoryResponse>;
51
+ }
52
+
53
+ export interface CategoryServiceController {
54
+ createCategory(
55
+ request: CreateCategoryRequest,
56
+ ): Promise<CreateCategoryResponse> | Observable<CreateCategoryResponse> | CreateCategoryResponse;
57
+
58
+ getRestaurantCategories(
59
+ request: GetRestaurantCategoriesRequest,
60
+ ):
61
+ | Promise<GetRestaurantCategoriesResponse>
62
+ | Observable<GetRestaurantCategoriesResponse>
63
+ | GetRestaurantCategoriesResponse;
64
+
65
+ deleteCategory(
66
+ request: DeleteCategoryRequest,
67
+ ): Promise<DeleteCategoryResponse> | Observable<DeleteCategoryResponse> | DeleteCategoryResponse;
68
+ }
69
+
70
+ export function CategoryServiceControllerMethods() {
71
+ return function (constructor: Function) {
72
+ const grpcMethods: string[] = ["createCategory", "getRestaurantCategories", "deleteCategory"];
73
+ for (const method of grpcMethods) {
74
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
75
+ GrpcMethod("CategoryService", method)(constructor.prototype[method], method, descriptor);
76
+ }
77
+ const grpcStreamMethods: string[] = [];
78
+ for (const method of grpcStreamMethods) {
79
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
80
+ GrpcStreamMethod("CategoryService", method)(constructor.prototype[method], method, descriptor);
81
+ }
82
+ };
83
+ }
84
+
85
+ export const CATEGORY_SERVICE_NAME = "CategoryService";
package/gen/media.ts ADDED
@@ -0,0 +1,76 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v7.35.1
5
+ // source: media.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "media.v1";
12
+
13
+ export interface UploadRequest {
14
+ fileName: string;
15
+ contentType: string;
16
+ folder: string;
17
+ data: Uint8Array;
18
+ width: number;
19
+ height: number;
20
+ }
21
+
22
+ export interface UploadResponse {
23
+ fileName: string;
24
+ }
25
+
26
+ export interface RemoveRequest {
27
+ fileName: string;
28
+ }
29
+
30
+ export interface RemoveResponse {
31
+ ok: boolean;
32
+ }
33
+
34
+ export interface GetRequest {
35
+ fileName: string;
36
+ }
37
+
38
+ export interface GetResponse {
39
+ data: Uint8Array;
40
+ contentType: string;
41
+ }
42
+
43
+ export const MEDIA_V1_PACKAGE_NAME = "media.v1";
44
+
45
+ export interface MediaServiceClient {
46
+ upload(request: UploadRequest): Observable<UploadResponse>;
47
+
48
+ remove(request: RemoveRequest): Observable<RemoveResponse>;
49
+
50
+ get(request: GetRequest): Observable<GetResponse>;
51
+ }
52
+
53
+ export interface MediaServiceController {
54
+ upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
55
+
56
+ remove(request: RemoveRequest): Promise<RemoveResponse> | Observable<RemoveResponse> | RemoveResponse;
57
+
58
+ get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
59
+ }
60
+
61
+ export function MediaServiceControllerMethods() {
62
+ return function (constructor: Function) {
63
+ const grpcMethods: string[] = ["upload", "remove", "get"];
64
+ for (const method of grpcMethods) {
65
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
66
+ GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
67
+ }
68
+ const grpcStreamMethods: string[] = [];
69
+ for (const method of grpcStreamMethods) {
70
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
71
+ GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
72
+ }
73
+ };
74
+ }
75
+
76
+ export const MEDIA_SERVICE_NAME = "MediaService";
package/gen/menu.ts ADDED
@@ -0,0 +1,94 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v7.35.1
5
+ // source: menu.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "menu.v1";
12
+
13
+ export interface CreateMenuItemRequest {
14
+ title: string;
15
+ imageUrl: string;
16
+ price: number;
17
+ description: string;
18
+ categoryId: string;
19
+ }
20
+
21
+ export interface CreateMenuItemResponse {
22
+ product: Product | undefined;
23
+ }
24
+
25
+ export interface GetMenuItemsRequest {
26
+ restaurantId: string;
27
+ }
28
+
29
+ export interface GetMenuItemsResponse {
30
+ items: CategoryItems[];
31
+ }
32
+
33
+ export interface DeleteMenuItemRequest {
34
+ id: string;
35
+ }
36
+
37
+ export interface DeleteMenuItemResponse {
38
+ ok: boolean;
39
+ }
40
+
41
+ export interface Product {
42
+ id: string;
43
+ title: string;
44
+ imageUrl: string;
45
+ price: number;
46
+ description: string;
47
+ }
48
+
49
+ export interface CategoryItems {
50
+ id: string;
51
+ title: string;
52
+ products: Product[];
53
+ }
54
+
55
+ export const MENU_V1_PACKAGE_NAME = "menu.v1";
56
+
57
+ export interface MenuServiceClient {
58
+ createMenuItem(request: CreateMenuItemRequest): Observable<CreateMenuItemResponse>;
59
+
60
+ getMenuItems(request: GetMenuItemsRequest): Observable<GetMenuItemsResponse>;
61
+
62
+ deleteMenuItem(request: DeleteMenuItemRequest): Observable<DeleteMenuItemResponse>;
63
+ }
64
+
65
+ export interface MenuServiceController {
66
+ createMenuItem(
67
+ request: CreateMenuItemRequest,
68
+ ): Promise<CreateMenuItemResponse> | Observable<CreateMenuItemResponse> | CreateMenuItemResponse;
69
+
70
+ getMenuItems(
71
+ request: GetMenuItemsRequest,
72
+ ): Promise<GetMenuItemsResponse> | Observable<GetMenuItemsResponse> | GetMenuItemsResponse;
73
+
74
+ deleteMenuItem(
75
+ request: DeleteMenuItemRequest,
76
+ ): Promise<DeleteMenuItemResponse> | Observable<DeleteMenuItemResponse> | DeleteMenuItemResponse;
77
+ }
78
+
79
+ export function MenuServiceControllerMethods() {
80
+ return function (constructor: Function) {
81
+ const grpcMethods: string[] = ["createMenuItem", "getMenuItems", "deleteMenuItem"];
82
+ for (const method of grpcMethods) {
83
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
84
+ GrpcMethod("MenuService", method)(constructor.prototype[method], method, descriptor);
85
+ }
86
+ const grpcStreamMethods: string[] = [];
87
+ for (const method of grpcStreamMethods) {
88
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
89
+ GrpcStreamMethod("MenuService", method)(constructor.prototype[method], method, descriptor);
90
+ }
91
+ };
92
+ }
93
+
94
+ export const MENU_SERVICE_NAME = "MenuService";
package/gen/restaurant.ts CHANGED
@@ -25,59 +25,6 @@ export interface CreateRestaurantResponse {
25
25
  restaurant: Restaurant | undefined;
26
26
  }
27
27
 
28
- export interface CreateCategoryRequest {
29
- restaurantId: string;
30
- title: string;
31
- }
32
-
33
- export interface CreateCategoryResponse {
34
- category: Category | undefined;
35
- }
36
-
37
- export interface GetRestaurantCategoriesRequest {
38
- restaurantId: string;
39
- }
40
-
41
- export interface GetRestaurantCategoriesResponse {
42
- categories: Category[];
43
- }
44
-
45
- export interface DeleteCategoryRequest {
46
- id: string;
47
- }
48
-
49
- export interface DeleteCategoryResponse {
50
- ok: boolean;
51
- }
52
-
53
- export interface CreateMenuItemRequest {
54
- title: string;
55
- imageUrl: string;
56
- price: number;
57
- description: string;
58
- categoryId: string;
59
- }
60
-
61
- export interface CreateMenuItemResponse {
62
- product: Product | undefined;
63
- }
64
-
65
- export interface GetMenuItemsRequest {
66
- restaurantId: string;
67
- }
68
-
69
- export interface GetMenuItemsResponse {
70
- items: CategoryItems[];
71
- }
72
-
73
- export interface DeleteMenuItemRequest {
74
- id: string;
75
- }
76
-
77
- export interface DeleteMenuItemResponse {
78
- ok: boolean;
79
- }
80
-
81
28
  export interface Restaurant {
82
29
  id: string;
83
30
  name: string;
@@ -85,43 +32,12 @@ export interface Restaurant {
85
32
  address: string;
86
33
  }
87
34
 
88
- export interface Category {
89
- id: string;
90
- title: string;
91
- }
92
-
93
- export interface Product {
94
- id: string;
95
- title: string;
96
- imageUrl: string;
97
- price: number;
98
- description: string;
99
- }
100
-
101
- export interface CategoryItems {
102
- id: string;
103
- title: string;
104
- products: Product[];
105
- }
106
-
107
35
  export const RESTAURANT_V1_PACKAGE_NAME = "restaurant.v1";
108
36
 
109
37
  export interface RestaurantServiceClient {
110
38
  getRestaurants(request: Empty): Observable<GetRestaurantsResponse>;
111
39
 
112
40
  createRestaurant(request: CreateRestaurantRequest): Observable<CreateRestaurantResponse>;
113
-
114
- createCategory(request: CreateCategoryRequest): Observable<CreateCategoryResponse>;
115
-
116
- getRestaurantCategories(request: GetRestaurantCategoriesRequest): Observable<GetRestaurantCategoriesResponse>;
117
-
118
- deleteCategory(request: DeleteCategoryRequest): Observable<DeleteCategoryResponse>;
119
-
120
- createMenuItem(request: CreateMenuItemRequest): Observable<CreateMenuItemResponse>;
121
-
122
- getMenuItems(request: GetMenuItemsRequest): Observable<GetMenuItemsResponse>;
123
-
124
- deleteMenuItem(request: DeleteMenuItemRequest): Observable<DeleteMenuItemResponse>;
125
41
  }
126
42
 
127
43
  export interface RestaurantServiceController {
@@ -132,47 +48,11 @@ export interface RestaurantServiceController {
132
48
  createRestaurant(
133
49
  request: CreateRestaurantRequest,
134
50
  ): Promise<CreateRestaurantResponse> | Observable<CreateRestaurantResponse> | CreateRestaurantResponse;
135
-
136
- createCategory(
137
- request: CreateCategoryRequest,
138
- ): Promise<CreateCategoryResponse> | Observable<CreateCategoryResponse> | CreateCategoryResponse;
139
-
140
- getRestaurantCategories(
141
- request: GetRestaurantCategoriesRequest,
142
- ):
143
- | Promise<GetRestaurantCategoriesResponse>
144
- | Observable<GetRestaurantCategoriesResponse>
145
- | GetRestaurantCategoriesResponse;
146
-
147
- deleteCategory(
148
- request: DeleteCategoryRequest,
149
- ): Promise<DeleteCategoryResponse> | Observable<DeleteCategoryResponse> | DeleteCategoryResponse;
150
-
151
- createMenuItem(
152
- request: CreateMenuItemRequest,
153
- ): Promise<CreateMenuItemResponse> | Observable<CreateMenuItemResponse> | CreateMenuItemResponse;
154
-
155
- getMenuItems(
156
- request: GetMenuItemsRequest,
157
- ): Promise<GetMenuItemsResponse> | Observable<GetMenuItemsResponse> | GetMenuItemsResponse;
158
-
159
- deleteMenuItem(
160
- request: DeleteMenuItemRequest,
161
- ): Promise<DeleteMenuItemResponse> | Observable<DeleteMenuItemResponse> | DeleteMenuItemResponse;
162
51
  }
163
52
 
164
53
  export function RestaurantServiceControllerMethods() {
165
54
  return function (constructor: Function) {
166
- const grpcMethods: string[] = [
167
- "getRestaurants",
168
- "createRestaurant",
169
- "createCategory",
170
- "getRestaurantCategories",
171
- "deleteCategory",
172
- "createMenuItem",
173
- "getMenuItems",
174
- "deleteMenuItem",
175
- ];
55
+ const grpcMethods: string[] = ["getRestaurants", "createRestaurant"];
176
56
  for (const method of grpcMethods) {
177
57
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
178
58
  GrpcMethod("RestaurantService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-skytree/leaf-eats-contracts",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/",
@@ -0,0 +1,39 @@
1
+ syntax = "proto3";
2
+
3
+ package category.v1;
4
+
5
+ service CategoryService {
6
+ rpc CreateCategory(CreateCategoryRequest) returns(CreateCategoryResponse);
7
+ rpc GetRestaurantCategories(GetRestaurantCategoriesRequest) returns(GetRestaurantCategoriesResponse);
8
+ rpc DeleteCategory(DeleteCategoryRequest) returns(DeleteCategoryResponse);
9
+ }
10
+
11
+ message CreateCategoryRequest {
12
+ string restaurant_id = 1;
13
+ string title = 2;
14
+ }
15
+
16
+ message CreateCategoryResponse {
17
+ Category category = 1;
18
+ }
19
+
20
+ message GetRestaurantCategoriesRequest {
21
+ string restaurant_id = 1;
22
+ }
23
+
24
+ message GetRestaurantCategoriesResponse {
25
+ repeated Category categories = 1;
26
+ }
27
+
28
+ message DeleteCategoryRequest {
29
+ string id = 1;
30
+ }
31
+
32
+ message DeleteCategoryResponse {
33
+ bool ok = 1;
34
+ }
35
+
36
+ message Category {
37
+ string id = 1;
38
+ string title = 2;
39
+ }
@@ -0,0 +1,41 @@
1
+ syntax = "proto3";
2
+
3
+ package media.v1;
4
+
5
+ option java_multiple_files = true;
6
+
7
+ service MediaService {
8
+ rpc Upload(UploadRequest) returns(UploadResponse);
9
+ rpc Remove(RemoveRequest) returns(RemoveResponse);
10
+ rpc Get(GetRequest) returns(GetResponse);
11
+ }
12
+
13
+ message UploadRequest {
14
+ string file_name = 1;
15
+ string content_type = 2;
16
+ string folder = 3;
17
+ bytes data = 4;
18
+ int32 width = 5;
19
+ int32 height = 6;
20
+ }
21
+
22
+ message UploadResponse {
23
+ string file_name = 1;
24
+ }
25
+
26
+ message RemoveRequest {
27
+ string file_name = 1;
28
+ }
29
+
30
+ message RemoveResponse {
31
+ bool ok = 1;
32
+ }
33
+
34
+ message GetRequest {
35
+ string file_name = 1;
36
+ }
37
+
38
+ message GetResponse {
39
+ bytes data = 1;
40
+ string content_type = 2;
41
+ }
@@ -0,0 +1,51 @@
1
+ syntax = "proto3";
2
+
3
+ package menu.v1;
4
+
5
+ service MenuService {
6
+ rpc CreateMenuItem(CreateMenuItemRequest) returns(CreateMenuItemResponse);
7
+ rpc GetMenuItems(GetMenuItemsRequest) returns(GetMenuItemsResponse);
8
+ rpc DeleteMenuItem(DeleteMenuItemRequest) returns(DeleteMenuItemResponse);
9
+ }
10
+
11
+ message CreateMenuItemRequest {
12
+ string title = 1;
13
+ string imageUrl = 2;
14
+ float price = 3;
15
+ string description = 4;
16
+ string category_id = 5;
17
+ }
18
+
19
+ message CreateMenuItemResponse {
20
+ Product product = 1;
21
+ }
22
+
23
+ message GetMenuItemsRequest {
24
+ string restaurant_id = 1;
25
+ }
26
+
27
+ message GetMenuItemsResponse {
28
+ repeated CategoryItems items = 1;
29
+ }
30
+
31
+ message DeleteMenuItemRequest {
32
+ string id = 1;
33
+ }
34
+
35
+ message DeleteMenuItemResponse {
36
+ bool ok = 1;
37
+ }
38
+
39
+ message Product {
40
+ string id = 1;
41
+ string title = 2;
42
+ string imageUrl = 3;
43
+ float price = 4;
44
+ string description = 5;
45
+ }
46
+
47
+ message CategoryItems {
48
+ string id = 1;
49
+ string title = 2;
50
+ repeated Product products = 3;
51
+ }
@@ -7,14 +7,6 @@ import "google/protobuf/empty.proto";
7
7
  service RestaurantService {
8
8
  rpc GetRestaurants(google.protobuf.Empty) returns(GetRestaurantsResponse);
9
9
  rpc CreateRestaurant(CreateRestaurantRequest) returns(CreateRestaurantResponse);
10
-
11
- rpc CreateCategory(CreateCategoryRequest) returns(CreateCategoryResponse);
12
- rpc GetRestaurantCategories(GetRestaurantCategoriesRequest) returns(GetRestaurantCategoriesResponse);
13
- rpc DeleteCategory(DeleteCategoryRequest) returns(DeleteCategoryResponse);
14
-
15
- rpc CreateMenuItem(CreateMenuItemRequest) returns(CreateMenuItemResponse);
16
- rpc GetMenuItems(GetMenuItemsRequest) returns(GetMenuItemsResponse);
17
- rpc DeleteMenuItem(DeleteMenuItemRequest) returns(DeleteMenuItemResponse);
18
10
  }
19
11
 
20
12
  message GetRestaurantsResponse {
@@ -31,76 +23,9 @@ message CreateRestaurantResponse {
31
23
  Restaurant restaurant = 1;
32
24
  }
33
25
 
34
- message CreateCategoryRequest {
35
- string restaurant_id = 1;
36
- string title = 2;
37
- }
38
-
39
- message CreateCategoryResponse {
40
- Category category = 1;
41
- }
42
-
43
- message GetRestaurantCategoriesRequest {
44
- string restaurant_id = 1;
45
- }
46
-
47
- message GetRestaurantCategoriesResponse {
48
- repeated Category categories = 1;
49
- }
50
-
51
- message DeleteCategoryRequest {
52
- string id = 1;
53
- }
54
- message DeleteCategoryResponse {
55
- bool ok = 1;
56
- }
57
-
58
- message CreateMenuItemRequest {
59
- string title = 1;
60
- string imageUrl = 2;
61
- float price = 3;
62
- string description = 4;
63
- string category_id = 5;
64
- }
65
- message CreateMenuItemResponse {
66
- Product product = 1;
67
- }
68
- message GetMenuItemsRequest {
69
- string restaurant_id = 1;
70
- }
71
- message GetMenuItemsResponse {
72
- repeated CategoryItems items = 1;
73
- }
74
-
75
- message DeleteMenuItemRequest {
76
- string id = 1;
77
- }
78
- message DeleteMenuItemResponse {
79
- bool ok = 1;
80
- }
81
-
82
26
  message Restaurant {
83
27
  string id = 1;
84
28
  string name = 2;
85
29
  string previewUrl = 3;
86
30
  string address = 4;
87
- }
88
-
89
- message Category {
90
- string id = 1;
91
- string title = 2;
92
- }
93
-
94
- message Product {
95
- string id = 1;
96
- string title = 2;
97
- string imageUrl = 3;
98
- float price = 4;
99
- string description = 5;
100
- }
101
-
102
- message CategoryItems {
103
- string id = 1;
104
- string title = 2;
105
- repeated Product products = 3;
106
31
  }