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

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.
@@ -6,4 +6,5 @@ export declare const PROTO_PATHS: {
6
6
  readonly CATEGORY: string;
7
7
  readonly MENU: string;
8
8
  readonly MEDIA: string;
9
+ readonly CART: string;
9
10
  };
@@ -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
+ id: string;
32
+ productId: string;
33
+ title: string;
34
+ imageUrl: string;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-skytree/leaf-eats-contracts",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/",
@@ -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 id = 1;
29
+ string product_id = 2;
30
+ string title = 3;
31
+ string image_url = 4;
32
+ }