@floristcloud/api-lib 1.2.81 → 1.2.83
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/build/commands/discount-rules/delete-consignment-discount.command.js +14 -0
- package/build/commands/discount-rules/get-consignment-discount.query.js +17 -0
- package/build/commands/discount-rules/index.js +4 -0
- package/build/commands/discount-rules/remove-consignment-discount.command.js +26 -0
- package/build/commands/discount-rules/set-consignment-discount.command.js +29 -0
- package/build/constant/error.js +6 -0
- package/commands/discount-rules/delete-consignment-discount.command.ts +13 -0
- package/commands/discount-rules/get-consignment-discount.query.ts +17 -0
- package/commands/discount-rules/index.ts +4 -0
- package/commands/discount-rules/remove-consignment-discount.command.ts +29 -0
- package/commands/discount-rules/set-consignment-discount.command.ts +32 -0
- package/constant/error.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteConsignmentDiscountContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const DeleteConsignmentDiscountResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z.object({
|
|
8
|
+
count: zod_1.z.number(),
|
|
9
|
+
}),
|
|
10
|
+
});
|
|
11
|
+
var DeleteConsignmentDiscountContractCommand;
|
|
12
|
+
(function (DeleteConsignmentDiscountContractCommand) {
|
|
13
|
+
DeleteConsignmentDiscountContractCommand.ResponseSchema = DeleteConsignmentDiscountResponseSchema;
|
|
14
|
+
})(DeleteConsignmentDiscountContractCommand || (exports.DeleteConsignmentDiscountContractCommand = DeleteConsignmentDiscountContractCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetConsignmentDiscountContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../schemas");
|
|
6
|
+
const ConsignmentDiscountItemSchema = zod_1.z.object({ productUUID: zod_1.z.uuid() }).and(schemas_1.discountRulesModeSchema);
|
|
7
|
+
const GetConsignmentDiscountResponseSchema = zod_1.z.object({
|
|
8
|
+
message: zod_1.z.string().optional(),
|
|
9
|
+
data: zod_1.z.object({
|
|
10
|
+
productCount: zod_1.z.number(),
|
|
11
|
+
items: ConsignmentDiscountItemSchema.array(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
var GetConsignmentDiscountContractQuery;
|
|
15
|
+
(function (GetConsignmentDiscountContractQuery) {
|
|
16
|
+
GetConsignmentDiscountContractQuery.ResponseSchema = GetConsignmentDiscountResponseSchema;
|
|
17
|
+
})(GetConsignmentDiscountContractQuery || (exports.GetConsignmentDiscountContractQuery = GetConsignmentDiscountContractQuery = {}));
|
|
@@ -23,3 +23,7 @@ __exportStar(require("./get-discount-rules-extended.query"), exports);
|
|
|
23
23
|
__exportStar(require("./split-quantity-discount-rules.query"), exports);
|
|
24
24
|
__exportStar(require("./split-quantity-discount-rules-for-client.query"), exports);
|
|
25
25
|
__exportStar(require("./get-discount-rules-all.query"), exports);
|
|
26
|
+
__exportStar(require("./set-consignment-discount.command"), exports);
|
|
27
|
+
__exportStar(require("./delete-consignment-discount.command"), exports);
|
|
28
|
+
__exportStar(require("./remove-consignment-discount.command"), exports);
|
|
29
|
+
__exportStar(require("./get-consignment-discount.query"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveConsignmentDiscountContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const RemoveConsignmentDiscountBodySchema = zod_1.z
|
|
6
|
+
.object({
|
|
7
|
+
consignmentUUID: zod_1.z.uuid().optional(),
|
|
8
|
+
productUUIDs: zod_1.z.uuid().array().optional().default([]),
|
|
9
|
+
})
|
|
10
|
+
.refine(data => Boolean(data.consignmentUUID) || data.productUUIDs.length > 0, {
|
|
11
|
+
message: 'Provide consignmentUUID or a non-empty productUUIDs list',
|
|
12
|
+
});
|
|
13
|
+
const RemoveConsignmentDiscountRequestSchema = zod_1.z.object({
|
|
14
|
+
data: RemoveConsignmentDiscountBodySchema,
|
|
15
|
+
});
|
|
16
|
+
const RemoveConsignmentDiscountResponseSchema = zod_1.z.object({
|
|
17
|
+
message: zod_1.z.string().optional(),
|
|
18
|
+
data: zod_1.z.object({
|
|
19
|
+
count: zod_1.z.number(),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
var RemoveConsignmentDiscountContractCommand;
|
|
23
|
+
(function (RemoveConsignmentDiscountContractCommand) {
|
|
24
|
+
RemoveConsignmentDiscountContractCommand.RequestSchema = RemoveConsignmentDiscountRequestSchema;
|
|
25
|
+
RemoveConsignmentDiscountContractCommand.ResponseSchema = RemoveConsignmentDiscountResponseSchema;
|
|
26
|
+
})(RemoveConsignmentDiscountContractCommand || (exports.RemoveConsignmentDiscountContractCommand = RemoveConsignmentDiscountContractCommand = {}));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetConsignmentDiscountContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../schemas");
|
|
6
|
+
const SetConsignmentDiscountBodySchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
consignmentUUID: zod_1.z.uuid().optional(),
|
|
9
|
+
productUUIDs: zod_1.z.uuid().array().optional().default([]),
|
|
10
|
+
onlyInStock: zod_1.z.boolean().optional().default(false),
|
|
11
|
+
})
|
|
12
|
+
.and(schemas_1.discountRulesModeSchema)
|
|
13
|
+
.refine(data => Boolean(data.consignmentUUID) || data.productUUIDs.length > 0, {
|
|
14
|
+
message: 'Provide consignmentUUID or a non-empty productUUIDs list',
|
|
15
|
+
});
|
|
16
|
+
const SetConsignmentDiscountRequestSchema = zod_1.z.object({
|
|
17
|
+
data: SetConsignmentDiscountBodySchema,
|
|
18
|
+
});
|
|
19
|
+
const SetConsignmentDiscountResponseSchema = zod_1.z.object({
|
|
20
|
+
message: zod_1.z.string().optional(),
|
|
21
|
+
data: zod_1.z.object({
|
|
22
|
+
count: zod_1.z.number(),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
var SetConsignmentDiscountContractCommand;
|
|
26
|
+
(function (SetConsignmentDiscountContractCommand) {
|
|
27
|
+
SetConsignmentDiscountContractCommand.RequestSchema = SetConsignmentDiscountRequestSchema;
|
|
28
|
+
SetConsignmentDiscountContractCommand.ResponseSchema = SetConsignmentDiscountResponseSchema;
|
|
29
|
+
})(SetConsignmentDiscountContractCommand || (exports.SetConsignmentDiscountContractCommand = SetConsignmentDiscountContractCommand = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -953,6 +953,12 @@ exports.ERRORS = {
|
|
|
953
953
|
DISCOUNT_RULES_NOT_DELETED: { code: 'DR002', message: 'Failed to delete discount-rules', httpCode: 500 },
|
|
954
954
|
DISCOUNT_RULES_NOT_UPDATED: { code: 'DR003', message: 'Failed to update discount-rules', httpCode: 500 },
|
|
955
955
|
DISCOUNT_RULES_FETCH_FAILED: { code: 'DR004', message: 'Error when retrieving discount-rules', httpCode: 500 },
|
|
956
|
+
DISCOUNT_RULES_CONSIGNMENT_NO_PRODUCTS: { code: 'DR005', message: 'No products to apply the consignment discount to', httpCode: 400 },
|
|
957
|
+
DISCOUNT_RULES_CONSIGNMENT_LIMIT_EXCEEDED: {
|
|
958
|
+
code: 'DR006',
|
|
959
|
+
message: 'Too many products for a single consignment discount operation',
|
|
960
|
+
httpCode: 400,
|
|
961
|
+
},
|
|
956
962
|
// ACTION LOG
|
|
957
963
|
ACTION_LOG_NOT_CREATED: { code: 'ALG001', message: 'Failed to create action-log', httpCode: 500 },
|
|
958
964
|
ACTION_LOG_FETCH_FAILED: { code: 'ALG002', message: 'Error when retrieving action-log', httpCode: 500 },
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const DeleteConsignmentDiscountResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z.object({
|
|
6
|
+
count: z.number(),
|
|
7
|
+
}),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export namespace DeleteConsignmentDiscountContractCommand {
|
|
11
|
+
export const ResponseSchema = DeleteConsignmentDiscountResponseSchema;
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { discountRulesModeSchema } from '../../schemas';
|
|
3
|
+
|
|
4
|
+
const ConsignmentDiscountItemSchema = z.object({ productUUID: z.uuid() }).and(discountRulesModeSchema);
|
|
5
|
+
|
|
6
|
+
const GetConsignmentDiscountResponseSchema = z.object({
|
|
7
|
+
message: z.string().optional(),
|
|
8
|
+
data: z.object({
|
|
9
|
+
productCount: z.number(),
|
|
10
|
+
items: ConsignmentDiscountItemSchema.array(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export namespace GetConsignmentDiscountContractQuery {
|
|
15
|
+
export const ResponseSchema = GetConsignmentDiscountResponseSchema;
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -7,3 +7,7 @@ export * from './get-discount-rules-extended.query';
|
|
|
7
7
|
export * from './split-quantity-discount-rules.query';
|
|
8
8
|
export * from './split-quantity-discount-rules-for-client.query';
|
|
9
9
|
export * from './get-discount-rules-all.query';
|
|
10
|
+
export * from './set-consignment-discount.command';
|
|
11
|
+
export * from './delete-consignment-discount.command';
|
|
12
|
+
export * from './remove-consignment-discount.command';
|
|
13
|
+
export * from './get-consignment-discount.query';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const RemoveConsignmentDiscountBodySchema = z
|
|
4
|
+
.object({
|
|
5
|
+
consignmentUUID: z.uuid().optional(),
|
|
6
|
+
productUUIDs: z.uuid().array().optional().default([]),
|
|
7
|
+
})
|
|
8
|
+
.refine(data => Boolean(data.consignmentUUID) || data.productUUIDs.length > 0, {
|
|
9
|
+
message: 'Provide consignmentUUID or a non-empty productUUIDs list',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const RemoveConsignmentDiscountRequestSchema = z.object({
|
|
13
|
+
data: RemoveConsignmentDiscountBodySchema,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const RemoveConsignmentDiscountResponseSchema = z.object({
|
|
17
|
+
message: z.string().optional(),
|
|
18
|
+
data: z.object({
|
|
19
|
+
count: z.number(),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export namespace RemoveConsignmentDiscountContractCommand {
|
|
24
|
+
export const RequestSchema = RemoveConsignmentDiscountRequestSchema;
|
|
25
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
26
|
+
|
|
27
|
+
export const ResponseSchema = RemoveConsignmentDiscountResponseSchema;
|
|
28
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { discountRulesModeSchema } from '../../schemas';
|
|
3
|
+
|
|
4
|
+
const SetConsignmentDiscountBodySchema = z
|
|
5
|
+
.object({
|
|
6
|
+
consignmentUUID: z.uuid().optional(),
|
|
7
|
+
productUUIDs: z.uuid().array().optional().default([]),
|
|
8
|
+
onlyInStock: z.boolean().optional().default(false),
|
|
9
|
+
})
|
|
10
|
+
.and(discountRulesModeSchema)
|
|
11
|
+
.refine(data => Boolean(data.consignmentUUID) || data.productUUIDs.length > 0, {
|
|
12
|
+
message: 'Provide consignmentUUID or a non-empty productUUIDs list',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const SetConsignmentDiscountRequestSchema = z.object({
|
|
16
|
+
data: SetConsignmentDiscountBodySchema,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const SetConsignmentDiscountResponseSchema = z.object({
|
|
20
|
+
message: z.string().optional(),
|
|
21
|
+
data: z.object({
|
|
22
|
+
count: z.number(),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export namespace SetConsignmentDiscountContractCommand {
|
|
27
|
+
export const RequestSchema = SetConsignmentDiscountRequestSchema;
|
|
28
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
29
|
+
|
|
30
|
+
export const ResponseSchema = SetConsignmentDiscountResponseSchema;
|
|
31
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
32
|
+
}
|
package/constant/error.ts
CHANGED
|
@@ -994,6 +994,12 @@ export const ERRORS = {
|
|
|
994
994
|
DISCOUNT_RULES_NOT_DELETED: { code: 'DR002', message: 'Failed to delete discount-rules', httpCode: 500 },
|
|
995
995
|
DISCOUNT_RULES_NOT_UPDATED: { code: 'DR003', message: 'Failed to update discount-rules', httpCode: 500 },
|
|
996
996
|
DISCOUNT_RULES_FETCH_FAILED: { code: 'DR004', message: 'Error when retrieving discount-rules', httpCode: 500 },
|
|
997
|
+
DISCOUNT_RULES_CONSIGNMENT_NO_PRODUCTS: { code: 'DR005', message: 'No products to apply the consignment discount to', httpCode: 400 },
|
|
998
|
+
DISCOUNT_RULES_CONSIGNMENT_LIMIT_EXCEEDED: {
|
|
999
|
+
code: 'DR006',
|
|
1000
|
+
message: 'Too many products for a single consignment discount operation',
|
|
1001
|
+
httpCode: 400,
|
|
1002
|
+
},
|
|
997
1003
|
|
|
998
1004
|
// ACTION LOG
|
|
999
1005
|
ACTION_LOG_NOT_CREATED: { code: 'ALG001', message: 'Failed to create action-log', httpCode: 500 },
|