@sakura-skytree/leaf-eats-contracts 1.2.5 → 1.2.7
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 +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/cart.ts +66 -0
- package/gen/menu.ts +33 -1
- package/package.json +1 -1
- package/proto/cart.proto +32 -0
- package/proto/menu.proto +19 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -10,4 +10,5 @@ exports.PROTO_PATHS = {
|
|
|
10
10
|
CATEGORY: (0, path_1.join)(__dirname, '../../proto/category.proto'),
|
|
11
11
|
MENU: (0, path_1.join)(__dirname, '../../proto/menu.proto'),
|
|
12
12
|
MEDIA: (0, path_1.join)(__dirname, '../../proto/media.proto'),
|
|
13
|
+
CART: (0, path_1.join)(__dirname, '../../proto/cart.proto'),
|
|
13
14
|
};
|
package/gen/cart.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
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: cart.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "cart.v1";
|
|
12
|
+
|
|
13
|
+
export interface AddToCartRequest {
|
|
14
|
+
userId: string;
|
|
15
|
+
productId: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface AddToCartResponse {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface GetCartRequest {
|
|
23
|
+
userId: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GetCartResponse {
|
|
27
|
+
cartProducts: CartProduct[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CartProduct {
|
|
31
|
+
productId: string;
|
|
32
|
+
title: string;
|
|
33
|
+
imageUrl: string;
|
|
34
|
+
price: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const CART_V1_PACKAGE_NAME = "cart.v1";
|
|
38
|
+
|
|
39
|
+
export interface CartServiceClient {
|
|
40
|
+
addToCart(request: AddToCartRequest): Observable<AddToCartResponse>;
|
|
41
|
+
|
|
42
|
+
getCart(request: GetCartRequest): Observable<GetCartResponse>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CartServiceController {
|
|
46
|
+
addToCart(request: AddToCartRequest): Promise<AddToCartResponse> | Observable<AddToCartResponse> | AddToCartResponse;
|
|
47
|
+
|
|
48
|
+
getCart(request: GetCartRequest): Promise<GetCartResponse> | Observable<GetCartResponse> | GetCartResponse;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function CartServiceControllerMethods() {
|
|
52
|
+
return function (constructor: Function) {
|
|
53
|
+
const grpcMethods: string[] = ["addToCart", "getCart"];
|
|
54
|
+
for (const method of grpcMethods) {
|
|
55
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
56
|
+
GrpcMethod("CartService", method)(constructor.prototype[method], method, descriptor);
|
|
57
|
+
}
|
|
58
|
+
const grpcStreamMethods: string[] = [];
|
|
59
|
+
for (const method of grpcStreamMethods) {
|
|
60
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
61
|
+
GrpcStreamMethod("CartService", method)(constructor.prototype[method], method, descriptor);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const CART_SERVICE_NAME = "CartService";
|
package/gen/menu.ts
CHANGED
|
@@ -38,6 +38,20 @@ export interface DeleteMenuItemResponse {
|
|
|
38
38
|
ok: boolean;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export interface GetProductByIdRequest {
|
|
42
|
+
id: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface GetProductByIdResponse {
|
|
46
|
+
product: Product | undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface GetProductsByIdsRequest {
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface GetProductsByIdsResponse {
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
export interface Product {
|
|
42
56
|
id: string;
|
|
43
57
|
title: string;
|
|
@@ -60,6 +74,10 @@ export interface MenuServiceClient {
|
|
|
60
74
|
getMenuItems(request: GetMenuItemsRequest): Observable<GetMenuItemsResponse>;
|
|
61
75
|
|
|
62
76
|
deleteMenuItem(request: DeleteMenuItemRequest): Observable<DeleteMenuItemResponse>;
|
|
77
|
+
|
|
78
|
+
getProductById(request: GetProductByIdRequest): Observable<GetProductByIdResponse>;
|
|
79
|
+
|
|
80
|
+
getProductsByIds(request: GetProductsByIdsRequest): Observable<GetProductsByIdsResponse>;
|
|
63
81
|
}
|
|
64
82
|
|
|
65
83
|
export interface MenuServiceController {
|
|
@@ -74,11 +92,25 @@ export interface MenuServiceController {
|
|
|
74
92
|
deleteMenuItem(
|
|
75
93
|
request: DeleteMenuItemRequest,
|
|
76
94
|
): Promise<DeleteMenuItemResponse> | Observable<DeleteMenuItemResponse> | DeleteMenuItemResponse;
|
|
95
|
+
|
|
96
|
+
getProductById(
|
|
97
|
+
request: GetProductByIdRequest,
|
|
98
|
+
): Promise<GetProductByIdResponse> | Observable<GetProductByIdResponse> | GetProductByIdResponse;
|
|
99
|
+
|
|
100
|
+
getProductsByIds(
|
|
101
|
+
request: GetProductsByIdsRequest,
|
|
102
|
+
): Promise<GetProductsByIdsResponse> | Observable<GetProductsByIdsResponse> | GetProductsByIdsResponse;
|
|
77
103
|
}
|
|
78
104
|
|
|
79
105
|
export function MenuServiceControllerMethods() {
|
|
80
106
|
return function (constructor: Function) {
|
|
81
|
-
const grpcMethods: string[] = [
|
|
107
|
+
const grpcMethods: string[] = [
|
|
108
|
+
"createMenuItem",
|
|
109
|
+
"getMenuItems",
|
|
110
|
+
"deleteMenuItem",
|
|
111
|
+
"getProductById",
|
|
112
|
+
"getProductsByIds",
|
|
113
|
+
];
|
|
82
114
|
for (const method of grpcMethods) {
|
|
83
115
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
84
116
|
GrpcMethod("MenuService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
package/proto/cart.proto
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package cart.v1;
|
|
4
|
+
|
|
5
|
+
service CartService {
|
|
6
|
+
rpc AddToCart(AddToCartRequest) returns(AddToCartResponse);
|
|
7
|
+
rpc GetCart(GetCartRequest) returns(GetCartResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message AddToCartRequest {
|
|
11
|
+
string user_id = 1;
|
|
12
|
+
string product_id = 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message AddToCartResponse {
|
|
16
|
+
bool ok = 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message GetCartRequest {
|
|
20
|
+
string user_id = 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message GetCartResponse {
|
|
24
|
+
repeated CartProduct cart_products = 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message CartProduct {
|
|
28
|
+
string product_id = 1;
|
|
29
|
+
string title = 2;
|
|
30
|
+
string image_url = 3;
|
|
31
|
+
float price = 4;
|
|
32
|
+
}
|
package/proto/menu.proto
CHANGED
|
@@ -6,6 +6,9 @@ service MenuService {
|
|
|
6
6
|
rpc CreateMenuItem(CreateMenuItemRequest) returns(CreateMenuItemResponse);
|
|
7
7
|
rpc GetMenuItems(GetMenuItemsRequest) returns(GetMenuItemsResponse);
|
|
8
8
|
rpc DeleteMenuItem(DeleteMenuItemRequest) returns(DeleteMenuItemResponse);
|
|
9
|
+
|
|
10
|
+
rpc GetProductById(GetProductByIdRequest) returns(GetProductByIdResponse);
|
|
11
|
+
rpc GetProductsByIds(GetProductsByIdsRequest) returns(GetProductsByIdsResponse);
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
message CreateMenuItemRequest {
|
|
@@ -36,6 +39,22 @@ message DeleteMenuItemResponse {
|
|
|
36
39
|
bool ok = 1;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
message GetProductByIdRequest {
|
|
43
|
+
string id = 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message GetProductByIdResponse {
|
|
47
|
+
Product product = 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message GetProductsByIdsRequest {
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message GetProductsByIdsResponse {
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
39
58
|
message Product {
|
|
40
59
|
string id = 1;
|
|
41
60
|
string title = 2;
|