@sakura-skytree/leaf-eats-contracts 1.1.9 → 1.2.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/gen/restaurant.ts +53 -1
- package/package.json +1 -1
- package/proto/restaurant.proto +33 -0
package/gen/restaurant.ts
CHANGED
|
@@ -42,6 +42,26 @@ export interface GetRestaurantCategoriesResponse {
|
|
|
42
42
|
categories: Category[];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export interface CreateMenuItemRequest {
|
|
46
|
+
title: string;
|
|
47
|
+
imageUrl: string;
|
|
48
|
+
price: number;
|
|
49
|
+
description: string;
|
|
50
|
+
categoryId: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface CreateMenuItemResponse {
|
|
54
|
+
product: Product | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface GetMenuItemsRequest {
|
|
58
|
+
restaurantId: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface GetMenuItemsResponse {
|
|
62
|
+
items: CategoryItems[];
|
|
63
|
+
}
|
|
64
|
+
|
|
45
65
|
export interface Restaurant {
|
|
46
66
|
id: string;
|
|
47
67
|
name: string;
|
|
@@ -54,6 +74,19 @@ export interface Category {
|
|
|
54
74
|
title: string;
|
|
55
75
|
}
|
|
56
76
|
|
|
77
|
+
export interface Product {
|
|
78
|
+
id: string;
|
|
79
|
+
title: string;
|
|
80
|
+
imageUrl: string;
|
|
81
|
+
price: number;
|
|
82
|
+
description: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface CategoryItems {
|
|
86
|
+
category: Category | undefined;
|
|
87
|
+
products: Product[];
|
|
88
|
+
}
|
|
89
|
+
|
|
57
90
|
export const RESTAURANT_V1_PACKAGE_NAME = "restaurant.v1";
|
|
58
91
|
|
|
59
92
|
export interface RestaurantServiceClient {
|
|
@@ -64,6 +97,10 @@ export interface RestaurantServiceClient {
|
|
|
64
97
|
createCategory(request: CreateCategoryRequest): Observable<CreateCategoryResponse>;
|
|
65
98
|
|
|
66
99
|
getRestaurantCategories(request: GetRestaurantCategoriesRequest): Observable<GetRestaurantCategoriesResponse>;
|
|
100
|
+
|
|
101
|
+
createMenuItem(request: CreateMenuItemRequest): Observable<CreateMenuItemResponse>;
|
|
102
|
+
|
|
103
|
+
getMenuItems(request: GetMenuItemsRequest): Observable<GetMenuItemsResponse>;
|
|
67
104
|
}
|
|
68
105
|
|
|
69
106
|
export interface RestaurantServiceController {
|
|
@@ -85,11 +122,26 @@ export interface RestaurantServiceController {
|
|
|
85
122
|
| Promise<GetRestaurantCategoriesResponse>
|
|
86
123
|
| Observable<GetRestaurantCategoriesResponse>
|
|
87
124
|
| GetRestaurantCategoriesResponse;
|
|
125
|
+
|
|
126
|
+
createMenuItem(
|
|
127
|
+
request: CreateMenuItemRequest,
|
|
128
|
+
): Promise<CreateMenuItemResponse> | Observable<CreateMenuItemResponse> | CreateMenuItemResponse;
|
|
129
|
+
|
|
130
|
+
getMenuItems(
|
|
131
|
+
request: GetMenuItemsRequest,
|
|
132
|
+
): Promise<GetMenuItemsResponse> | Observable<GetMenuItemsResponse> | GetMenuItemsResponse;
|
|
88
133
|
}
|
|
89
134
|
|
|
90
135
|
export function RestaurantServiceControllerMethods() {
|
|
91
136
|
return function (constructor: Function) {
|
|
92
|
-
const grpcMethods: string[] = [
|
|
137
|
+
const grpcMethods: string[] = [
|
|
138
|
+
"getRestaurants",
|
|
139
|
+
"createRestaurant",
|
|
140
|
+
"createCategory",
|
|
141
|
+
"getRestaurantCategories",
|
|
142
|
+
"createMenuItem",
|
|
143
|
+
"getMenuItems",
|
|
144
|
+
];
|
|
93
145
|
for (const method of grpcMethods) {
|
|
94
146
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
95
147
|
GrpcMethod("RestaurantService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
package/proto/restaurant.proto
CHANGED
|
@@ -10,6 +10,9 @@ service RestaurantService {
|
|
|
10
10
|
|
|
11
11
|
rpc CreateCategory(CreateCategoryRequest) returns(CreateCategoryResponse);
|
|
12
12
|
rpc GetRestaurantCategories(GetRestaurantCategoriesRequest) returns(GetRestaurantCategoriesResponse);
|
|
13
|
+
|
|
14
|
+
rpc CreateMenuItem(CreateMenuItemRequest) returns(CreateMenuItemResponse);
|
|
15
|
+
rpc GetMenuItems(GetMenuItemsRequest) returns(GetMenuItemsResponse);
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
message GetRestaurantsResponse {
|
|
@@ -43,6 +46,23 @@ message GetRestaurantCategoriesResponse {
|
|
|
43
46
|
repeated Category categories = 1;
|
|
44
47
|
}
|
|
45
48
|
|
|
49
|
+
message CreateMenuItemRequest {
|
|
50
|
+
string title = 1;
|
|
51
|
+
string imageUrl = 2;
|
|
52
|
+
float price = 3;
|
|
53
|
+
string description = 4;
|
|
54
|
+
string category_id = 5;
|
|
55
|
+
}
|
|
56
|
+
message CreateMenuItemResponse {
|
|
57
|
+
Product product = 1;
|
|
58
|
+
}
|
|
59
|
+
message GetMenuItemsRequest {
|
|
60
|
+
string restaurant_id = 1;
|
|
61
|
+
}
|
|
62
|
+
message GetMenuItemsResponse {
|
|
63
|
+
repeated CategoryItems items = 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
message Restaurant {
|
|
47
67
|
string id = 1;
|
|
48
68
|
string name = 2;
|
|
@@ -53,4 +73,17 @@ message Restaurant {
|
|
|
53
73
|
message Category {
|
|
54
74
|
string id = 1;
|
|
55
75
|
string title = 2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message Product {
|
|
79
|
+
string id = 1;
|
|
80
|
+
string title = 2;
|
|
81
|
+
string imageUrl = 3;
|
|
82
|
+
float price = 4;
|
|
83
|
+
string description = 5;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
message CategoryItems {
|
|
87
|
+
Category category = 1;
|
|
88
|
+
repeated Product products = 2;
|
|
56
89
|
}
|