@floristcloud/api-lib 1.0.51 → 1.0.54
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/product-configuration/find-product-configuration-by-attributes.query.js +1 -1
- package/build/commands/user/get-user-list-s2s.query.js +13 -0
- package/build/commands/user/index.js +1 -0
- package/build/commands/write-off/create-write-off-from-pending.command.js +12 -2
- package/build/commands/write-off/update-write-off-status.command.js +12 -2
- package/build/enum/notification-type.enum.js +1 -0
- package/build/schemas/pre-order-product/pre-order-product.schema.js +2 -0
- package/build/schemas/write-off/write-off.schema.js +1 -0
- package/commands/product-configuration/find-product-configuration-by-attributes.query.ts +1 -1
- package/commands/user/get-user-list-s2s.query.ts +14 -0
- package/commands/user/index.ts +1 -0
- package/commands/write-off/create-write-off-from-pending.command.ts +18 -5
- package/commands/write-off/update-write-off-status.command.ts +17 -4
- package/enum/notification-type.enum.ts +1 -0
- package/package.json +1 -1
- package/schemas/pre-order-product/pre-order-product.schema.ts +2 -0
- package/schemas/write-off/write-off.schema.ts +1 -0
package/build/commands/product-configuration/find-product-configuration-by-attributes.query.js
CHANGED
|
@@ -10,7 +10,7 @@ const FindProductConfigurationByAttributesRequestSchema = zod_1.z.object({
|
|
|
10
10
|
size: zod_1.z.coerce.number().optional().nullable(),
|
|
11
11
|
});
|
|
12
12
|
const FindProductConfigurationByAttributesDataSchema = zod_1.z.object({
|
|
13
|
-
|
|
13
|
+
mainConfigurations: schemas_1.ProductConfigurationSchema.array(),
|
|
14
14
|
optionalConfigurations: schemas_1.ProductConfigurationSchema.array(),
|
|
15
15
|
});
|
|
16
16
|
const FindProductConfigurationByAttributesResponseSchema = zod_1.z.object({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUserListS2SContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const get_user_list_query_1 = require("./get-user-list.query");
|
|
6
|
+
const GetUserListS2SRequestSchema = get_user_list_query_1.GetUserListContractQuery.RequestSchema.extend({
|
|
7
|
+
companyUUID: zod_1.z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
var GetUserListS2SContractQuery;
|
|
10
|
+
(function (GetUserListS2SContractQuery) {
|
|
11
|
+
GetUserListS2SContractQuery.RequestSchema = GetUserListS2SRequestSchema;
|
|
12
|
+
GetUserListS2SContractQuery.ResponseSchema = get_user_list_query_1.GetUserListContractQuery.ResponseSchema;
|
|
13
|
+
})(GetUserListS2SContractQuery || (exports.GetUserListS2SContractQuery = GetUserListS2SContractQuery = {}));
|
|
@@ -21,6 +21,7 @@ __exportStar(require("./updateRole.command"), exports);
|
|
|
21
21
|
__exportStar(require("./getUser.command"), exports);
|
|
22
22
|
__exportStar(require("./createUserForCompany.command"), exports);
|
|
23
23
|
__exportStar(require("./get-user-list.query"), exports);
|
|
24
|
+
__exportStar(require("./get-user-list-s2s.query"), exports);
|
|
24
25
|
__exportStar(require("./update-password-by-user.command"), exports);
|
|
25
26
|
__exportStar(require("./update-user.command"), exports);
|
|
26
27
|
__exportStar(require("./generate-and-send-password-by-admin.command"), exports);
|
|
@@ -4,10 +4,20 @@ exports.CreateWriteOffFromPendingContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../schemas");
|
|
6
6
|
const enum_1 = require("../../enum");
|
|
7
|
-
const CreateWriteOffFromPendingRequestSchema = zod_1.z
|
|
7
|
+
const CreateWriteOffFromPendingRequestSchema = zod_1.z
|
|
8
|
+
.object({
|
|
8
9
|
quantity: zod_1.z.number().min(1),
|
|
9
|
-
comment: zod_1.z.string().nullable(),
|
|
10
10
|
status: zod_1.z.union([zod_1.z.literal(enum_1.WriteOffStatusEnum.APPROVED), zod_1.z.literal(enum_1.WriteOffStatusEnum.REJECTED)]),
|
|
11
|
+
rejectionReason: zod_1.z.string().optional(),
|
|
12
|
+
})
|
|
13
|
+
.refine(data => {
|
|
14
|
+
if (data.status === enum_1.WriteOffStatusEnum.REJECTED) {
|
|
15
|
+
return data.rejectionReason && data.rejectionReason.trim().length > 0;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}, {
|
|
19
|
+
message: 'rejectionReason is required when status is REJECTED',
|
|
20
|
+
path: ['rejectionReason'],
|
|
11
21
|
});
|
|
12
22
|
const CreateWriteOffFromPendingResponseSchema = zod_1.z.object({
|
|
13
23
|
message: zod_1.z.string().optional(),
|
|
@@ -4,9 +4,19 @@ exports.UpdateWriteOffStatusContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../schemas");
|
|
6
6
|
const enum_1 = require("../../enum");
|
|
7
|
-
const UpdateWriteOffStatusRequestSchema = zod_1.z
|
|
7
|
+
const UpdateWriteOffStatusRequestSchema = zod_1.z
|
|
8
|
+
.object({
|
|
8
9
|
status: zod_1.z.union([zod_1.z.literal(enum_1.WriteOffStatusEnum.APPROVED), zod_1.z.literal(enum_1.WriteOffStatusEnum.REJECTED)]),
|
|
9
|
-
|
|
10
|
+
rejectionReason: zod_1.z.string().optional(),
|
|
11
|
+
})
|
|
12
|
+
.refine(data => {
|
|
13
|
+
if (data.status === enum_1.WriteOffStatusEnum.REJECTED) {
|
|
14
|
+
return data.rejectionReason && data.rejectionReason.trim().length > 0;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}, {
|
|
18
|
+
message: 'rejectionReason is required when status is REJECTED',
|
|
19
|
+
path: ['rejectionReason'],
|
|
10
20
|
});
|
|
11
21
|
const UpdateWriteOffStatusResponseSchema = zod_1.z.object({
|
|
12
22
|
message: zod_1.z.string().optional(),
|
|
@@ -7,4 +7,5 @@ var NotificationTypeEnum;
|
|
|
7
7
|
NotificationTypeEnum["ORDER_STATUS"] = "ORDER_STATUS";
|
|
8
8
|
NotificationTypeEnum["ORDER_INVOICE"] = "ORDER_INVOICE";
|
|
9
9
|
NotificationTypeEnum["CART_EXPIRATION"] = "CART_EXPIRATION";
|
|
10
|
+
NotificationTypeEnum["WRITE_OFF_REJECTED"] = "WRITE_OFF_REJECTED";
|
|
10
11
|
})(NotificationTypeEnum || (exports.NotificationTypeEnum = NotificationTypeEnum = {}));
|
|
@@ -4,6 +4,7 @@ exports.preOrderProductExtendedListSchema = exports.PreOrderProductListSchema =
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const pre_order_collection_item_schema_1 = require("../pre-order-collection-item/pre-order-collection-item.schema");
|
|
6
6
|
const category_schema_1 = require("../category/category.schema");
|
|
7
|
+
const pre_order_collection_item_multiplicity_option_schema_1 = require("../pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema");
|
|
7
8
|
exports.MatchingConfigSchema = zod_1.z.object({
|
|
8
9
|
matchByName: zod_1.z.coerce.boolean(),
|
|
9
10
|
matchByCategory: zod_1.z.coerce.boolean(),
|
|
@@ -36,6 +37,7 @@ exports.PreOrderProductExtendedSchema = exports.PreOrderProductSchema.extend({
|
|
|
36
37
|
preOrderCollectionItem: pre_order_collection_item_schema_1.PreOrderCollectionItemExtendedSchema,
|
|
37
38
|
category: category_schema_1.CategorySchema.nullable(),
|
|
38
39
|
deliveryDate: zod_1.z.coerce.date().nullable(),
|
|
40
|
+
multiplicityOption: pre_order_collection_item_multiplicity_option_schema_1.PreOrderCollectionItemMultiplicityOptionSchema.nullable().optional(),
|
|
39
41
|
});
|
|
40
42
|
exports.CreatePreOrderProductSchema = exports.PreOrderProductSchema.omit({ uuid: true, preOrderUUID: true }).extend({
|
|
41
43
|
multiplicityOptionUUID: zod_1.z.uuid().nullable().optional(),
|
|
@@ -13,6 +13,7 @@ exports.WriteOffSchema = zod_1.z.object({
|
|
|
13
13
|
quantity: zod_1.z.number(),
|
|
14
14
|
reason: zod_1.z.string(),
|
|
15
15
|
comment: zod_1.z.string().nullable(),
|
|
16
|
+
rejectionReason: zod_1.z.string().nullable(),
|
|
16
17
|
productUUID: zod_1.z.string(),
|
|
17
18
|
categoryUUID: zod_1.z.string().nullable(),
|
|
18
19
|
consignmentUUID: zod_1.z.string(),
|
|
@@ -9,7 +9,7 @@ const FindProductConfigurationByAttributesRequestSchema = z.object({
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const FindProductConfigurationByAttributesDataSchema = z.object({
|
|
12
|
-
|
|
12
|
+
mainConfigurations: ProductConfigurationSchema.array(),
|
|
13
13
|
optionalConfigurations: ProductConfigurationSchema.array(),
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GetUserListContractQuery } from './get-user-list.query';
|
|
3
|
+
|
|
4
|
+
const GetUserListS2SRequestSchema = GetUserListContractQuery.RequestSchema.extend({
|
|
5
|
+
companyUUID: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export namespace GetUserListS2SContractQuery {
|
|
9
|
+
export const RequestSchema = GetUserListS2SRequestSchema;
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = GetUserListContractQuery.ResponseSchema;
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
package/commands/user/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './updateRole.command';
|
|
|
5
5
|
export * from './getUser.command';
|
|
6
6
|
export * from './createUserForCompany.command';
|
|
7
7
|
export * from './get-user-list.query';
|
|
8
|
+
export * from './get-user-list-s2s.query';
|
|
8
9
|
export * from './update-password-by-user.command';
|
|
9
10
|
export * from './update-user.command';
|
|
10
11
|
export * from './generate-and-send-password-by-admin.command';
|
|
@@ -2,11 +2,24 @@ import { z } from 'zod';
|
|
|
2
2
|
import { WriteOffSchema } from '../../schemas';
|
|
3
3
|
import { WriteOffStatusEnum } from '../../enum';
|
|
4
4
|
|
|
5
|
-
const CreateWriteOffFromPendingRequestSchema = z
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const CreateWriteOffFromPendingRequestSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
quantity: z.number().min(1),
|
|
8
|
+
status: z.union([z.literal(WriteOffStatusEnum.APPROVED), z.literal(WriteOffStatusEnum.REJECTED)]),
|
|
9
|
+
rejectionReason: z.string().optional(),
|
|
10
|
+
})
|
|
11
|
+
.refine(
|
|
12
|
+
data => {
|
|
13
|
+
if (data.status === WriteOffStatusEnum.REJECTED) {
|
|
14
|
+
return data.rejectionReason && data.rejectionReason.trim().length > 0;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
message: 'rejectionReason is required when status is REJECTED',
|
|
20
|
+
path: ['rejectionReason'],
|
|
21
|
+
},
|
|
22
|
+
);
|
|
10
23
|
|
|
11
24
|
const CreateWriteOffFromPendingResponseSchema = z.object({
|
|
12
25
|
message: z.string().optional(),
|
|
@@ -2,10 +2,23 @@ import { z } from 'zod';
|
|
|
2
2
|
import { WriteOffSchema } from '../../schemas';
|
|
3
3
|
import { WriteOffStatusEnum } from '../../enum';
|
|
4
4
|
|
|
5
|
-
const UpdateWriteOffStatusRequestSchema = z
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const UpdateWriteOffStatusRequestSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
status: z.union([z.literal(WriteOffStatusEnum.APPROVED), z.literal(WriteOffStatusEnum.REJECTED)]),
|
|
8
|
+
rejectionReason: z.string().optional(),
|
|
9
|
+
})
|
|
10
|
+
.refine(
|
|
11
|
+
data => {
|
|
12
|
+
if (data.status === WriteOffStatusEnum.REJECTED) {
|
|
13
|
+
return data.rejectionReason && data.rejectionReason.trim().length > 0;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
message: 'rejectionReason is required when status is REJECTED',
|
|
19
|
+
path: ['rejectionReason'],
|
|
20
|
+
},
|
|
21
|
+
);
|
|
9
22
|
|
|
10
23
|
const UpdateWriteOffStatusResponseSchema = z.object({
|
|
11
24
|
message: z.string().optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PreOrderCollectionItemExtendedSchema } from '../pre-order-collection-item/pre-order-collection-item.schema';
|
|
3
3
|
import { CategorySchema } from '../category/category.schema';
|
|
4
|
+
import { PreOrderCollectionItemMultiplicityOptionSchema } from '../pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema';
|
|
4
5
|
|
|
5
6
|
export const MatchingConfigSchema = z.object({
|
|
6
7
|
matchByName: z.coerce.boolean(),
|
|
@@ -36,6 +37,7 @@ export const PreOrderProductExtendedSchema = PreOrderProductSchema.extend({
|
|
|
36
37
|
preOrderCollectionItem: PreOrderCollectionItemExtendedSchema,
|
|
37
38
|
category: CategorySchema.nullable(),
|
|
38
39
|
deliveryDate: z.coerce.date().nullable(),
|
|
40
|
+
multiplicityOption: PreOrderCollectionItemMultiplicityOptionSchema.nullable().optional(),
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
export const CreatePreOrderProductSchema = PreOrderProductSchema.omit({ uuid: true, preOrderUUID: true }).extend({
|
|
@@ -11,6 +11,7 @@ export const WriteOffSchema = z.object({
|
|
|
11
11
|
quantity: z.number(),
|
|
12
12
|
reason: z.string(),
|
|
13
13
|
comment: z.string().nullable(),
|
|
14
|
+
rejectionReason: z.string().nullable(),
|
|
14
15
|
productUUID: z.string(),
|
|
15
16
|
categoryUUID: z.string().nullable(),
|
|
16
17
|
consignmentUUID: z.string(),
|