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