@floristcloud/api-lib 1.2.76 → 1.2.78

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.
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PriceValuationExecuteContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../../../schemas");
6
+ const PRICE_VALUATION_BATCH_LIMIT = 50;
7
+ const PriceValuationExecuteItemSchema = zod_1.z.object({
8
+ orderProductUUID: zod_1.z.string().uuid(),
9
+ price: zod_1.z.number().nonnegative(),
10
+ });
11
+ const PriceValuationExecuteRequestSchema = zod_1.z.object({
12
+ orderUUID: zod_1.z.string().uuid(),
13
+ items: zod_1.z.array(PriceValuationExecuteItemSchema).min(1).max(PRICE_VALUATION_BATCH_LIMIT),
14
+ });
15
+ const PriceValuationExecuteResponseSchema = zod_1.z.object({
16
+ message: zod_1.z.string().optional(),
17
+ data: zod_1.z.object({
18
+ results: zod_1.z.array(schemas_1.PriceCorrectionExecuteResultItemSchema),
19
+ successCount: zod_1.z.number(),
20
+ skippedCount: zod_1.z.number(),
21
+ }),
22
+ });
23
+ var PriceValuationExecuteContractCommand;
24
+ (function (PriceValuationExecuteContractCommand) {
25
+ PriceValuationExecuteContractCommand.RequestSchema = PriceValuationExecuteRequestSchema;
26
+ PriceValuationExecuteContractCommand.BATCH_LIMIT = PRICE_VALUATION_BATCH_LIMIT;
27
+ PriceValuationExecuteContractCommand.ResponseSchema = PriceValuationExecuteResponseSchema;
28
+ })(PriceValuationExecuteContractCommand || (exports.PriceValuationExecuteContractCommand = PriceValuationExecuteContractCommand = {}));
@@ -30,6 +30,7 @@ __exportStar(require("./group/update-group-order-product-order.command"), export
30
30
  __exportStar(require("./group/zeroing-receipt-order-product.command"), exports);
31
31
  __exportStar(require("./group/price-correction-analyze.command"), exports);
32
32
  __exportStar(require("./group/price-correction-execute.command"), exports);
33
+ __exportStar(require("./group/price-valuation-execute.command"), exports);
33
34
  //webshop
34
35
  __exportStar(require("./webshop/update-order-product-for-client.command"), exports);
35
36
  __exportStar(require("./webshop/create-order-product-for-client.command"), exports);
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetProductListContractQuery = void 0;
4
4
  const zod_1 = require("zod");
5
+ const enum_1 = require("../../enum");
5
6
  const schemas_1 = require("../../schemas");
6
7
  const GetProductListRequestSchema = zod_1.z.object({
7
8
  page: zod_1.z.coerce.number().optional().default(1),
@@ -16,6 +17,7 @@ const GetProductListRequestSchema = zod_1.z.object({
16
17
  color: zod_1.z.string().optional(),
17
18
  size: zod_1.z.string().optional(),
18
19
  deliveryDates: zod_1.z.array(zod_1.z.coerce.date()).optional(),
20
+ marks: zod_1.z.enum(enum_1.ProductMarkEnum).array().optional(),
19
21
  });
20
22
  const GetProductListResponseSchema = zod_1.z.object({
21
23
  message: zod_1.z.string().optional(),
@@ -292,6 +292,7 @@ exports.ERRORS = {
292
292
  CATEGORY_TEMPLATE_NOT_UPDATED: { code: 'CT003', message: 'Failed to update category template', httpCode: 500 },
293
293
  CATEGORY_TEMPLATE_NOT_FOUND: { code: 'CT004', message: 'Category template not found', httpCode: 404 },
294
294
  CATEGORY_TEMPLATE_FETCH_FAILED: { code: 'CT005', message: 'Error when retrieving a category template', httpCode: 500 },
295
+ CATEGORY_TEMPLATE_ALREADY_EXIST: { code: 'CT007', message: 'Category template with this name already exist', httpCode: 409 },
295
296
  CATEGORY_TEMPLATE_HAS_PRODUCT_IMAGE_TEMPLATES: {
296
297
  code: 'CT006',
297
298
  message: 'Cannot delete category template that has product image templates',
@@ -479,6 +480,21 @@ exports.ERRORS = {
479
480
  message: 'Product consignment is in draft and not available for orders',
480
481
  httpCode: 409,
481
482
  },
483
+ ORDER_PRODUCT_PRICE_VALUATION_FAILED: {
484
+ code: 'OP022',
485
+ message: 'Failed to change price for order product',
486
+ httpCode: 500,
487
+ },
488
+ ORDER_PRODUCT_PRICE_VALUATION_ORDER_STATUS_NOT_ALLOWED: {
489
+ code: 'OP023',
490
+ message: 'Order status does not allow price change',
491
+ httpCode: 400,
492
+ },
493
+ ORDER_PRODUCT_PRICE_VALUATION_NOT_FOUND: {
494
+ code: 'OP024',
495
+ message: 'Order product not found in the order',
496
+ httpCode: 404,
497
+ },
482
498
  //TRANSACTION
483
499
  TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
484
500
  TRANSACTION_FETCH_FAILED: { code: 'TR002', message: 'Error when retrieving a transaction', httpCode: 500 },
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { PriceCorrectionExecuteResultItemSchema } from '../../../schemas';
3
+
4
+ const PRICE_VALUATION_BATCH_LIMIT = 50;
5
+
6
+ const PriceValuationExecuteItemSchema = z.object({
7
+ orderProductUUID: z.string().uuid(),
8
+ price: z.number().nonnegative(),
9
+ });
10
+
11
+ const PriceValuationExecuteRequestSchema = z.object({
12
+ orderUUID: z.string().uuid(),
13
+ items: z.array(PriceValuationExecuteItemSchema).min(1).max(PRICE_VALUATION_BATCH_LIMIT),
14
+ });
15
+
16
+ const PriceValuationExecuteResponseSchema = z.object({
17
+ message: z.string().optional(),
18
+ data: z.object({
19
+ results: z.array(PriceCorrectionExecuteResultItemSchema),
20
+ successCount: z.number(),
21
+ skippedCount: z.number(),
22
+ }),
23
+ });
24
+
25
+ export namespace PriceValuationExecuteContractCommand {
26
+ export const RequestSchema = PriceValuationExecuteRequestSchema;
27
+ export type Request = z.infer<typeof RequestSchema>;
28
+
29
+ export const BATCH_LIMIT = PRICE_VALUATION_BATCH_LIMIT;
30
+
31
+ export const ResponseSchema = PriceValuationExecuteResponseSchema;
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -14,6 +14,7 @@ export * from './group/update-group-order-product-order.command';
14
14
  export * from './group/zeroing-receipt-order-product.command';
15
15
  export * from './group/price-correction-analyze.command';
16
16
  export * from './group/price-correction-execute.command';
17
+ export * from './group/price-valuation-execute.command';
17
18
  //webshop
18
19
  export * from './webshop/update-order-product-for-client.command';
19
20
  export * from './webshop/create-order-product-for-client.command';
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ProductMarkEnum } from '../../enum';
2
3
  import { ProductListSchema } from '../../schemas';
3
4
 
4
5
  const GetProductListRequestSchema = z.object({
@@ -14,6 +15,7 @@ const GetProductListRequestSchema = z.object({
14
15
  color: z.string().optional(),
15
16
  size: z.string().optional(),
16
17
  deliveryDates: z.array(z.coerce.date()).optional(),
18
+ marks: z.enum(ProductMarkEnum).array().optional(),
17
19
  });
18
20
 
19
21
  const GetProductListResponseSchema = z.object({
package/constant/error.ts CHANGED
@@ -304,6 +304,7 @@ export const ERRORS = {
304
304
  CATEGORY_TEMPLATE_NOT_UPDATED: { code: 'CT003', message: 'Failed to update category template', httpCode: 500 },
305
305
  CATEGORY_TEMPLATE_NOT_FOUND: { code: 'CT004', message: 'Category template not found', httpCode: 404 },
306
306
  CATEGORY_TEMPLATE_FETCH_FAILED: { code: 'CT005', message: 'Error when retrieving a category template', httpCode: 500 },
307
+ CATEGORY_TEMPLATE_ALREADY_EXIST: { code: 'CT007', message: 'Category template with this name already exist', httpCode: 409 },
307
308
  CATEGORY_TEMPLATE_HAS_PRODUCT_IMAGE_TEMPLATES: {
308
309
  code: 'CT006',
309
310
  message: 'Cannot delete category template that has product image templates',
@@ -497,6 +498,21 @@ export const ERRORS = {
497
498
  message: 'Product consignment is in draft and not available for orders',
498
499
  httpCode: 409,
499
500
  },
501
+ ORDER_PRODUCT_PRICE_VALUATION_FAILED: {
502
+ code: 'OP022',
503
+ message: 'Failed to change price for order product',
504
+ httpCode: 500,
505
+ },
506
+ ORDER_PRODUCT_PRICE_VALUATION_ORDER_STATUS_NOT_ALLOWED: {
507
+ code: 'OP023',
508
+ message: 'Order status does not allow price change',
509
+ httpCode: 400,
510
+ },
511
+ ORDER_PRODUCT_PRICE_VALUATION_NOT_FOUND: {
512
+ code: 'OP024',
513
+ message: 'Order product not found in the order',
514
+ httpCode: 404,
515
+ },
500
516
 
501
517
  //TRANSACTION
502
518
  TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.76",
3
+ "version": "1.2.78",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {