@floristcloud/api-lib 1.0.26 → 1.0.30
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/index.js +1 -0
- package/build/commands/integration/index.js +17 -0
- package/build/commands/integration/telegram/generate-telegram-link.command.js +17 -0
- package/build/commands/integration/telegram/get-telegram-link-status.command.js +19 -0
- package/build/commands/integration/telegram/index.js +19 -0
- package/build/commands/integration/telegram/unlink-telegram.command.js +14 -0
- package/build/commands/order/send-order-invoice.command.js +8 -1
- package/build/commands/pre-order/webshop/checkout-pre-order-webshop.command.js +4 -2
- package/build/constant/error.js +19 -0
- package/build/schemas/index.js +1 -0
- package/build/schemas/messenger-profile/index.js +17 -0
- package/build/schemas/messenger-profile/user-messenger-profile.schema.js +18 -0
- package/build/schemas/order/order.schema.js +1 -0
- package/build/schemas/user/user.schema.js +2 -0
- package/commands/index.ts +2 -0
- package/commands/integration/index.ts +2 -0
- package/commands/integration/telegram/generate-telegram-link.command.ts +16 -0
- package/commands/integration/telegram/get-telegram-link-status.command.ts +18 -0
- package/commands/integration/telegram/index.ts +3 -0
- package/commands/integration/telegram/unlink-telegram.command.ts +14 -0
- package/commands/order/send-order-invoice.command.ts +8 -1
- package/commands/pre-order/webshop/checkout-pre-order-webshop.command.ts +6 -4
- package/constant/error.ts +22 -0
- package/package.json +1 -1
- package/schemas/index.ts +1 -0
- package/schemas/messenger-profile/index.ts +1 -0
- package/schemas/messenger-profile/user-messenger-profile.schema.ts +16 -0
- package/schemas/order/order.schema.ts +1 -0
- package/schemas/user/user.schema.ts +2 -0
package/build/commands/index.js
CHANGED
|
@@ -59,3 +59,4 @@ __exportStar(require("./product-configuration/create-product-configuration.comma
|
|
|
59
59
|
__exportStar(require("./product-configuration/update-product-configuration.command"), exports);
|
|
60
60
|
__exportStar(require("./product-configuration/delete-product-configuration.command"), exports);
|
|
61
61
|
__exportStar(require("./bank-payment"), exports);
|
|
62
|
+
__exportStar(require("./integration"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./telegram"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateTelegramLinkContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const GenerateTelegramLinkResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z
|
|
8
|
+
.object({
|
|
9
|
+
link: zod_1.z.string(),
|
|
10
|
+
code: zod_1.z.string(),
|
|
11
|
+
})
|
|
12
|
+
.nullable(),
|
|
13
|
+
});
|
|
14
|
+
var GenerateTelegramLinkContractCommand;
|
|
15
|
+
(function (GenerateTelegramLinkContractCommand) {
|
|
16
|
+
GenerateTelegramLinkContractCommand.ResponseSchema = GenerateTelegramLinkResponseSchema;
|
|
17
|
+
})(GenerateTelegramLinkContractCommand || (exports.GenerateTelegramLinkContractCommand = GenerateTelegramLinkContractCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTelegramLinkStatusContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const GetTelegramLinkStatusResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z
|
|
8
|
+
.object({
|
|
9
|
+
isLinked: zod_1.z.boolean(),
|
|
10
|
+
username: zod_1.z.string().nullable(),
|
|
11
|
+
firstName: zod_1.z.string().nullable(),
|
|
12
|
+
lastName: zod_1.z.string().nullable(),
|
|
13
|
+
})
|
|
14
|
+
.nullable(),
|
|
15
|
+
});
|
|
16
|
+
var GetTelegramLinkStatusContractCommand;
|
|
17
|
+
(function (GetTelegramLinkStatusContractCommand) {
|
|
18
|
+
GetTelegramLinkStatusContractCommand.ResponseSchema = GetTelegramLinkStatusResponseSchema;
|
|
19
|
+
})(GetTelegramLinkStatusContractCommand || (exports.GetTelegramLinkStatusContractCommand = GetTelegramLinkStatusContractCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./generate-telegram-link.command"), exports);
|
|
18
|
+
__exportStar(require("./unlink-telegram.command"), exports);
|
|
19
|
+
__exportStar(require("./get-telegram-link-status.command"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnlinkTelegramContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const UnlinkTelegramResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z.object({
|
|
8
|
+
success: zod_1.z.boolean(),
|
|
9
|
+
}).nullable(),
|
|
10
|
+
});
|
|
11
|
+
var UnlinkTelegramContractCommand;
|
|
12
|
+
(function (UnlinkTelegramContractCommand) {
|
|
13
|
+
UnlinkTelegramContractCommand.ResponseSchema = UnlinkTelegramResponseSchema;
|
|
14
|
+
})(UnlinkTelegramContractCommand || (exports.UnlinkTelegramContractCommand = UnlinkTelegramContractCommand = {}));
|
|
@@ -4,7 +4,14 @@ exports.SendOrderInvoiceContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const notification_channel_enum_1 = require("../../enum/notification-channel.enum");
|
|
6
6
|
const SendOrderInvoiceRequestSchema = zod_1.z.object({
|
|
7
|
-
channel: zod_1.z
|
|
7
|
+
channel: zod_1.z
|
|
8
|
+
.enum([
|
|
9
|
+
notification_channel_enum_1.NotificationChannelEnum.WHATSAPP,
|
|
10
|
+
notification_channel_enum_1.NotificationChannelEnum.EMAIL,
|
|
11
|
+
notification_channel_enum_1.NotificationChannelEnum.MAX,
|
|
12
|
+
notification_channel_enum_1.NotificationChannelEnum.TELEGRAM_BOT,
|
|
13
|
+
])
|
|
14
|
+
.optional(),
|
|
8
15
|
});
|
|
9
16
|
const SendOrderInvoiceResponseSchema = zod_1.z.object({
|
|
10
17
|
message: zod_1.z.string().optional(),
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CheckoutPreOrderWebshopContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../../schemas");
|
|
6
|
-
const CheckoutPreOrderWebshopRequestSchema = zod_1.z
|
|
6
|
+
const CheckoutPreOrderWebshopRequestSchema = zod_1.z
|
|
7
|
+
.object({
|
|
7
8
|
comment: zod_1.z.string().nullable().optional(),
|
|
8
9
|
branchUUID: zod_1.z.string().nullable().optional(),
|
|
9
|
-
})
|
|
10
|
+
})
|
|
11
|
+
.default({});
|
|
10
12
|
const CheckoutPreOrderWebshopResponseSchema = zod_1.z.object({
|
|
11
13
|
message: zod_1.z.string().optional(),
|
|
12
14
|
data: schemas_1.PreOrderSchema,
|
package/build/constant/error.js
CHANGED
|
@@ -451,6 +451,11 @@ exports.ERRORS = {
|
|
|
451
451
|
MAX_MESSENGER_TEXT_NOT_SENT: { code: 'MX001', message: 'Failed to send text message via Max Messenger', httpCode: 500 },
|
|
452
452
|
MAX_MESSENGER_FILE_NOT_SENT: { code: 'MX002', message: 'Failed to send file message via Max Messenger', httpCode: 500 },
|
|
453
453
|
MAX_MESSENGER_MESSAGE_MISSING: { code: 'MX003', message: 'Message is missing for Max Messenger notification', httpCode: 400 },
|
|
454
|
+
// TELEGRAM BOT
|
|
455
|
+
TELEGRAM_BOT_MESSAGE_NOT_SENT: { code: 'TB001', message: 'Failed to send text message via Telegram Bot', httpCode: 500 },
|
|
456
|
+
TELEGRAM_BOT_TOKEN_MISSING: { code: 'TB002', message: 'Telegram Bot token is missing in environment variables', httpCode: 500 },
|
|
457
|
+
TELEGRAM_BOT_NAME_MISSING: { code: 'TB003', message: 'Telegram Bot Name is not configured', httpCode: 500 },
|
|
458
|
+
TELEGRAM_CHAT_ID_MISSING: { code: 'TB004', message: 'Telegram chat_id is missing and profile not linked', httpCode: 400 },
|
|
454
459
|
//PACKAGE
|
|
455
460
|
PACKAGE_NOT_CREATED: { code: 'PA001', message: 'Failed to create package', httpCode: 500 },
|
|
456
461
|
PACKAGE_NOT_DELETED: { code: 'PA002', message: 'Failed to delete package', httpCode: 500 },
|
|
@@ -760,7 +765,21 @@ exports.ERRORS = {
|
|
|
760
765
|
SECURITY_CODE_NOT_FOUND: { code: 'SC002', message: 'Security code not found', httpCode: 404 },
|
|
761
766
|
SECURITY_CODE_INVALID: { code: 'SC003', message: 'Security code is invalid', httpCode: 400 },
|
|
762
767
|
SECURITY_CODE_THROTTLED: { code: 'SC004', message: 'Security code creation too frequent', httpCode: 429 },
|
|
768
|
+
// MESSENGER PROFILE
|
|
769
|
+
MESSENGER_VERIFICATION_CODE_NOT_FOUND: { code: 'MP001', message: 'Verification code not found', httpCode: 404 },
|
|
770
|
+
MESSENGER_VERIFICATION_CODE_EXPIRED: { code: 'MP002', message: 'Verification code expired', httpCode: 400 },
|
|
771
|
+
MESSENGER_VERIFICATION_FAILED: { code: 'MP003', message: 'Failed to verify profile', httpCode: 500 },
|
|
772
|
+
MESSENGER_PROFILE_NOT_FOUND: { code: 'MP004', message: 'Profile not found', httpCode: 404 },
|
|
773
|
+
MESSENGER_PROFILE_UNLINK_FAILED: { code: 'MP005', message: 'Failed to unlink profile', httpCode: 500 },
|
|
774
|
+
MESSENGER_PROFILE_GET_FAILED: { code: 'MP006', message: 'Failed to get profile', httpCode: 500 },
|
|
775
|
+
MESSENGER_VERIFICATION_CREATION_FAILED: { code: 'MP007', message: 'Failed to create verification code', httpCode: 500 },
|
|
776
|
+
MESSENGER_PROFILE_ALREADY_LINKED: {
|
|
777
|
+
code: 'MP008',
|
|
778
|
+
message: 'Messenger account already linked to another user in this company',
|
|
779
|
+
httpCode: 409,
|
|
780
|
+
},
|
|
763
781
|
IMPORT_DATA_NOT_FOUND: { code: 'ID001', message: 'Import data not found', httpCode: 400 },
|
|
764
782
|
IMPORT_UNKNOWN_ERROR: { code: 'ID002', message: 'Unknown error', httpCode: 500 },
|
|
765
783
|
IMPORT_ITEMS_COUNT_LIMIT_EXCEEDED: { code: 'ID003', message: 'Items count limit exceeded', httpCode: 400 },
|
|
784
|
+
NOT_IMPLEMENTED: { code: 'G001', message: 'Not implemented', httpCode: 501 },
|
|
766
785
|
};
|
package/build/schemas/index.js
CHANGED
|
@@ -69,3 +69,4 @@ __exportStar(require("./message"), exports);
|
|
|
69
69
|
__exportStar(require("./product-configuration/product-configuration.schema"), exports);
|
|
70
70
|
__exportStar(require("./bank-payment"), exports);
|
|
71
71
|
__exportStar(require("./client"), exports);
|
|
72
|
+
__exportStar(require("./messenger-profile"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user-messenger-profile.schema"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserMessengerProfileSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const notification_channel_enum_1 = require("../../enum/notification-channel.enum");
|
|
6
|
+
exports.UserMessengerProfileSchema = zod_1.z.object({
|
|
7
|
+
uuid: zod_1.z.uuid(),
|
|
8
|
+
userUUID: zod_1.z.uuid(),
|
|
9
|
+
companyUUID: zod_1.z.uuid(),
|
|
10
|
+
channel: zod_1.z.nativeEnum(notification_channel_enum_1.NotificationChannelEnum),
|
|
11
|
+
externalId: zod_1.z.string(),
|
|
12
|
+
username: zod_1.z.string().nullable(),
|
|
13
|
+
firstName: zod_1.z.string().nullable(),
|
|
14
|
+
lastName: zod_1.z.string().nullable(),
|
|
15
|
+
isActive: zod_1.z.boolean(),
|
|
16
|
+
createdAt: zod_1.z.date(),
|
|
17
|
+
updatedAt: zod_1.z.date(),
|
|
18
|
+
});
|
|
@@ -49,6 +49,7 @@ exports.OrderExtendedSchema = exports.OrderSchema.extend({
|
|
|
49
49
|
delivery: order_delivery_schema_1.OrderDeliverySchema.nullable(),
|
|
50
50
|
consignmentDeliveryDates: zod_1.z.union([zod_1.z.date(), zod_1.z.literal('in-stock')]).array(),
|
|
51
51
|
deliveryRoute: delivery_route_schema_1.DeliveryRouteSchema.nullable().optional(),
|
|
52
|
+
canReceiveTelegramNotifications: zod_1.z.boolean(),
|
|
52
53
|
});
|
|
53
54
|
exports.OrderExtendedForClientSchema = exports.OrderForClientSchema.extend({
|
|
54
55
|
client: client_1.ClientSchema,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CreateUserSchema = exports.UserSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
|
+
const user_messenger_profile_schema_1 = require("../messenger-profile/user-messenger-profile.schema");
|
|
6
7
|
exports.UserSchema = zod_1.z.object({
|
|
7
8
|
uuid: zod_1.z.uuid(),
|
|
8
9
|
name: zod_1.z.string(),
|
|
@@ -17,6 +18,7 @@ exports.UserSchema = zod_1.z.object({
|
|
|
17
18
|
deletedAt: zod_1.z.date().nullable(),
|
|
18
19
|
createdAt: zod_1.z.date(),
|
|
19
20
|
updatedAt: zod_1.z.date(),
|
|
21
|
+
messengerProfiles: zod_1.z.array(user_messenger_profile_schema_1.UserMessengerProfileSchema).optional(),
|
|
20
22
|
});
|
|
21
23
|
exports.CreateUserSchema = zod_1.z.object({
|
|
22
24
|
name: zod_1.z.string(),
|
package/commands/index.ts
CHANGED
|
@@ -43,3 +43,5 @@ export * from './product-configuration/create-product-configuration.command';
|
|
|
43
43
|
export * from './product-configuration/update-product-configuration.command';
|
|
44
44
|
export * from './product-configuration/delete-product-configuration.command';
|
|
45
45
|
export * from './bank-payment';
|
|
46
|
+
export * from './integration';
|
|
47
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const GenerateTelegramLinkResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z
|
|
6
|
+
.object({
|
|
7
|
+
link: z.string(),
|
|
8
|
+
code: z.string(),
|
|
9
|
+
})
|
|
10
|
+
.nullable(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export namespace GenerateTelegramLinkContractCommand {
|
|
14
|
+
export const ResponseSchema = GenerateTelegramLinkResponseSchema;
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const GetTelegramLinkStatusResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z
|
|
6
|
+
.object({
|
|
7
|
+
isLinked: z.boolean(),
|
|
8
|
+
username: z.string().nullable(),
|
|
9
|
+
firstName: z.string().nullable(),
|
|
10
|
+
lastName: z.string().nullable(),
|
|
11
|
+
})
|
|
12
|
+
.nullable(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export namespace GetTelegramLinkStatusContractCommand {
|
|
16
|
+
export const ResponseSchema = GetTelegramLinkStatusResponseSchema;
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const UnlinkTelegramResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z.object({
|
|
6
|
+
success: z.boolean(),
|
|
7
|
+
}).nullable(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export namespace UnlinkTelegramContractCommand {
|
|
11
|
+
export const ResponseSchema = UnlinkTelegramResponseSchema;
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
14
|
+
|
|
@@ -2,7 +2,14 @@ import { z } from 'zod';
|
|
|
2
2
|
import { NotificationChannelEnum } from '../../enum/notification-channel.enum';
|
|
3
3
|
|
|
4
4
|
const SendOrderInvoiceRequestSchema = z.object({
|
|
5
|
-
channel: z
|
|
5
|
+
channel: z
|
|
6
|
+
.enum([
|
|
7
|
+
NotificationChannelEnum.WHATSAPP,
|
|
8
|
+
NotificationChannelEnum.EMAIL,
|
|
9
|
+
NotificationChannelEnum.MAX,
|
|
10
|
+
NotificationChannelEnum.TELEGRAM_BOT,
|
|
11
|
+
] as const)
|
|
12
|
+
.optional(),
|
|
6
13
|
});
|
|
7
14
|
|
|
8
15
|
const SendOrderInvoiceResponseSchema = z.object({
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PreOrderSchema } from '../../../schemas';
|
|
3
3
|
|
|
4
|
-
const CheckoutPreOrderWebshopRequestSchema = z
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const CheckoutPreOrderWebshopRequestSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
comment: z.string().nullable().optional(),
|
|
7
|
+
branchUUID: z.string().nullable().optional(),
|
|
8
|
+
})
|
|
9
|
+
.default({});
|
|
8
10
|
|
|
9
11
|
const CheckoutPreOrderWebshopResponseSchema = z.object({
|
|
10
12
|
message: z.string().optional(),
|
package/constant/error.ts
CHANGED
|
@@ -476,6 +476,12 @@ export const ERRORS = {
|
|
|
476
476
|
MAX_MESSENGER_FILE_NOT_SENT: { code: 'MX002', message: 'Failed to send file message via Max Messenger', httpCode: 500 },
|
|
477
477
|
MAX_MESSENGER_MESSAGE_MISSING: { code: 'MX003', message: 'Message is missing for Max Messenger notification', httpCode: 400 },
|
|
478
478
|
|
|
479
|
+
// TELEGRAM BOT
|
|
480
|
+
TELEGRAM_BOT_MESSAGE_NOT_SENT: { code: 'TB001', message: 'Failed to send text message via Telegram Bot', httpCode: 500 },
|
|
481
|
+
TELEGRAM_BOT_TOKEN_MISSING: { code: 'TB002', message: 'Telegram Bot token is missing in environment variables', httpCode: 500 },
|
|
482
|
+
TELEGRAM_BOT_NAME_MISSING: { code: 'TB003', message: 'Telegram Bot Name is not configured', httpCode: 500 },
|
|
483
|
+
TELEGRAM_CHAT_ID_MISSING: { code: 'TB004', message: 'Telegram chat_id is missing and profile not linked', httpCode: 400 },
|
|
484
|
+
|
|
479
485
|
//PACKAGE
|
|
480
486
|
PACKAGE_NOT_CREATED: { code: 'PA001', message: 'Failed to create package', httpCode: 500 },
|
|
481
487
|
PACKAGE_NOT_DELETED: { code: 'PA002', message: 'Failed to delete package', httpCode: 500 },
|
|
@@ -806,7 +812,23 @@ export const ERRORS = {
|
|
|
806
812
|
SECURITY_CODE_INVALID: { code: 'SC003', message: 'Security code is invalid', httpCode: 400 },
|
|
807
813
|
SECURITY_CODE_THROTTLED: { code: 'SC004', message: 'Security code creation too frequent', httpCode: 429 },
|
|
808
814
|
|
|
815
|
+
// MESSENGER PROFILE
|
|
816
|
+
MESSENGER_VERIFICATION_CODE_NOT_FOUND: { code: 'MP001', message: 'Verification code not found', httpCode: 404 },
|
|
817
|
+
MESSENGER_VERIFICATION_CODE_EXPIRED: { code: 'MP002', message: 'Verification code expired', httpCode: 400 },
|
|
818
|
+
MESSENGER_VERIFICATION_FAILED: { code: 'MP003', message: 'Failed to verify profile', httpCode: 500 },
|
|
819
|
+
MESSENGER_PROFILE_NOT_FOUND: { code: 'MP004', message: 'Profile not found', httpCode: 404 },
|
|
820
|
+
MESSENGER_PROFILE_UNLINK_FAILED: { code: 'MP005', message: 'Failed to unlink profile', httpCode: 500 },
|
|
821
|
+
MESSENGER_PROFILE_GET_FAILED: { code: 'MP006', message: 'Failed to get profile', httpCode: 500 },
|
|
822
|
+
MESSENGER_VERIFICATION_CREATION_FAILED: { code: 'MP007', message: 'Failed to create verification code', httpCode: 500 },
|
|
823
|
+
MESSENGER_PROFILE_ALREADY_LINKED: {
|
|
824
|
+
code: 'MP008',
|
|
825
|
+
message: 'Messenger account already linked to another user in this company',
|
|
826
|
+
httpCode: 409,
|
|
827
|
+
},
|
|
828
|
+
|
|
809
829
|
IMPORT_DATA_NOT_FOUND: { code: 'ID001', message: 'Import data not found', httpCode: 400 },
|
|
810
830
|
IMPORT_UNKNOWN_ERROR: { code: 'ID002', message: 'Unknown error', httpCode: 500 },
|
|
811
831
|
IMPORT_ITEMS_COUNT_LIMIT_EXCEEDED: { code: 'ID003', message: 'Items count limit exceeded', httpCode: 400 },
|
|
832
|
+
|
|
833
|
+
NOT_IMPLEMENTED: { code: 'G001', message: 'Not implemented', httpCode: 501 },
|
|
812
834
|
} as const;
|
package/package.json
CHANGED
package/schemas/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-messenger-profile.schema';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { NotificationChannelEnum } from '../../enum/notification-channel.enum';
|
|
3
|
+
|
|
4
|
+
export const UserMessengerProfileSchema = z.object({
|
|
5
|
+
uuid: z.uuid(),
|
|
6
|
+
userUUID: z.uuid(),
|
|
7
|
+
companyUUID: z.uuid(),
|
|
8
|
+
channel: z.nativeEnum(NotificationChannelEnum),
|
|
9
|
+
externalId: z.string(),
|
|
10
|
+
username: z.string().nullable(),
|
|
11
|
+
firstName: z.string().nullable(),
|
|
12
|
+
lastName: z.string().nullable(),
|
|
13
|
+
isActive: z.boolean(),
|
|
14
|
+
createdAt: z.date(),
|
|
15
|
+
updatedAt: z.date(),
|
|
16
|
+
});
|
|
@@ -55,6 +55,7 @@ export const OrderExtendedSchema = OrderSchema.extend({
|
|
|
55
55
|
delivery: OrderDeliverySchema.nullable(),
|
|
56
56
|
consignmentDeliveryDates: z.union([z.date(), z.literal('in-stock')]).array(),
|
|
57
57
|
deliveryRoute: DeliveryRouteSchema.nullable().optional(),
|
|
58
|
+
canReceiveTelegramNotifications: z.boolean(),
|
|
58
59
|
});
|
|
59
60
|
|
|
60
61
|
export const OrderExtendedForClientSchema = OrderForClientSchema.extend({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { UserRoleEnum, UserStatusEnum } from '../../enum';
|
|
3
|
+
import { UserMessengerProfileSchema } from '../messenger-profile/user-messenger-profile.schema';
|
|
3
4
|
|
|
4
5
|
export const UserSchema = z.object({
|
|
5
6
|
uuid: z.uuid(),
|
|
@@ -15,6 +16,7 @@ export const UserSchema = z.object({
|
|
|
15
16
|
deletedAt: z.date().nullable(),
|
|
16
17
|
createdAt: z.date(),
|
|
17
18
|
updatedAt: z.date(),
|
|
19
|
+
messengerProfiles: z.array(UserMessengerProfileSchema).optional(),
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
export const CreateUserSchema = z.object({
|