@mamindom/contracts 1.0.56 → 1.0.58

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.
@@ -9,6 +9,35 @@ export declare enum ProductStatus {
9
9
  PRODUCT_STATUS_ARCHIVED = 4,
10
10
  UNRECOGNIZED = -1
11
11
  }
12
+ export interface BulkStickerRequest {
13
+ productIds: string[];
14
+ stickerId: string;
15
+ }
16
+ export interface AssignSizeChartsToProductRequest {
17
+ productId: string;
18
+ sizeChartIds: string[];
19
+ }
20
+ export interface RemoveSizeChartFromProductRequest {
21
+ productId: string;
22
+ sizeChartId: string;
23
+ }
24
+ export interface GetProductSizeChartsRequest {
25
+ productId: string;
26
+ }
27
+ export interface ProductSizeChartResponse {
28
+ id: string;
29
+ name: {
30
+ [key: string]: string;
31
+ };
32
+ content: string;
33
+ }
34
+ export interface ProductSizeChartResponse_NameEntry {
35
+ key: string;
36
+ value: string;
37
+ }
38
+ export interface GetProductSizeChartsResponse {
39
+ items: ProductSizeChartResponse[];
40
+ }
12
41
  export interface ProductOrderItem {
13
42
  productId: string;
14
43
  sortOrder: number;
@@ -41,6 +70,7 @@ export interface ProductListItemResponse {
41
70
  categoryIds: string[];
42
71
  sortOrder: number;
43
72
  categorySortOrder: number;
73
+ barcode?: string | undefined;
44
74
  }
45
75
  export interface ProductListItemResponse_NameEntry {
46
76
  key: string;
@@ -90,6 +120,8 @@ export interface ProductDetailResponse {
90
120
  files: ProductFileResponse[];
91
121
  mainImageId?: string | undefined;
92
122
  stickers: ProductStickerResponse[];
123
+ barcode?: string | undefined;
124
+ sizeCharts: ProductSizeChartResponse[];
93
125
  }
94
126
  export interface ProductDetailResponse_NameEntry {
95
127
  key: string;
@@ -148,6 +180,7 @@ export interface ProductVariantResponse {
148
180
  options: {
149
181
  [key: string]: string;
150
182
  };
183
+ barcode?: string | undefined;
151
184
  }
152
185
  export interface ProductVariantResponse_OptionsEntry {
153
186
  key: string;
@@ -168,6 +201,18 @@ export interface ProductFileResponse_NameEntry {
168
201
  key: string;
169
202
  value: string;
170
203
  }
204
+ export interface ProductStickerResponse {
205
+ id: string;
206
+ name: {
207
+ [key: string]: string;
208
+ };
209
+ color?: string | undefined;
210
+ icon?: string | undefined;
211
+ }
212
+ export interface ProductStickerResponse_NameEntry {
213
+ key: string;
214
+ value: string;
215
+ }
171
216
  export interface GetProductsRequest {
172
217
  pagination: PaginationRequest | undefined;
173
218
  search?: string | undefined;
@@ -219,6 +264,8 @@ export interface CreateProductRequest {
219
264
  stickerIds: string[];
220
265
  attributeValueIds: string[];
221
266
  sortOrder?: number | undefined;
267
+ barcode?: string | undefined;
268
+ sizeChartIds: string[];
222
269
  }
223
270
  export interface CreateProductRequest_NameEntry {
224
271
  key: string;
@@ -270,6 +317,7 @@ export interface UpdateProductRequest {
270
317
  stickerIds: string[];
271
318
  attributeValueIds: string[];
272
319
  sortOrder?: number | undefined;
320
+ barcode?: string | undefined;
273
321
  }
274
322
  export interface UpdateProductRequest_NameEntry {
275
323
  key: string;
@@ -315,18 +363,6 @@ export interface ProductImagePayload {
315
363
  export interface BulkDeleteProductsRequest {
316
364
  productIds: string[];
317
365
  }
318
- export interface ProductStickerResponse {
319
- id: string;
320
- name: {
321
- [key: string]: string;
322
- };
323
- color?: string | undefined;
324
- icon?: string | undefined;
325
- }
326
- export interface ProductStickerResponse_NameEntry {
327
- key: string;
328
- value: string;
329
- }
330
366
  export interface CreateProductVariantRequest {
331
367
  productId: string;
332
368
  sku: string;
@@ -335,6 +371,7 @@ export interface CreateProductVariantRequest {
335
371
  options: {
336
372
  [key: string]: string;
337
373
  };
374
+ barcode?: string | undefined;
338
375
  }
339
376
  export interface CreateProductVariantRequest_OptionsEntry {
340
377
  key: string;
@@ -348,6 +385,7 @@ export interface UpdateProductVariantRequest {
348
385
  options: {
349
386
  [key: string]: string;
350
387
  };
388
+ barcode?: string | undefined;
351
389
  }
352
390
  export interface UpdateProductVariantRequest_OptionsEntry {
353
391
  key: string;
@@ -367,6 +405,11 @@ export interface ProductServiceClient {
367
405
  bulkUpdateCategory(request: BulkUpdateCategoryRequest): Observable<SuccessResponse>;
368
406
  bulkUpdateDiscount(request: BulkUpdateDiscountRequest): Observable<SuccessResponse>;
369
407
  bulkDeleteProducts(request: BulkDeleteProductsRequest): Observable<SuccessResponse>;
408
+ bulkAssignSticker(request: BulkStickerRequest): Observable<SuccessResponse>;
409
+ bulkRemoveSticker(request: BulkStickerRequest): Observable<SuccessResponse>;
410
+ assignSizeChartsToProduct(request: AssignSizeChartsToProductRequest): Observable<SuccessResponse>;
411
+ removeSizeChartFromProduct(request: RemoveSizeChartFromProductRequest): Observable<SuccessResponse>;
412
+ getProductSizeCharts(request: GetProductSizeChartsRequest): Observable<GetProductSizeChartsResponse>;
370
413
  createProductVariant(request: CreateProductVariantRequest): Observable<ProductVariantResponse>;
371
414
  updateProductVariant(request: UpdateProductVariantRequest): Observable<ProductVariantResponse>;
372
415
  deleteProductVariant(request: DeleteProductVariantRequest): Observable<DeleteResponse>;
@@ -383,6 +426,11 @@ export interface ProductServiceController {
383
426
  bulkUpdateCategory(request: BulkUpdateCategoryRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
384
427
  bulkUpdateDiscount(request: BulkUpdateDiscountRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
385
428
  bulkDeleteProducts(request: BulkDeleteProductsRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
429
+ bulkAssignSticker(request: BulkStickerRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
430
+ bulkRemoveSticker(request: BulkStickerRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
431
+ assignSizeChartsToProduct(request: AssignSizeChartsToProductRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
432
+ removeSizeChartFromProduct(request: RemoveSizeChartFromProductRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
433
+ getProductSizeCharts(request: GetProductSizeChartsRequest): Promise<GetProductSizeChartsResponse> | Observable<GetProductSizeChartsResponse> | GetProductSizeChartsResponse;
386
434
  createProductVariant(request: CreateProductVariantRequest): Promise<ProductVariantResponse> | Observable<ProductVariantResponse> | ProductVariantResponse;
387
435
  updateProductVariant(request: UpdateProductVariantRequest): Promise<ProductVariantResponse> | Observable<ProductVariantResponse> | ProductVariantResponse;
388
436
  deleteProductVariant(request: DeleteProductVariantRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
@@ -32,6 +32,11 @@ function ProductServiceControllerMethods() {
32
32
  "bulkUpdateCategory",
33
33
  "bulkUpdateDiscount",
34
34
  "bulkDeleteProducts",
35
+ "bulkAssignSticker",
36
+ "bulkRemoveSticker",
37
+ "assignSizeChartsToProduct",
38
+ "removeSizeChartFromProduct",
39
+ "getProductSizeCharts",
35
40
  "createProductVariant",
36
41
  "updateProductVariant",
37
42
  "deleteProductVariant",
@@ -0,0 +1,136 @@
1
+ import { Observable } from "rxjs";
2
+ import { PaginationMeta, PaginationRequest, SuccessResponse } from "./common";
3
+ export declare const protobufPackage = "catalog.v1";
4
+ export declare enum StockMovementType {
5
+ STOCK_MOVEMENT_UNSPECIFIED = 0,
6
+ STOCK_MOVEMENT_INCOMING = 1,
7
+ STOCK_MOVEMENT_OUTGOING = 2,
8
+ STOCK_MOVEMENT_RESERVE = 3,
9
+ STOCK_MOVEMENT_UNRESERVE = 4,
10
+ STOCK_MOVEMENT_ADJUSTMENT = 5,
11
+ STOCK_MOVEMENT_RETURN = 6,
12
+ UNRECOGNIZED = -1
13
+ }
14
+ export interface WarehouseStockResponse {
15
+ productId: string;
16
+ warehouseId: string;
17
+ quantity: number;
18
+ reserved: number;
19
+ available: number;
20
+ }
21
+ export interface GetProductStockResponse {
22
+ warehouses: WarehouseStockDetail[];
23
+ totalQuantity: number;
24
+ totalReserved: number;
25
+ totalAvailable: number;
26
+ variants: VariantStockDetail[];
27
+ }
28
+ export interface WarehouseStockDetail {
29
+ warehouseId: string;
30
+ quantity: number;
31
+ reserved: number;
32
+ available: number;
33
+ }
34
+ export interface VariantStockDetail {
35
+ variantId: string;
36
+ sku: string;
37
+ barcode?: string | undefined;
38
+ stock: number;
39
+ options: {
40
+ [key: string]: string;
41
+ };
42
+ }
43
+ export interface VariantStockDetail_OptionsEntry {
44
+ key: string;
45
+ value: string;
46
+ }
47
+ export interface StockMovementResponse {
48
+ id: string;
49
+ productId: string;
50
+ variantId?: string | undefined;
51
+ warehouseId: string;
52
+ type: StockMovementType;
53
+ quantity: number;
54
+ reason?: string | undefined;
55
+ referenceType?: string | undefined;
56
+ referenceId?: string | undefined;
57
+ stockAfter: number;
58
+ createdById?: string | undefined;
59
+ createdAt: string;
60
+ }
61
+ export interface UpdateWarehouseStockRequest {
62
+ productId: string;
63
+ warehouseId: string;
64
+ quantity: number;
65
+ createdById?: string | undefined;
66
+ }
67
+ export interface GetProductStockRequest {
68
+ productId: string;
69
+ }
70
+ export interface BatchSyncStockItem {
71
+ productId: string;
72
+ warehouseId: string;
73
+ quantity: number;
74
+ guid1c?: string | undefined;
75
+ }
76
+ export interface BatchSyncStockRequest {
77
+ items: BatchSyncStockItem[];
78
+ syncId: string;
79
+ }
80
+ export interface ReserveStockItem {
81
+ productId: string;
82
+ variantId?: string | undefined;
83
+ warehouseId: string;
84
+ quantity: number;
85
+ }
86
+ export interface ReserveStockRequest {
87
+ orderId: string;
88
+ items: ReserveStockItem[];
89
+ }
90
+ export interface ConfirmReservationRequest {
91
+ orderId: string;
92
+ }
93
+ export interface CancelReservationRequest {
94
+ orderId: string;
95
+ }
96
+ export interface AdjustStockRequest {
97
+ productId: string;
98
+ warehouseId: string;
99
+ delta: number;
100
+ reason: string;
101
+ createdById: string;
102
+ }
103
+ export interface GetStockMovementsRequest {
104
+ pagination: PaginationRequest | undefined;
105
+ productId?: string | undefined;
106
+ warehouseId?: string | undefined;
107
+ variantId?: string | undefined;
108
+ referenceType?: string | undefined;
109
+ }
110
+ export interface GetStockMovementsResponse {
111
+ items: StockMovementResponse[];
112
+ meta: PaginationMeta | undefined;
113
+ }
114
+ export declare const CATALOG_V1_PACKAGE_NAME = "catalog.v1";
115
+ export interface StockServiceClient {
116
+ updateWarehouseStock(request: UpdateWarehouseStockRequest): Observable<WarehouseStockResponse>;
117
+ getProductStock(request: GetProductStockRequest): Observable<GetProductStockResponse>;
118
+ batchSyncStock(request: BatchSyncStockRequest): Observable<SuccessResponse>;
119
+ reserveStock(request: ReserveStockRequest): Observable<SuccessResponse>;
120
+ confirmReservation(request: ConfirmReservationRequest): Observable<SuccessResponse>;
121
+ cancelReservation(request: CancelReservationRequest): Observable<SuccessResponse>;
122
+ adjustStock(request: AdjustStockRequest): Observable<WarehouseStockResponse>;
123
+ getStockMovements(request: GetStockMovementsRequest): Observable<GetStockMovementsResponse>;
124
+ }
125
+ export interface StockServiceController {
126
+ updateWarehouseStock(request: UpdateWarehouseStockRequest): Promise<WarehouseStockResponse> | Observable<WarehouseStockResponse> | WarehouseStockResponse;
127
+ getProductStock(request: GetProductStockRequest): Promise<GetProductStockResponse> | Observable<GetProductStockResponse> | GetProductStockResponse;
128
+ batchSyncStock(request: BatchSyncStockRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
129
+ reserveStock(request: ReserveStockRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
130
+ confirmReservation(request: ConfirmReservationRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
131
+ cancelReservation(request: CancelReservationRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
132
+ adjustStock(request: AdjustStockRequest): Promise<WarehouseStockResponse> | Observable<WarehouseStockResponse> | WarehouseStockResponse;
133
+ getStockMovements(request: GetStockMovementsRequest): Promise<GetStockMovementsResponse> | Observable<GetStockMovementsResponse> | GetStockMovementsResponse;
134
+ }
135
+ export declare function StockServiceControllerMethods(): (constructor: Function) => void;
136
+ export declare const STOCK_SERVICE_NAME = "StockService";
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.4
5
+ // protoc v3.21.12
6
+ // source: stock.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.STOCK_SERVICE_NAME = exports.CATALOG_V1_PACKAGE_NAME = exports.StockMovementType = exports.protobufPackage = void 0;
9
+ exports.StockServiceControllerMethods = StockServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "catalog.v1";
13
+ var StockMovementType;
14
+ (function (StockMovementType) {
15
+ StockMovementType[StockMovementType["STOCK_MOVEMENT_UNSPECIFIED"] = 0] = "STOCK_MOVEMENT_UNSPECIFIED";
16
+ StockMovementType[StockMovementType["STOCK_MOVEMENT_INCOMING"] = 1] = "STOCK_MOVEMENT_INCOMING";
17
+ StockMovementType[StockMovementType["STOCK_MOVEMENT_OUTGOING"] = 2] = "STOCK_MOVEMENT_OUTGOING";
18
+ StockMovementType[StockMovementType["STOCK_MOVEMENT_RESERVE"] = 3] = "STOCK_MOVEMENT_RESERVE";
19
+ StockMovementType[StockMovementType["STOCK_MOVEMENT_UNRESERVE"] = 4] = "STOCK_MOVEMENT_UNRESERVE";
20
+ StockMovementType[StockMovementType["STOCK_MOVEMENT_ADJUSTMENT"] = 5] = "STOCK_MOVEMENT_ADJUSTMENT";
21
+ StockMovementType[StockMovementType["STOCK_MOVEMENT_RETURN"] = 6] = "STOCK_MOVEMENT_RETURN";
22
+ StockMovementType[StockMovementType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
23
+ })(StockMovementType || (exports.StockMovementType = StockMovementType = {}));
24
+ exports.CATALOG_V1_PACKAGE_NAME = "catalog.v1";
25
+ function StockServiceControllerMethods() {
26
+ return function (constructor) {
27
+ const grpcMethods = [
28
+ "updateWarehouseStock",
29
+ "getProductStock",
30
+ "batchSyncStock",
31
+ "reserveStock",
32
+ "confirmReservation",
33
+ "cancelReservation",
34
+ "adjustStock",
35
+ "getStockMovements",
36
+ ];
37
+ for (const method of grpcMethods) {
38
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
39
+ (0, microservices_1.GrpcMethod)("StockService", method)(constructor.prototype[method], method, descriptor);
40
+ }
41
+ const grpcStreamMethods = [];
42
+ for (const method of grpcStreamMethods) {
43
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
44
+ (0, microservices_1.GrpcStreamMethod)("StockService", method)(constructor.prototype[method], method, descriptor);
45
+ }
46
+ };
47
+ }
48
+ exports.STOCK_SERVICE_NAME = "StockService";
@@ -1,6 +1,7 @@
1
1
  syntax = "proto3";
2
2
 
3
3
  package catalog.v1;
4
+
4
5
  import "common.proto";
5
6
 
6
7
 
@@ -13,12 +14,21 @@ service ProductService {
13
14
  rpc UpdateProduct (UpdateProductRequest) returns (ProductDetailResponse);
14
15
  rpc DeleteProduct (DeleteProductRequest) returns (DeleteResponse);
15
16
 
16
-
17
+
17
18
  rpc BulkUpdateStatus (BulkUpdateStatusRequest) returns (SuccessResponse);
18
19
  rpc BulkUpdateCategory (BulkUpdateCategoryRequest) returns (SuccessResponse);
19
20
  rpc BulkUpdateDiscount (BulkUpdateDiscountRequest) returns (SuccessResponse);
20
21
  rpc BulkDeleteProducts (BulkDeleteProductsRequest) returns (SuccessResponse);
21
22
 
23
+
24
+ rpc BulkAssignSticker (BulkStickerRequest) returns (SuccessResponse);
25
+ rpc BulkRemoveSticker (BulkStickerRequest) returns (SuccessResponse);
26
+
27
+
28
+ rpc AssignSizeChartsToProduct (AssignSizeChartsToProductRequest) returns (SuccessResponse);
29
+ rpc RemoveSizeChartFromProduct (RemoveSizeChartFromProductRequest) returns (SuccessResponse);
30
+ rpc GetProductSizeCharts (GetProductSizeChartsRequest) returns (GetProductSizeChartsResponse);
31
+
22
32
 
23
33
  rpc CreateProductVariant (CreateProductVariantRequest) returns (ProductVariantResponse);
24
34
  rpc UpdateProductVariant (UpdateProductVariantRequest) returns (ProductVariantResponse);
@@ -31,6 +41,39 @@ service ProductService {
31
41
 
32
42
 
33
43
 
44
+ message BulkStickerRequest {
45
+ repeated string product_ids = 1;
46
+ string sticker_id = 2;
47
+ }
48
+
49
+
50
+
51
+ message AssignSizeChartsToProductRequest {
52
+ string product_id = 1;
53
+ repeated string size_chart_ids = 2;
54
+ }
55
+
56
+ message RemoveSizeChartFromProductRequest {
57
+ string product_id = 1;
58
+ string size_chart_id = 2;
59
+ }
60
+
61
+ message GetProductSizeChartsRequest {
62
+ string product_id = 1;
63
+ }
64
+
65
+ message ProductSizeChartResponse {
66
+ string id = 1;
67
+ map<string, string> name = 2;
68
+ string content = 3;
69
+ }
70
+
71
+ message GetProductSizeChartsResponse {
72
+ repeated ProductSizeChartResponse items = 1;
73
+ }
74
+
75
+
76
+
34
77
  message ProductOrderItem {
35
78
  string product_id = 1;
36
79
  int32 sort_order = 2;
@@ -72,6 +115,7 @@ message ProductListItemResponse {
72
115
 
73
116
  int32 sort_order = 12;
74
117
  int32 category_sort_order = 13;
118
+ optional string barcode = 14;
75
119
  }
76
120
 
77
121
 
@@ -109,6 +153,8 @@ message ProductDetailResponse {
109
153
  repeated ProductFileResponse files = 25;
110
154
  optional string main_image_id = 26;
111
155
  repeated ProductStickerResponse stickers = 27;
156
+ optional string barcode = 28;
157
+ repeated ProductSizeChartResponse size_charts = 29;
112
158
  }
113
159
 
114
160
 
@@ -131,6 +177,7 @@ message ProductVariantResponse {
131
177
  optional double price = 3;
132
178
  int32 stock = 4;
133
179
  map<string, string> options = 5;
180
+ optional string barcode = 6;
134
181
  }
135
182
 
136
183
  message ProductAttributeResponse {
@@ -144,6 +191,13 @@ message ProductFileResponse {
144
191
  map<string, string> name = 3;
145
192
  }
146
193
 
194
+ message ProductStickerResponse {
195
+ string id = 1;
196
+ map<string, string> name = 2;
197
+ optional string color = 3;
198
+ optional string icon = 4;
199
+ }
200
+
147
201
 
148
202
 
149
203
  message GetProductsRequest {
@@ -158,7 +212,6 @@ message GetProductsRequest {
158
212
  optional double price_min = 7;
159
213
  optional double price_max = 8;
160
214
 
161
-
162
215
  optional string sort_by = 9;
163
216
  }
164
217
 
@@ -203,6 +256,8 @@ message CreateProductRequest {
203
256
  repeated string attribute_value_ids = 19;
204
257
 
205
258
  optional int32 sort_order = 20;
259
+ optional string barcode = 21;
260
+ repeated string size_chart_ids = 22;
206
261
  }
207
262
 
208
263
  message UpdateProductRequest {
@@ -231,6 +286,7 @@ message UpdateProductRequest {
231
286
  repeated string attribute_value_ids = 18;
232
287
 
233
288
  optional int32 sort_order = 19;
289
+ optional string barcode = 20;
234
290
  }
235
291
 
236
292
  message DeleteProductRequest {
@@ -264,12 +320,6 @@ message BulkDeleteProductsRequest {
264
320
  repeated string product_ids = 1;
265
321
  }
266
322
 
267
- message ProductStickerResponse {
268
- string id = 1;
269
- map<string, string> name = 2;
270
- optional string color = 3;
271
- optional string icon = 4;
272
- }
273
323
 
274
324
  message CreateProductVariantRequest {
275
325
  string product_id = 1;
@@ -277,6 +327,7 @@ message CreateProductVariantRequest {
277
327
  optional double price = 3;
278
328
  int32 stock = 4;
279
329
  map<string, string> options = 5;
330
+ optional string barcode = 6;
280
331
  }
281
332
 
282
333
  message UpdateProductVariantRequest {
@@ -285,6 +336,7 @@ message UpdateProductVariantRequest {
285
336
  optional double price = 3;
286
337
  optional int32 stock = 4;
287
338
  map<string, string> options = 5;
339
+ optional string barcode = 6;
288
340
  }
289
341
 
290
342
  message DeleteProductVariantRequest {
@@ -0,0 +1,152 @@
1
+ syntax = "proto3";
2
+
3
+ package catalog.v1;
4
+
5
+ import "common.proto";
6
+
7
+ service StockService {
8
+
9
+ rpc UpdateWarehouseStock (UpdateWarehouseStockRequest) returns (WarehouseStockResponse);
10
+ rpc GetProductStock (GetProductStockRequest) returns (GetProductStockResponse);
11
+
12
+
13
+ rpc BatchSyncStock (BatchSyncStockRequest) returns (SuccessResponse);
14
+
15
+
16
+ rpc ReserveStock (ReserveStockRequest) returns (SuccessResponse);
17
+ rpc ConfirmReservation (ConfirmReservationRequest) returns (SuccessResponse);
18
+ rpc CancelReservation (CancelReservationRequest) returns (SuccessResponse);
19
+
20
+
21
+ rpc AdjustStock (AdjustStockRequest) returns (WarehouseStockResponse);
22
+
23
+
24
+ rpc GetStockMovements (GetStockMovementsRequest) returns (GetStockMovementsResponse);
25
+ }
26
+
27
+
28
+ enum StockMovementType {
29
+ STOCK_MOVEMENT_UNSPECIFIED = 0;
30
+ STOCK_MOVEMENT_INCOMING = 1;
31
+ STOCK_MOVEMENT_OUTGOING = 2;
32
+ STOCK_MOVEMENT_RESERVE = 3;
33
+ STOCK_MOVEMENT_UNRESERVE = 4;
34
+ STOCK_MOVEMENT_ADJUSTMENT = 5;
35
+ STOCK_MOVEMENT_RETURN = 6;
36
+ }
37
+
38
+
39
+ message WarehouseStockResponse {
40
+ string product_id = 1;
41
+ string warehouse_id = 2;
42
+ int32 quantity = 3;
43
+ int32 reserved = 4;
44
+ int32 available = 5;
45
+ }
46
+
47
+ message GetProductStockResponse {
48
+ repeated WarehouseStockDetail warehouses = 1;
49
+ int32 total_quantity = 2;
50
+ int32 total_reserved = 3;
51
+ int32 total_available = 4;
52
+ repeated VariantStockDetail variants = 5;
53
+ }
54
+
55
+ message WarehouseStockDetail {
56
+ string warehouse_id = 1;
57
+ int32 quantity = 2;
58
+ int32 reserved = 3;
59
+ int32 available = 4;
60
+ }
61
+
62
+ message VariantStockDetail {
63
+ string variant_id = 1;
64
+ string sku = 2;
65
+ optional string barcode = 3;
66
+ int32 stock = 4;
67
+ map<string, string> options = 5;
68
+ }
69
+
70
+ message StockMovementResponse {
71
+ string id = 1;
72
+ string product_id = 2;
73
+ optional string variant_id = 3;
74
+ string warehouse_id = 4;
75
+ StockMovementType type = 5;
76
+ int32 quantity = 6;
77
+ optional string reason = 7;
78
+ optional string reference_type = 8;
79
+ optional string reference_id = 9;
80
+ int32 stock_after = 10;
81
+ optional string created_by_id = 11;
82
+ string created_at = 12;
83
+ }
84
+
85
+
86
+ message UpdateWarehouseStockRequest {
87
+ string product_id = 1;
88
+ string warehouse_id = 2;
89
+ int32 quantity = 3;
90
+ optional string created_by_id = 4;
91
+ }
92
+
93
+ message GetProductStockRequest {
94
+ string product_id = 1;
95
+ }
96
+
97
+
98
+ message BatchSyncStockItem {
99
+ string product_id = 1;
100
+ string warehouse_id = 2;
101
+ int32 quantity = 3;
102
+ optional string guid_1c = 4;
103
+ }
104
+
105
+ message BatchSyncStockRequest {
106
+ repeated BatchSyncStockItem items = 1;
107
+ string sync_id = 2;
108
+ }
109
+
110
+
111
+ message ReserveStockItem {
112
+ string product_id = 1;
113
+ optional string variant_id = 2;
114
+ string warehouse_id = 3;
115
+ int32 quantity = 4;
116
+ }
117
+
118
+ message ReserveStockRequest {
119
+ string order_id = 1;
120
+ repeated ReserveStockItem items = 2;
121
+ }
122
+
123
+ message ConfirmReservationRequest {
124
+ string order_id = 1;
125
+ }
126
+
127
+ message CancelReservationRequest {
128
+ string order_id = 1;
129
+ }
130
+
131
+
132
+ message AdjustStockRequest {
133
+ string product_id = 1;
134
+ string warehouse_id = 2;
135
+ int32 delta = 3;
136
+ string reason = 4;
137
+ string created_by_id = 5;
138
+ }
139
+
140
+
141
+ message GetStockMovementsRequest {
142
+ PaginationRequest pagination = 1;
143
+ optional string product_id = 2;
144
+ optional string warehouse_id = 3;
145
+ optional string variant_id = 4;
146
+ optional string reference_type = 5;
147
+ }
148
+
149
+ message GetStockMovementsResponse {
150
+ repeated StockMovementResponse items = 1;
151
+ PaginationMeta meta = 2;
152
+ }
@@ -10,6 +10,7 @@ export declare const PROTO_PATHS: {
10
10
  readonly MEDIA: string;
11
11
  readonly SIZE_CHART: string;
12
12
  readonly STICKER: string;
13
+ readonly STOCK: string;
13
14
  readonly COMMON_PROMO: string;
14
15
  readonly CALCULATION: string;
15
16
  readonly COUPON: string;
@@ -14,6 +14,7 @@ exports.PROTO_PATHS = {
14
14
  MEDIA: (0, node_path_1.join)(__dirname, '../../proto/media.proto'),
15
15
  SIZE_CHART: (0, node_path_1.join)(__dirname, '../../proto/size_chart.proto'),
16
16
  STICKER: (0, node_path_1.join)(__dirname, '../../proto/sticker.proto'),
17
+ STOCK: (0, node_path_1.join)(__dirname, '../../proto/stock.proto'),
17
18
  COMMON_PROMO: (0, node_path_1.join)(__dirname, '../../proto/common_promo.proto'),
18
19
  CALCULATION: (0, node_path_1.join)(__dirname, '../../proto/calculation.proto'),
19
20
  COUPON: (0, node_path_1.join)(__dirname, '../../proto/coupon.proto'),
package/gen/product.ts CHANGED
@@ -20,6 +20,40 @@ export enum ProductStatus {
20
20
  UNRECOGNIZED = -1,
21
21
  }
22
22
 
23
+ export interface BulkStickerRequest {
24
+ productIds: string[];
25
+ stickerId: string;
26
+ }
27
+
28
+ export interface AssignSizeChartsToProductRequest {
29
+ productId: string;
30
+ sizeChartIds: string[];
31
+ }
32
+
33
+ export interface RemoveSizeChartFromProductRequest {
34
+ productId: string;
35
+ sizeChartId: string;
36
+ }
37
+
38
+ export interface GetProductSizeChartsRequest {
39
+ productId: string;
40
+ }
41
+
42
+ export interface ProductSizeChartResponse {
43
+ id: string;
44
+ name: { [key: string]: string };
45
+ content: string;
46
+ }
47
+
48
+ export interface ProductSizeChartResponse_NameEntry {
49
+ key: string;
50
+ value: string;
51
+ }
52
+
53
+ export interface GetProductSizeChartsResponse {
54
+ items: ProductSizeChartResponse[];
55
+ }
56
+
23
57
  export interface ProductOrderItem {
24
58
  productId: string;
25
59
  sortOrder: number;
@@ -54,6 +88,7 @@ export interface ProductListItemResponse {
54
88
  categoryIds: string[];
55
89
  sortOrder: number;
56
90
  categorySortOrder: number;
91
+ barcode?: string | undefined;
57
92
  }
58
93
 
59
94
  export interface ProductListItemResponse_NameEntry {
@@ -89,6 +124,8 @@ export interface ProductDetailResponse {
89
124
  files: ProductFileResponse[];
90
125
  mainImageId?: string | undefined;
91
126
  stickers: ProductStickerResponse[];
127
+ barcode?: string | undefined;
128
+ sizeCharts: ProductSizeChartResponse[];
92
129
  }
93
130
 
94
131
  export interface ProductDetailResponse_NameEntry {
@@ -155,6 +192,7 @@ export interface ProductVariantResponse {
155
192
  price?: number | undefined;
156
193
  stock: number;
157
194
  options: { [key: string]: string };
195
+ barcode?: string | undefined;
158
196
  }
159
197
 
160
198
  export interface ProductVariantResponse_OptionsEntry {
@@ -178,6 +216,18 @@ export interface ProductFileResponse_NameEntry {
178
216
  value: string;
179
217
  }
180
218
 
219
+ export interface ProductStickerResponse {
220
+ id: string;
221
+ name: { [key: string]: string };
222
+ color?: string | undefined;
223
+ icon?: string | undefined;
224
+ }
225
+
226
+ export interface ProductStickerResponse_NameEntry {
227
+ key: string;
228
+ value: string;
229
+ }
230
+
181
231
  export interface GetProductsRequest {
182
232
  pagination: PaginationRequest | undefined;
183
233
  search?: string | undefined;
@@ -222,6 +272,8 @@ export interface CreateProductRequest {
222
272
  stickerIds: string[];
223
273
  attributeValueIds: string[];
224
274
  sortOrder?: number | undefined;
275
+ barcode?: string | undefined;
276
+ sizeChartIds: string[];
225
277
  }
226
278
 
227
279
  export interface CreateProductRequest_NameEntry {
@@ -269,6 +321,7 @@ export interface UpdateProductRequest {
269
321
  stickerIds: string[];
270
322
  attributeValueIds: string[];
271
323
  sortOrder?: number | undefined;
324
+ barcode?: string | undefined;
272
325
  }
273
326
 
274
327
  export interface UpdateProductRequest_NameEntry {
@@ -326,24 +379,13 @@ export interface BulkDeleteProductsRequest {
326
379
  productIds: string[];
327
380
  }
328
381
 
329
- export interface ProductStickerResponse {
330
- id: string;
331
- name: { [key: string]: string };
332
- color?: string | undefined;
333
- icon?: string | undefined;
334
- }
335
-
336
- export interface ProductStickerResponse_NameEntry {
337
- key: string;
338
- value: string;
339
- }
340
-
341
382
  export interface CreateProductVariantRequest {
342
383
  productId: string;
343
384
  sku: string;
344
385
  price?: number | undefined;
345
386
  stock: number;
346
387
  options: { [key: string]: string };
388
+ barcode?: string | undefined;
347
389
  }
348
390
 
349
391
  export interface CreateProductVariantRequest_OptionsEntry {
@@ -357,6 +399,7 @@ export interface UpdateProductVariantRequest {
357
399
  price?: number | undefined;
358
400
  stock?: number | undefined;
359
401
  options: { [key: string]: string };
402
+ barcode?: string | undefined;
360
403
  }
361
404
 
362
405
  export interface UpdateProductVariantRequest_OptionsEntry {
@@ -389,6 +432,16 @@ export interface ProductServiceClient {
389
432
 
390
433
  bulkDeleteProducts(request: BulkDeleteProductsRequest): Observable<SuccessResponse>;
391
434
 
435
+ bulkAssignSticker(request: BulkStickerRequest): Observable<SuccessResponse>;
436
+
437
+ bulkRemoveSticker(request: BulkStickerRequest): Observable<SuccessResponse>;
438
+
439
+ assignSizeChartsToProduct(request: AssignSizeChartsToProductRequest): Observable<SuccessResponse>;
440
+
441
+ removeSizeChartFromProduct(request: RemoveSizeChartFromProductRequest): Observable<SuccessResponse>;
442
+
443
+ getProductSizeCharts(request: GetProductSizeChartsRequest): Observable<GetProductSizeChartsResponse>;
444
+
392
445
  createProductVariant(request: CreateProductVariantRequest): Observable<ProductVariantResponse>;
393
446
 
394
447
  updateProductVariant(request: UpdateProductVariantRequest): Observable<ProductVariantResponse>;
@@ -435,6 +488,26 @@ export interface ProductServiceController {
435
488
  request: BulkDeleteProductsRequest,
436
489
  ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
437
490
 
491
+ bulkAssignSticker(
492
+ request: BulkStickerRequest,
493
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
494
+
495
+ bulkRemoveSticker(
496
+ request: BulkStickerRequest,
497
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
498
+
499
+ assignSizeChartsToProduct(
500
+ request: AssignSizeChartsToProductRequest,
501
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
502
+
503
+ removeSizeChartFromProduct(
504
+ request: RemoveSizeChartFromProductRequest,
505
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
506
+
507
+ getProductSizeCharts(
508
+ request: GetProductSizeChartsRequest,
509
+ ): Promise<GetProductSizeChartsResponse> | Observable<GetProductSizeChartsResponse> | GetProductSizeChartsResponse;
510
+
438
511
  createProductVariant(
439
512
  request: CreateProductVariantRequest,
440
513
  ): Promise<ProductVariantResponse> | Observable<ProductVariantResponse> | ProductVariantResponse;
@@ -468,6 +541,11 @@ export function ProductServiceControllerMethods() {
468
541
  "bulkUpdateCategory",
469
542
  "bulkUpdateDiscount",
470
543
  "bulkDeleteProducts",
544
+ "bulkAssignSticker",
545
+ "bulkRemoveSticker",
546
+ "assignSizeChartsToProduct",
547
+ "removeSizeChartFromProduct",
548
+ "getProductSizeCharts",
471
549
  "createProductVariant",
472
550
  "updateProductVariant",
473
551
  "deleteProductVariant",
package/gen/stock.ts ADDED
@@ -0,0 +1,216 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.4
4
+ // protoc v3.21.12
5
+ // source: stock.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { PaginationMeta, PaginationRequest, SuccessResponse } from "./common";
11
+
12
+ export const protobufPackage = "catalog.v1";
13
+
14
+ export enum StockMovementType {
15
+ STOCK_MOVEMENT_UNSPECIFIED = 0,
16
+ STOCK_MOVEMENT_INCOMING = 1,
17
+ STOCK_MOVEMENT_OUTGOING = 2,
18
+ STOCK_MOVEMENT_RESERVE = 3,
19
+ STOCK_MOVEMENT_UNRESERVE = 4,
20
+ STOCK_MOVEMENT_ADJUSTMENT = 5,
21
+ STOCK_MOVEMENT_RETURN = 6,
22
+ UNRECOGNIZED = -1,
23
+ }
24
+
25
+ export interface WarehouseStockResponse {
26
+ productId: string;
27
+ warehouseId: string;
28
+ quantity: number;
29
+ reserved: number;
30
+ available: number;
31
+ }
32
+
33
+ export interface GetProductStockResponse {
34
+ warehouses: WarehouseStockDetail[];
35
+ totalQuantity: number;
36
+ totalReserved: number;
37
+ totalAvailable: number;
38
+ variants: VariantStockDetail[];
39
+ }
40
+
41
+ export interface WarehouseStockDetail {
42
+ warehouseId: string;
43
+ quantity: number;
44
+ reserved: number;
45
+ available: number;
46
+ }
47
+
48
+ export interface VariantStockDetail {
49
+ variantId: string;
50
+ sku: string;
51
+ barcode?: string | undefined;
52
+ stock: number;
53
+ options: { [key: string]: string };
54
+ }
55
+
56
+ export interface VariantStockDetail_OptionsEntry {
57
+ key: string;
58
+ value: string;
59
+ }
60
+
61
+ export interface StockMovementResponse {
62
+ id: string;
63
+ productId: string;
64
+ variantId?: string | undefined;
65
+ warehouseId: string;
66
+ type: StockMovementType;
67
+ quantity: number;
68
+ reason?: string | undefined;
69
+ referenceType?: string | undefined;
70
+ referenceId?: string | undefined;
71
+ stockAfter: number;
72
+ createdById?: string | undefined;
73
+ createdAt: string;
74
+ }
75
+
76
+ export interface UpdateWarehouseStockRequest {
77
+ productId: string;
78
+ warehouseId: string;
79
+ quantity: number;
80
+ createdById?: string | undefined;
81
+ }
82
+
83
+ export interface GetProductStockRequest {
84
+ productId: string;
85
+ }
86
+
87
+ export interface BatchSyncStockItem {
88
+ productId: string;
89
+ warehouseId: string;
90
+ quantity: number;
91
+ guid1c?: string | undefined;
92
+ }
93
+
94
+ export interface BatchSyncStockRequest {
95
+ items: BatchSyncStockItem[];
96
+ syncId: string;
97
+ }
98
+
99
+ export interface ReserveStockItem {
100
+ productId: string;
101
+ variantId?: string | undefined;
102
+ warehouseId: string;
103
+ quantity: number;
104
+ }
105
+
106
+ export interface ReserveStockRequest {
107
+ orderId: string;
108
+ items: ReserveStockItem[];
109
+ }
110
+
111
+ export interface ConfirmReservationRequest {
112
+ orderId: string;
113
+ }
114
+
115
+ export interface CancelReservationRequest {
116
+ orderId: string;
117
+ }
118
+
119
+ export interface AdjustStockRequest {
120
+ productId: string;
121
+ warehouseId: string;
122
+ delta: number;
123
+ reason: string;
124
+ createdById: string;
125
+ }
126
+
127
+ export interface GetStockMovementsRequest {
128
+ pagination: PaginationRequest | undefined;
129
+ productId?: string | undefined;
130
+ warehouseId?: string | undefined;
131
+ variantId?: string | undefined;
132
+ referenceType?: string | undefined;
133
+ }
134
+
135
+ export interface GetStockMovementsResponse {
136
+ items: StockMovementResponse[];
137
+ meta: PaginationMeta | undefined;
138
+ }
139
+
140
+ export const CATALOG_V1_PACKAGE_NAME = "catalog.v1";
141
+
142
+ export interface StockServiceClient {
143
+ updateWarehouseStock(request: UpdateWarehouseStockRequest): Observable<WarehouseStockResponse>;
144
+
145
+ getProductStock(request: GetProductStockRequest): Observable<GetProductStockResponse>;
146
+
147
+ batchSyncStock(request: BatchSyncStockRequest): Observable<SuccessResponse>;
148
+
149
+ reserveStock(request: ReserveStockRequest): Observable<SuccessResponse>;
150
+
151
+ confirmReservation(request: ConfirmReservationRequest): Observable<SuccessResponse>;
152
+
153
+ cancelReservation(request: CancelReservationRequest): Observable<SuccessResponse>;
154
+
155
+ adjustStock(request: AdjustStockRequest): Observable<WarehouseStockResponse>;
156
+
157
+ getStockMovements(request: GetStockMovementsRequest): Observable<GetStockMovementsResponse>;
158
+ }
159
+
160
+ export interface StockServiceController {
161
+ updateWarehouseStock(
162
+ request: UpdateWarehouseStockRequest,
163
+ ): Promise<WarehouseStockResponse> | Observable<WarehouseStockResponse> | WarehouseStockResponse;
164
+
165
+ getProductStock(
166
+ request: GetProductStockRequest,
167
+ ): Promise<GetProductStockResponse> | Observable<GetProductStockResponse> | GetProductStockResponse;
168
+
169
+ batchSyncStock(
170
+ request: BatchSyncStockRequest,
171
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
172
+
173
+ reserveStock(request: ReserveStockRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
174
+
175
+ confirmReservation(
176
+ request: ConfirmReservationRequest,
177
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
178
+
179
+ cancelReservation(
180
+ request: CancelReservationRequest,
181
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
182
+
183
+ adjustStock(
184
+ request: AdjustStockRequest,
185
+ ): Promise<WarehouseStockResponse> | Observable<WarehouseStockResponse> | WarehouseStockResponse;
186
+
187
+ getStockMovements(
188
+ request: GetStockMovementsRequest,
189
+ ): Promise<GetStockMovementsResponse> | Observable<GetStockMovementsResponse> | GetStockMovementsResponse;
190
+ }
191
+
192
+ export function StockServiceControllerMethods() {
193
+ return function (constructor: Function) {
194
+ const grpcMethods: string[] = [
195
+ "updateWarehouseStock",
196
+ "getProductStock",
197
+ "batchSyncStock",
198
+ "reserveStock",
199
+ "confirmReservation",
200
+ "cancelReservation",
201
+ "adjustStock",
202
+ "getStockMovements",
203
+ ];
204
+ for (const method of grpcMethods) {
205
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
206
+ GrpcMethod("StockService", method)(constructor.prototype[method], method, descriptor);
207
+ }
208
+ const grpcStreamMethods: string[] = [];
209
+ for (const method of grpcStreamMethods) {
210
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
211
+ GrpcStreamMethod("StockService", method)(constructor.prototype[method], method, descriptor);
212
+ }
213
+ };
214
+ }
215
+
216
+ export const STOCK_SERVICE_NAME = "StockService";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mamindom/contracts",
3
3
  "description": "proto",
4
- "version": "1.0.56",
4
+ "version": "1.0.58",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
7
7
  "exports": {
@@ -1,6 +1,7 @@
1
1
  syntax = "proto3";
2
2
 
3
3
  package catalog.v1;
4
+
4
5
  import "common.proto";
5
6
 
6
7
 
@@ -13,12 +14,21 @@ service ProductService {
13
14
  rpc UpdateProduct (UpdateProductRequest) returns (ProductDetailResponse);
14
15
  rpc DeleteProduct (DeleteProductRequest) returns (DeleteResponse);
15
16
 
16
-
17
+
17
18
  rpc BulkUpdateStatus (BulkUpdateStatusRequest) returns (SuccessResponse);
18
19
  rpc BulkUpdateCategory (BulkUpdateCategoryRequest) returns (SuccessResponse);
19
20
  rpc BulkUpdateDiscount (BulkUpdateDiscountRequest) returns (SuccessResponse);
20
21
  rpc BulkDeleteProducts (BulkDeleteProductsRequest) returns (SuccessResponse);
21
22
 
23
+
24
+ rpc BulkAssignSticker (BulkStickerRequest) returns (SuccessResponse);
25
+ rpc BulkRemoveSticker (BulkStickerRequest) returns (SuccessResponse);
26
+
27
+
28
+ rpc AssignSizeChartsToProduct (AssignSizeChartsToProductRequest) returns (SuccessResponse);
29
+ rpc RemoveSizeChartFromProduct (RemoveSizeChartFromProductRequest) returns (SuccessResponse);
30
+ rpc GetProductSizeCharts (GetProductSizeChartsRequest) returns (GetProductSizeChartsResponse);
31
+
22
32
 
23
33
  rpc CreateProductVariant (CreateProductVariantRequest) returns (ProductVariantResponse);
24
34
  rpc UpdateProductVariant (UpdateProductVariantRequest) returns (ProductVariantResponse);
@@ -31,6 +41,39 @@ service ProductService {
31
41
 
32
42
 
33
43
 
44
+ message BulkStickerRequest {
45
+ repeated string product_ids = 1;
46
+ string sticker_id = 2;
47
+ }
48
+
49
+
50
+
51
+ message AssignSizeChartsToProductRequest {
52
+ string product_id = 1;
53
+ repeated string size_chart_ids = 2;
54
+ }
55
+
56
+ message RemoveSizeChartFromProductRequest {
57
+ string product_id = 1;
58
+ string size_chart_id = 2;
59
+ }
60
+
61
+ message GetProductSizeChartsRequest {
62
+ string product_id = 1;
63
+ }
64
+
65
+ message ProductSizeChartResponse {
66
+ string id = 1;
67
+ map<string, string> name = 2;
68
+ string content = 3;
69
+ }
70
+
71
+ message GetProductSizeChartsResponse {
72
+ repeated ProductSizeChartResponse items = 1;
73
+ }
74
+
75
+
76
+
34
77
  message ProductOrderItem {
35
78
  string product_id = 1;
36
79
  int32 sort_order = 2;
@@ -72,6 +115,7 @@ message ProductListItemResponse {
72
115
 
73
116
  int32 sort_order = 12;
74
117
  int32 category_sort_order = 13;
118
+ optional string barcode = 14;
75
119
  }
76
120
 
77
121
 
@@ -109,6 +153,8 @@ message ProductDetailResponse {
109
153
  repeated ProductFileResponse files = 25;
110
154
  optional string main_image_id = 26;
111
155
  repeated ProductStickerResponse stickers = 27;
156
+ optional string barcode = 28;
157
+ repeated ProductSizeChartResponse size_charts = 29;
112
158
  }
113
159
 
114
160
 
@@ -131,6 +177,7 @@ message ProductVariantResponse {
131
177
  optional double price = 3;
132
178
  int32 stock = 4;
133
179
  map<string, string> options = 5;
180
+ optional string barcode = 6;
134
181
  }
135
182
 
136
183
  message ProductAttributeResponse {
@@ -144,6 +191,13 @@ message ProductFileResponse {
144
191
  map<string, string> name = 3;
145
192
  }
146
193
 
194
+ message ProductStickerResponse {
195
+ string id = 1;
196
+ map<string, string> name = 2;
197
+ optional string color = 3;
198
+ optional string icon = 4;
199
+ }
200
+
147
201
 
148
202
 
149
203
  message GetProductsRequest {
@@ -158,7 +212,6 @@ message GetProductsRequest {
158
212
  optional double price_min = 7;
159
213
  optional double price_max = 8;
160
214
 
161
-
162
215
  optional string sort_by = 9;
163
216
  }
164
217
 
@@ -203,6 +256,8 @@ message CreateProductRequest {
203
256
  repeated string attribute_value_ids = 19;
204
257
 
205
258
  optional int32 sort_order = 20;
259
+ optional string barcode = 21;
260
+ repeated string size_chart_ids = 22;
206
261
  }
207
262
 
208
263
  message UpdateProductRequest {
@@ -231,6 +286,7 @@ message UpdateProductRequest {
231
286
  repeated string attribute_value_ids = 18;
232
287
 
233
288
  optional int32 sort_order = 19;
289
+ optional string barcode = 20;
234
290
  }
235
291
 
236
292
  message DeleteProductRequest {
@@ -264,12 +320,6 @@ message BulkDeleteProductsRequest {
264
320
  repeated string product_ids = 1;
265
321
  }
266
322
 
267
- message ProductStickerResponse {
268
- string id = 1;
269
- map<string, string> name = 2;
270
- optional string color = 3;
271
- optional string icon = 4;
272
- }
273
323
 
274
324
  message CreateProductVariantRequest {
275
325
  string product_id = 1;
@@ -277,6 +327,7 @@ message CreateProductVariantRequest {
277
327
  optional double price = 3;
278
328
  int32 stock = 4;
279
329
  map<string, string> options = 5;
330
+ optional string barcode = 6;
280
331
  }
281
332
 
282
333
  message UpdateProductVariantRequest {
@@ -285,6 +336,7 @@ message UpdateProductVariantRequest {
285
336
  optional double price = 3;
286
337
  optional int32 stock = 4;
287
338
  map<string, string> options = 5;
339
+ optional string barcode = 6;
288
340
  }
289
341
 
290
342
  message DeleteProductVariantRequest {
@@ -0,0 +1,152 @@
1
+ syntax = "proto3";
2
+
3
+ package catalog.v1;
4
+
5
+ import "common.proto";
6
+
7
+ service StockService {
8
+
9
+ rpc UpdateWarehouseStock (UpdateWarehouseStockRequest) returns (WarehouseStockResponse);
10
+ rpc GetProductStock (GetProductStockRequest) returns (GetProductStockResponse);
11
+
12
+
13
+ rpc BatchSyncStock (BatchSyncStockRequest) returns (SuccessResponse);
14
+
15
+
16
+ rpc ReserveStock (ReserveStockRequest) returns (SuccessResponse);
17
+ rpc ConfirmReservation (ConfirmReservationRequest) returns (SuccessResponse);
18
+ rpc CancelReservation (CancelReservationRequest) returns (SuccessResponse);
19
+
20
+
21
+ rpc AdjustStock (AdjustStockRequest) returns (WarehouseStockResponse);
22
+
23
+
24
+ rpc GetStockMovements (GetStockMovementsRequest) returns (GetStockMovementsResponse);
25
+ }
26
+
27
+
28
+ enum StockMovementType {
29
+ STOCK_MOVEMENT_UNSPECIFIED = 0;
30
+ STOCK_MOVEMENT_INCOMING = 1;
31
+ STOCK_MOVEMENT_OUTGOING = 2;
32
+ STOCK_MOVEMENT_RESERVE = 3;
33
+ STOCK_MOVEMENT_UNRESERVE = 4;
34
+ STOCK_MOVEMENT_ADJUSTMENT = 5;
35
+ STOCK_MOVEMENT_RETURN = 6;
36
+ }
37
+
38
+
39
+ message WarehouseStockResponse {
40
+ string product_id = 1;
41
+ string warehouse_id = 2;
42
+ int32 quantity = 3;
43
+ int32 reserved = 4;
44
+ int32 available = 5;
45
+ }
46
+
47
+ message GetProductStockResponse {
48
+ repeated WarehouseStockDetail warehouses = 1;
49
+ int32 total_quantity = 2;
50
+ int32 total_reserved = 3;
51
+ int32 total_available = 4;
52
+ repeated VariantStockDetail variants = 5;
53
+ }
54
+
55
+ message WarehouseStockDetail {
56
+ string warehouse_id = 1;
57
+ int32 quantity = 2;
58
+ int32 reserved = 3;
59
+ int32 available = 4;
60
+ }
61
+
62
+ message VariantStockDetail {
63
+ string variant_id = 1;
64
+ string sku = 2;
65
+ optional string barcode = 3;
66
+ int32 stock = 4;
67
+ map<string, string> options = 5;
68
+ }
69
+
70
+ message StockMovementResponse {
71
+ string id = 1;
72
+ string product_id = 2;
73
+ optional string variant_id = 3;
74
+ string warehouse_id = 4;
75
+ StockMovementType type = 5;
76
+ int32 quantity = 6;
77
+ optional string reason = 7;
78
+ optional string reference_type = 8;
79
+ optional string reference_id = 9;
80
+ int32 stock_after = 10;
81
+ optional string created_by_id = 11;
82
+ string created_at = 12;
83
+ }
84
+
85
+
86
+ message UpdateWarehouseStockRequest {
87
+ string product_id = 1;
88
+ string warehouse_id = 2;
89
+ int32 quantity = 3;
90
+ optional string created_by_id = 4;
91
+ }
92
+
93
+ message GetProductStockRequest {
94
+ string product_id = 1;
95
+ }
96
+
97
+
98
+ message BatchSyncStockItem {
99
+ string product_id = 1;
100
+ string warehouse_id = 2;
101
+ int32 quantity = 3;
102
+ optional string guid_1c = 4;
103
+ }
104
+
105
+ message BatchSyncStockRequest {
106
+ repeated BatchSyncStockItem items = 1;
107
+ string sync_id = 2;
108
+ }
109
+
110
+
111
+ message ReserveStockItem {
112
+ string product_id = 1;
113
+ optional string variant_id = 2;
114
+ string warehouse_id = 3;
115
+ int32 quantity = 4;
116
+ }
117
+
118
+ message ReserveStockRequest {
119
+ string order_id = 1;
120
+ repeated ReserveStockItem items = 2;
121
+ }
122
+
123
+ message ConfirmReservationRequest {
124
+ string order_id = 1;
125
+ }
126
+
127
+ message CancelReservationRequest {
128
+ string order_id = 1;
129
+ }
130
+
131
+
132
+ message AdjustStockRequest {
133
+ string product_id = 1;
134
+ string warehouse_id = 2;
135
+ int32 delta = 3;
136
+ string reason = 4;
137
+ string created_by_id = 5;
138
+ }
139
+
140
+
141
+ message GetStockMovementsRequest {
142
+ PaginationRequest pagination = 1;
143
+ optional string product_id = 2;
144
+ optional string warehouse_id = 3;
145
+ optional string variant_id = 4;
146
+ optional string reference_type = 5;
147
+ }
148
+
149
+ message GetStockMovementsResponse {
150
+ repeated StockMovementResponse items = 1;
151
+ PaginationMeta meta = 2;
152
+ }