@floristcloud/api-lib 1.0.27 → 1.0.31

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.
Files changed (27) hide show
  1. package/build/commands/index.js +1 -0
  2. package/build/commands/integration/index.js +17 -0
  3. package/build/commands/integration/telegram/generate-telegram-link.command.js +17 -0
  4. package/build/commands/integration/telegram/get-telegram-link-status.command.js +19 -0
  5. package/build/commands/integration/telegram/index.js +19 -0
  6. package/build/commands/integration/telegram/unlink-telegram.command.js +14 -0
  7. package/build/commands/order/send-order-invoice.command.js +8 -1
  8. package/build/constant/error.js +20 -0
  9. package/build/schemas/index.js +1 -0
  10. package/build/schemas/messenger-profile/index.js +17 -0
  11. package/build/schemas/messenger-profile/user-messenger-profile.schema.js +18 -0
  12. package/build/schemas/order/order.schema.js +1 -0
  13. package/build/schemas/user/user.schema.js +2 -0
  14. package/commands/index.ts +2 -0
  15. package/commands/integration/index.ts +2 -0
  16. package/commands/integration/telegram/generate-telegram-link.command.ts +16 -0
  17. package/commands/integration/telegram/get-telegram-link-status.command.ts +18 -0
  18. package/commands/integration/telegram/index.ts +3 -0
  19. package/commands/integration/telegram/unlink-telegram.command.ts +14 -0
  20. package/commands/order/send-order-invoice.command.ts +8 -1
  21. package/constant/error.ts +23 -0
  22. package/package.json +1 -1
  23. package/schemas/index.ts +1 -0
  24. package/schemas/messenger-profile/index.ts +1 -0
  25. package/schemas/messenger-profile/user-messenger-profile.schema.ts +16 -0
  26. package/schemas/order/order.schema.ts +1 -0
  27. package/schemas/user/user.schema.ts +2 -0
@@ -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.enum([notification_channel_enum_1.NotificationChannelEnum.WHATSAPP, notification_channel_enum_1.NotificationChannelEnum.EMAIL, notification_channel_enum_1.NotificationChannelEnum.MAX]).optional(),
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(),
@@ -109,6 +109,7 @@ exports.ERRORS = {
109
109
  INCORRECT_CREDENTIALS: { code: 'A002', message: 'Invalid email or password', httpCode: 400 },
110
110
  ALREADY_REGISTERED: { code: 'A001', message: 'User already exists', httpCode: 409 },
111
111
  INVALID_USER_TYPE: { code: 'A018', message: 'Invalid user type', httpCode: 400 },
112
+ TOO_MANY_REQUESTS: { code: 'A019', message: 'Too many requests', httpCode: 429 },
112
113
  //DOMAIN
113
114
  DOMAIN_LIST_FETCH_FAILED: { code: 'D001', message: 'Error when retrieving a domain list', httpCode: 500 },
114
115
  DOMAIN_FETCH_FAILED: { code: 'D002', message: 'Error when retrieving a domain', httpCode: 500 },
@@ -451,6 +452,11 @@ exports.ERRORS = {
451
452
  MAX_MESSENGER_TEXT_NOT_SENT: { code: 'MX001', message: 'Failed to send text message via Max Messenger', httpCode: 500 },
452
453
  MAX_MESSENGER_FILE_NOT_SENT: { code: 'MX002', message: 'Failed to send file message via Max Messenger', httpCode: 500 },
453
454
  MAX_MESSENGER_MESSAGE_MISSING: { code: 'MX003', message: 'Message is missing for Max Messenger notification', httpCode: 400 },
455
+ // TELEGRAM BOT
456
+ TELEGRAM_BOT_MESSAGE_NOT_SENT: { code: 'TB001', message: 'Failed to send text message via Telegram Bot', httpCode: 500 },
457
+ TELEGRAM_BOT_TOKEN_MISSING: { code: 'TB002', message: 'Telegram Bot token is missing in environment variables', httpCode: 500 },
458
+ TELEGRAM_BOT_NAME_MISSING: { code: 'TB003', message: 'Telegram Bot Name is not configured', httpCode: 500 },
459
+ TELEGRAM_CHAT_ID_MISSING: { code: 'TB004', message: 'Telegram chat_id is missing and profile not linked', httpCode: 400 },
454
460
  //PACKAGE
455
461
  PACKAGE_NOT_CREATED: { code: 'PA001', message: 'Failed to create package', httpCode: 500 },
456
462
  PACKAGE_NOT_DELETED: { code: 'PA002', message: 'Failed to delete package', httpCode: 500 },
@@ -760,7 +766,21 @@ exports.ERRORS = {
760
766
  SECURITY_CODE_NOT_FOUND: { code: 'SC002', message: 'Security code not found', httpCode: 404 },
761
767
  SECURITY_CODE_INVALID: { code: 'SC003', message: 'Security code is invalid', httpCode: 400 },
762
768
  SECURITY_CODE_THROTTLED: { code: 'SC004', message: 'Security code creation too frequent', httpCode: 429 },
769
+ // MESSENGER PROFILE
770
+ MESSENGER_VERIFICATION_CODE_NOT_FOUND: { code: 'MP001', message: 'Verification code not found', httpCode: 404 },
771
+ MESSENGER_VERIFICATION_CODE_EXPIRED: { code: 'MP002', message: 'Verification code expired', httpCode: 400 },
772
+ MESSENGER_VERIFICATION_FAILED: { code: 'MP003', message: 'Failed to verify profile', httpCode: 500 },
773
+ MESSENGER_PROFILE_NOT_FOUND: { code: 'MP004', message: 'Profile not found', httpCode: 404 },
774
+ MESSENGER_PROFILE_UNLINK_FAILED: { code: 'MP005', message: 'Failed to unlink profile', httpCode: 500 },
775
+ MESSENGER_PROFILE_GET_FAILED: { code: 'MP006', message: 'Failed to get profile', httpCode: 500 },
776
+ MESSENGER_VERIFICATION_CREATION_FAILED: { code: 'MP007', message: 'Failed to create verification code', httpCode: 500 },
777
+ MESSENGER_PROFILE_ALREADY_LINKED: {
778
+ code: 'MP008',
779
+ message: 'Messenger account already linked to another user in this company',
780
+ httpCode: 409,
781
+ },
763
782
  IMPORT_DATA_NOT_FOUND: { code: 'ID001', message: 'Import data not found', httpCode: 400 },
764
783
  IMPORT_UNKNOWN_ERROR: { code: 'ID002', message: 'Unknown error', httpCode: 500 },
765
784
  IMPORT_ITEMS_COUNT_LIMIT_EXCEEDED: { code: 'ID003', message: 'Items count limit exceeded', httpCode: 400 },
785
+ NOT_IMPLEMENTED: { code: 'G001', message: 'Not implemented', httpCode: 501 },
766
786
  };
@@ -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,2 @@
1
+ export * from './telegram';
2
+
@@ -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,3 @@
1
+ export * from './generate-telegram-link.command';
2
+ export * from './unlink-telegram.command';
3
+ export * from './get-telegram-link-status.command';
@@ -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.enum([NotificationChannelEnum.WHATSAPP, NotificationChannelEnum.EMAIL, NotificationChannelEnum.MAX] as const).optional(),
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({
package/constant/error.ts CHANGED
@@ -113,6 +113,7 @@ export const ERRORS = {
113
113
  INCORRECT_CREDENTIALS: { code: 'A002', message: 'Invalid email or password', httpCode: 400 },
114
114
  ALREADY_REGISTERED: { code: 'A001', message: 'User already exists', httpCode: 409 },
115
115
  INVALID_USER_TYPE: { code: 'A018', message: 'Invalid user type', httpCode: 400 },
116
+ TOO_MANY_REQUESTS: { code: 'A019', message: 'Too many requests', httpCode: 429 },
116
117
 
117
118
  //DOMAIN
118
119
  DOMAIN_LIST_FETCH_FAILED: { code: 'D001', message: 'Error when retrieving a domain list', httpCode: 500 },
@@ -476,6 +477,12 @@ export const ERRORS = {
476
477
  MAX_MESSENGER_FILE_NOT_SENT: { code: 'MX002', message: 'Failed to send file message via Max Messenger', httpCode: 500 },
477
478
  MAX_MESSENGER_MESSAGE_MISSING: { code: 'MX003', message: 'Message is missing for Max Messenger notification', httpCode: 400 },
478
479
 
480
+ // TELEGRAM BOT
481
+ TELEGRAM_BOT_MESSAGE_NOT_SENT: { code: 'TB001', message: 'Failed to send text message via Telegram Bot', httpCode: 500 },
482
+ TELEGRAM_BOT_TOKEN_MISSING: { code: 'TB002', message: 'Telegram Bot token is missing in environment variables', httpCode: 500 },
483
+ TELEGRAM_BOT_NAME_MISSING: { code: 'TB003', message: 'Telegram Bot Name is not configured', httpCode: 500 },
484
+ TELEGRAM_CHAT_ID_MISSING: { code: 'TB004', message: 'Telegram chat_id is missing and profile not linked', httpCode: 400 },
485
+
479
486
  //PACKAGE
480
487
  PACKAGE_NOT_CREATED: { code: 'PA001', message: 'Failed to create package', httpCode: 500 },
481
488
  PACKAGE_NOT_DELETED: { code: 'PA002', message: 'Failed to delete package', httpCode: 500 },
@@ -806,7 +813,23 @@ export const ERRORS = {
806
813
  SECURITY_CODE_INVALID: { code: 'SC003', message: 'Security code is invalid', httpCode: 400 },
807
814
  SECURITY_CODE_THROTTLED: { code: 'SC004', message: 'Security code creation too frequent', httpCode: 429 },
808
815
 
816
+ // MESSENGER PROFILE
817
+ MESSENGER_VERIFICATION_CODE_NOT_FOUND: { code: 'MP001', message: 'Verification code not found', httpCode: 404 },
818
+ MESSENGER_VERIFICATION_CODE_EXPIRED: { code: 'MP002', message: 'Verification code expired', httpCode: 400 },
819
+ MESSENGER_VERIFICATION_FAILED: { code: 'MP003', message: 'Failed to verify profile', httpCode: 500 },
820
+ MESSENGER_PROFILE_NOT_FOUND: { code: 'MP004', message: 'Profile not found', httpCode: 404 },
821
+ MESSENGER_PROFILE_UNLINK_FAILED: { code: 'MP005', message: 'Failed to unlink profile', httpCode: 500 },
822
+ MESSENGER_PROFILE_GET_FAILED: { code: 'MP006', message: 'Failed to get profile', httpCode: 500 },
823
+ MESSENGER_VERIFICATION_CREATION_FAILED: { code: 'MP007', message: 'Failed to create verification code', httpCode: 500 },
824
+ MESSENGER_PROFILE_ALREADY_LINKED: {
825
+ code: 'MP008',
826
+ message: 'Messenger account already linked to another user in this company',
827
+ httpCode: 409,
828
+ },
829
+
809
830
  IMPORT_DATA_NOT_FOUND: { code: 'ID001', message: 'Import data not found', httpCode: 400 },
810
831
  IMPORT_UNKNOWN_ERROR: { code: 'ID002', message: 'Unknown error', httpCode: 500 },
811
832
  IMPORT_ITEMS_COUNT_LIMIT_EXCEEDED: { code: 'ID003', message: 'Items count limit exceeded', httpCode: 400 },
833
+
834
+ NOT_IMPLEMENTED: { code: 'G001', message: 'Not implemented', httpCode: 501 },
812
835
  } as const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.0.27",
3
+ "version": "1.0.31",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
package/schemas/index.ts CHANGED
@@ -53,3 +53,4 @@ export * from './message';
53
53
  export * from './product-configuration/product-configuration.schema';
54
54
  export * from './bank-payment';
55
55
  export * from './client';
56
+ export * from './messenger-profile';
@@ -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({