@purpleschool/gptbot 0.5.7 → 0.5.13

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 (93) hide show
  1. package/api/controllers/auth.ts +1 -0
  2. package/api/controllers/index.ts +1 -0
  3. package/api/controllers/payment.ts +5 -0
  4. package/api/controllers/subscription.ts +3 -0
  5. package/build/api/controllers/auth.js +1 -0
  6. package/build/api/controllers/index.js +1 -0
  7. package/build/api/controllers/payment.js +7 -0
  8. package/build/api/controllers/subscription.js +3 -0
  9. package/build/commands/auth/index.js +1 -1
  10. package/build/commands/auth/{reset-paasword.command.js → reset-password.command.js} +1 -5
  11. package/build/commands/auth/verify-email-retry.command.js +9 -0
  12. package/build/commands/auth/verify-email.command.js +1 -5
  13. package/build/commands/blog/delete-post.command.js +1 -3
  14. package/build/commands/category/delete-category.command.js +1 -3
  15. package/build/commands/chat/archive-all.command.js +1 -5
  16. package/build/commands/chat/delete-chat.command.js +1 -3
  17. package/build/commands/chat/delete-chat.command.v2.js +1 -3
  18. package/build/commands/index.js +1 -0
  19. package/build/commands/page/delete-page.command.js +1 -3
  20. package/build/commands/payment/get-payment-history.command.js +11 -0
  21. package/build/commands/payment/index.js +18 -0
  22. package/build/commands/product/delete-product.command.js +1 -3
  23. package/build/commands/subscription/cancel-subscription.command.js +1 -3
  24. package/build/commands/subscription/create-custom-subscription-plan.command.js +24 -0
  25. package/build/commands/subscription/find-subscription.command.js +1 -1
  26. package/build/commands/subscription/get-available-upgrades.command.js +13 -0
  27. package/build/commands/subscription/index.js +3 -0
  28. package/build/commands/subscription/recover-subscription.command.js +1 -3
  29. package/build/commands/subscription/upgrade-subscription.command.js +41 -0
  30. package/build/constants/email/subjects.js +10 -0
  31. package/build/constants/errors/errors.js +45 -0
  32. package/build/constants/order/enums/index.js +1 -0
  33. package/build/constants/order/enums/order-type.enum.js +8 -0
  34. package/build/constants/payment/enums/index.js +1 -0
  35. package/build/constants/payment/enums/payment-history-item-type.enum.js +8 -0
  36. package/build/constants/subscription/enums/index.js +4 -0
  37. package/build/constants/subscription/enums/subscription-action.enum.js +10 -0
  38. package/build/constants/subscription/enums/subscription-plan.enum.js +8 -0
  39. package/build/constants/subscription/enums/subscription-status.enum.js +1 -0
  40. package/build/constants/subscription/enums/subscription-type.enum.js +8 -0
  41. package/build/constants/subscription/enums/user-to-subscription-type.enum.js +8 -0
  42. package/build/helpers/index.js +17 -0
  43. package/build/helpers/subscription/calc-custom-subscription-price.helper.js +19 -0
  44. package/build/helpers/subscription/index.js +17 -0
  45. package/build/index.js +1 -0
  46. package/build/models/message.schema.js +1 -1
  47. package/build/models/payment-history-item.schema.js +14 -0
  48. package/build/models/subscription-upgrade-schema.js +8 -0
  49. package/build/models/subscription.schema.js +14 -2
  50. package/build/models/user-to-subscription.schema.js +1 -0
  51. package/commands/auth/index.ts +1 -1
  52. package/commands/auth/{reset-paasword.command.ts → reset-password.command.ts} +1 -5
  53. package/commands/auth/verify-email-retry.command.ts +10 -0
  54. package/commands/auth/verify-email.command.ts +1 -5
  55. package/commands/blog/delete-post.command.ts +1 -3
  56. package/commands/category/delete-category.command.ts +1 -3
  57. package/commands/chat/archive-all.command.ts +1 -6
  58. package/commands/chat/delete-chat.command.ts +1 -3
  59. package/commands/chat/delete-chat.command.v2.ts +1 -3
  60. package/commands/index.ts +1 -0
  61. package/commands/page/delete-page.command.ts +1 -3
  62. package/commands/payment/get-payment-history.command.ts +10 -0
  63. package/commands/payment/index.ts +2 -0
  64. package/commands/product/delete-product.command.ts +1 -3
  65. package/commands/subscription/cancel-subscription.command.ts +1 -3
  66. package/commands/subscription/create-custom-subscription-plan.command.ts +26 -0
  67. package/commands/subscription/find-subscription.command.ts +2 -2
  68. package/commands/subscription/get-available-upgrades.command.ts +15 -0
  69. package/commands/subscription/index.ts +3 -0
  70. package/commands/subscription/recover-subscription.command.ts +1 -3
  71. package/commands/subscription/upgrade-subscription.command.ts +46 -0
  72. package/constants/email/subjects.ts +7 -0
  73. package/constants/errors/errors.ts +45 -0
  74. package/constants/order/enums/index.ts +1 -0
  75. package/constants/order/enums/order-type.enum.ts +4 -0
  76. package/constants/payment/enums/index.ts +1 -0
  77. package/constants/payment/enums/payment-history-item-type.enum.ts +4 -0
  78. package/constants/subscription/enums/index.ts +4 -0
  79. package/constants/subscription/enums/subscription-action.enum.ts +6 -0
  80. package/constants/subscription/enums/subscription-plan.enum.ts +4 -0
  81. package/constants/subscription/enums/subscription-status.enum.ts +1 -0
  82. package/constants/subscription/enums/subscription-type.enum.ts +4 -0
  83. package/constants/subscription/enums/user-to-subscription-type.enum.ts +4 -0
  84. package/helpers/index.ts +1 -0
  85. package/helpers/subscription/calc-custom-subscription-price.helper.ts +19 -0
  86. package/helpers/subscription/index.ts +1 -0
  87. package/index.ts +1 -0
  88. package/models/message.schema.ts +1 -1
  89. package/models/payment-history-item.schema.ts +12 -0
  90. package/models/subscription-upgrade-schema.ts +9 -0
  91. package/models/subscription.schema.ts +21 -1
  92. package/models/user-to-subscription.schema.ts +1 -0
  93. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- export * from './reset-paasword.command';
1
+ export * from './reset-password.command';
2
2
  export * from './restore-password.command';
3
3
  export * from './login.command';
4
4
  export * from './register-user.command';
@@ -9,10 +9,6 @@ export namespace ResetPasswordCommand {
9
9
 
10
10
  export type Request = z.infer<typeof RequestSchema>;
11
11
 
12
- export const ResponseSchema = z.object({
13
- data: z.object({
14
- isSuccess: z.boolean(),
15
- }),
16
- });
12
+ export const ResponseSchema = z.void();
17
13
  export type Response = z.infer<typeof ResponseSchema>;
18
14
  }
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace VerifyEmailRetryCommand {
4
+ export const RequestSchema = z.object({});
5
+
6
+ export type Request = z.infer<typeof RequestSchema>;
7
+
8
+ export const ResponseSchema = z.void();
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -9,10 +9,6 @@ export namespace VerifyEmailCommand {
9
9
 
10
10
  export type Request = z.infer<typeof RequestSchema>;
11
11
 
12
- export const ResponseSchema = z.object({
13
- data: z.object({
14
- isSuccess: z.boolean(),
15
- }),
16
- });
12
+ export const ResponseSchema = z.void();
17
13
  export type Response = z.infer<typeof ResponseSchema>;
18
14
  }
@@ -8,8 +8,6 @@ export namespace DeletePostCommand {
8
8
 
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
- export const ResponseSchema = z.object({
12
- isDeleted: z.boolean(),
13
- });
11
+ export const ResponseSchema = z.void();
14
12
  export type Response = z.infer<typeof ResponseSchema>;
15
13
  }
@@ -8,8 +8,6 @@ export namespace DeleteCategoryCommand {
8
8
 
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
- export const ResponseSchema = z.object({
12
- isDeleted: z.boolean(),
13
- });
11
+ export const ResponseSchema = z.void();
14
12
  export type Response = z.infer<typeof ResponseSchema>;
15
13
  }
@@ -1,11 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  export namespace ArchiveAllCommand {
4
- export const ResponseSchema = z.object({
5
- data: z.object({
6
- isArchived: z.boolean(),
7
- }),
8
- });
9
-
4
+ export const ResponseSchema = z.void();
10
5
  export type Response = z.infer<typeof ResponseSchema>;
11
6
  }
@@ -9,8 +9,6 @@ export namespace DeleteChatCommand {
9
9
 
10
10
  export type Request = z.infer<typeof RequestSchema>;
11
11
 
12
- export const ResponseSchema = z.object({
13
- isDeleted: z.boolean(),
14
- });
12
+ export const ResponseSchema = z.void();
15
13
  export type Response = z.infer<typeof ResponseSchema>;
16
14
  }
@@ -8,8 +8,6 @@ export namespace DeleteChatV2Command {
8
8
 
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
- export const ResponseSchema = z.object({
12
- isDeleted: z.boolean(),
13
- });
11
+ export const ResponseSchema = z.void();
14
12
  export type Response = z.infer<typeof ResponseSchema>;
15
13
  }
package/commands/index.ts CHANGED
@@ -11,3 +11,4 @@ export * from './product';
11
11
  export * from './subscription';
12
12
  export * from './blog';
13
13
  export * from './user-to-subscription';
14
+ export * from './payment';
@@ -8,8 +8,6 @@ export namespace DeletePageCommand {
8
8
 
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
- export const ResponseSchema = z.object({
12
- isDeleted: z.boolean(),
13
- });
11
+ export const ResponseSchema = z.void();
14
12
  export type Response = z.infer<typeof ResponseSchema>;
15
13
  }
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { PaymentHistoryItemSchema } from '../../models/payment-history-item.schema';
3
+
4
+ export namespace GetPaymentHistoryCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: z.array(PaymentHistoryItemSchema),
7
+ });
8
+
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -0,0 +1,2 @@
1
+ export * from './get-payment-history.command';
2
+ export * from './pay.command';
@@ -8,8 +8,6 @@ export namespace DeleteProductCommand {
8
8
 
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
- export const ResponseSchema = z.object({
12
- isDeleted: z.boolean(),
13
- });
11
+ export const ResponseSchema = z.void();
14
12
  export type Response = z.infer<typeof ResponseSchema>;
15
13
  }
@@ -13,9 +13,7 @@ export namespace CancelSubscriptionCommand {
13
13
 
14
14
  export type Request = z.infer<typeof RequestSchema>;
15
15
 
16
- export const ResponseSchema = z.object({
17
- isSuccess: z.boolean(),
18
- });
16
+ export const ResponseSchema = z.void();
19
17
 
20
18
  export type Response = z.infer<typeof ResponseSchema>;
21
19
  }
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { SubscriptionSchema } from '../../models';
3
+
4
+ export namespace CreateCustomSubscriptionPlanCommand {
5
+ export const RequestSchema = z.object({
6
+ tokens: z
7
+ .number()
8
+ .refine((val) => val % 500 === 0, {
9
+ message: 'tokens must be a multiple of 500',
10
+ })
11
+ .refine((val) => val > 1000, {
12
+ message: 'tokens must be greater than 1000',
13
+ })
14
+ .refine((val) => val <= 10000, {
15
+ message: 'tokens must be equal or less than 10000',
16
+ }),
17
+ });
18
+
19
+ export type Request = z.infer<typeof RequestSchema>;
20
+
21
+ export const ResponseSchema = z.object({
22
+ data: SubscriptionSchema,
23
+ });
24
+
25
+ export type Response = z.infer<typeof ResponseSchema>;
26
+ }
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { SubscriptionSchema } from '../../models';
2
+ import { SubscriptionSchema, SubscriptionWithSubTypesSchema } from '../../models';
3
3
 
4
4
  export namespace FindSubscriptionCommand {
5
5
  export const RequestSchema = SubscriptionSchema.pick({
@@ -9,7 +9,7 @@ export namespace FindSubscriptionCommand {
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
11
  export const ResponseSchema = z.object({
12
- data: z.array(SubscriptionSchema),
12
+ data: z.array(SubscriptionWithSubTypesSchema),
13
13
  });
14
14
 
15
15
  export type Response = z.infer<typeof ResponseSchema>;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { SubscriptionSchema } from '../../models';
3
+ import { SubscriptionUpgradeSchema } from '../../models/subscription-upgrade-schema';
4
+
5
+ export namespace GetAvailableUpgradesCommand {
6
+ export const RequestSchema = SubscriptionSchema.pick({});
7
+
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.array(SubscriptionUpgradeSchema),
12
+ });
13
+
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -4,3 +4,6 @@ export * from './create-subscription.command';
4
4
  export * from './find-subscription.command';
5
5
  export * from './cancel-subscription.command';
6
6
  export * from './recover-subscription.command';
7
+ export * from './get-available-upgrades.command';
8
+ export * from './update-subscription.command';
9
+ export * from './create-custom-subscription-plan.command';
@@ -7,9 +7,7 @@ export namespace RecoverSubscriptionCommand {
7
7
 
8
8
  export type RequestParam = z.infer<typeof RequestParamSchema>;
9
9
 
10
- export const ResponseSchema = z.object({
11
- isSuccess: z.boolean(),
12
- });
10
+ export const ResponseSchema = z.void();
13
11
 
14
12
  export type Response = z.infer<typeof ResponseSchema>;
15
13
  }
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { SubscriptionSchema } from '../../models';
3
+
4
+ export namespace UpgradeSubscriptionCommand {
5
+ export const RequestSchema = SubscriptionSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ const IReceiptOrderSchema = z.object({
12
+ items: z.array(
13
+ z.object({
14
+ label: z.string(),
15
+ price: z.number(),
16
+ quantity: z.number(),
17
+ amount: z.number(),
18
+ vat: z.number(),
19
+ }),
20
+ ),
21
+ email: z.string(),
22
+ isBso: z.boolean(),
23
+ amounts: z.object({
24
+ electronic: z.number(),
25
+ }),
26
+ });
27
+
28
+ export const ResponseSchema = z.object({
29
+ publicId: z.string(),
30
+ amount: z.number(),
31
+ currency: z.string(),
32
+ accountId: z.string(),
33
+ description: z.string(),
34
+ invoiceId: z.string(),
35
+ email: z.string(),
36
+ skin: z.string(),
37
+ autoClose: z.number(),
38
+ data: z.object({
39
+ CloudPayments: z.object({
40
+ CustomerReceipt: IReceiptOrderSchema,
41
+ }),
42
+ }),
43
+ });
44
+
45
+ export type Response = z.infer<typeof ResponseSchema>;
46
+ }
@@ -0,0 +1,7 @@
1
+ export const EMAIL_SUBJECTS = {
2
+ WELCOME: 'Добро пожаловать на сервис ruGPT!',
3
+ EMAIL_VERIFICATION: 'Подтверждение почты',
4
+ SUBSCRIPTION_PURCHASE: 'Спасибо за покупку подписки',
5
+ SUBSCRIPTION_CANCEL: 'Нам жаль, что вы от нас уходите(',
6
+ PRODUCT_PURCHASE: 'Спасибо за покупку тарифа',
7
+ };
@@ -510,4 +510,49 @@ export const ERRORS = {
510
510
  message: 'Модель ИИ устарела',
511
511
  httpCode: 400,
512
512
  },
513
+ EMAIL_ALREADY_VERIFIED: {
514
+ code: 'A116',
515
+ message: 'Электронная почта уже подтверждена',
516
+ httpCode: 400,
517
+ },
518
+ GET_UNREGISTERED_SESSION_ERROR: {
519
+ code: 'A117',
520
+ message: 'Не удалось получить сессию с данным идентификатором',
521
+ httpCode: 500,
522
+ },
523
+ UNREGISTERED_USER_LIMIT_UPDATE_ERROR: {
524
+ code: 'A118',
525
+ message: 'Не удалось обновить баланс пользователя',
526
+ httpCode: 500,
527
+ },
528
+ PAYMENT_HISTORY_ERROR: {
529
+ code: 'A119',
530
+ message: 'Не удалось получить историю платежей',
531
+ httpCode: 500,
532
+ },
533
+ SUBSCRIPTION_GET_UPGRADES_ERROR: {
534
+ code: 'A120',
535
+ message: 'Не удалось получить информацию о возможных улучшениях для подписки',
536
+ httpCode: 500,
537
+ },
538
+ SUBSCRIPTION_UPGRADE_ERROR: {
539
+ code: 'A121',
540
+ message: 'Не удалось улучшить подписку',
541
+ httpCode: 500,
542
+ },
543
+ RECURRENT_UPDATE_ERROR: {
544
+ code: 'A122',
545
+ message: 'Не удалось изменить данные подписки',
546
+ httpCode: 500,
547
+ },
548
+ ALREADY_HAS_SUBSCRIPTION: {
549
+ code: 'A123',
550
+ message: 'На данной учетной записи уже есть подписка',
551
+ httpCode: 409,
552
+ },
553
+ SUBSCRIPTION_UPGRADE_INVALID: {
554
+ code: 'A124',
555
+ message: 'Невозможно улучшить подписку с данными параметрами',
556
+ httpCode: 400,
557
+ },
513
558
  };
@@ -1 +1,2 @@
1
1
  export * from './order-status.enum';
2
+ export * from './order-type.enum';
@@ -0,0 +1,4 @@
1
+ export enum ORDER_TYPE {
2
+ purchase = 'purchase',
3
+ upgrade = 'upgrade',
4
+ }
@@ -1 +1,2 @@
1
1
  export * from './payment-status.enum';
2
+ export * from './payment-history-item-type.enum';
@@ -0,0 +1,4 @@
1
+ export enum PAYMENT_HISTORY_ITEM_TYPE {
2
+ SUBSCRIPTION = 'subscription',
3
+ PRODUCT = 'product',
4
+ }
@@ -1 +1,5 @@
1
1
  export * from './subscription-status.enum';
2
+ export * from './subscription-plan.enum';
3
+ export * from './user-to-subscription-type.enum';
4
+ export * from './subscription-type.enum';
5
+ export * from './subscription-action.enum';
@@ -0,0 +1,6 @@
1
+ export enum SUBSCRIPTION_ACTION {
2
+ disabled = 'disabled',
3
+ buy = 'buy',
4
+ upgrade = 'upgrade',
5
+ possible_upgrade = 'possible_upgrade',
6
+ }
@@ -0,0 +1,4 @@
1
+ export enum SUBSCRIPTION_PLAN {
2
+ system = 'system',
3
+ custom = 'custom',
4
+ }
@@ -2,4 +2,5 @@ export enum SUBSCRIPTION_STATUS {
2
2
  active = 'active',
3
3
  canceled = 'canceled',
4
4
  expired = 'expired',
5
+ upgraded = 'upgraded',
5
6
  }
@@ -0,0 +1,4 @@
1
+ export enum SUBSCRIPTION_TYPE {
2
+ main = 'main',
3
+ sub = 'sub',
4
+ }
@@ -0,0 +1,4 @@
1
+ export enum USER_TO_SUBSCRIPTION_TYPE {
2
+ paid = 'paid',
3
+ interval = 'interval',
4
+ }
@@ -0,0 +1 @@
1
+ export * from './subscription';
@@ -0,0 +1,19 @@
1
+ export function calcCustomSubscriptionPrice(tokenCount: number, period: number) {
2
+ const MIN_TOKEN_COUNT = 1000;
3
+ const MAX_DISCOUNT = 0.85;
4
+ const DISCOUNT_PER_STEP = 0.005;
5
+ const STEP = 500;
6
+ const BASE_PRICE = 0.95;
7
+
8
+ if (tokenCount < 0) {
9
+ throw new Error('Token count must be a non-negative integer');
10
+ }
11
+
12
+ if (tokenCount < MIN_TOKEN_COUNT) {
13
+ throw new Error(`Token count must be at least ${MIN_TOKEN_COUNT}`);
14
+ }
15
+
16
+ const discount = Math.max(0, (tokenCount - MIN_TOKEN_COUNT) / STEP) * DISCOUNT_PER_STEP;
17
+ const priceMultiplier = Math.max(BASE_PRICE - discount, MAX_DISCOUNT);
18
+ return Math.round(tokenCount * priceMultiplier * period);
19
+ }
@@ -0,0 +1 @@
1
+ export * from './calc-custom-subscription-price.helper';
package/index.ts CHANGED
@@ -2,3 +2,4 @@ export * from './constants';
2
2
  export * from './commands';
3
3
  export * from './api';
4
4
  export * from './models';
5
+ export * from './helpers';
@@ -8,7 +8,7 @@ import {
8
8
 
9
9
  export const MessageSchema = z.object({
10
10
  uuid: z.string().uuid(),
11
- text: z.string(),
11
+ text: z.string().max(10000),
12
12
  chatId: z.nullable(z.string().uuid()),
13
13
  role: z.string(),
14
14
  tokenUsage: z.number(),
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { PAYMENT_HISTORY_ITEM_TYPE, PAYMENT_STATUS } from '../constants';
3
+
4
+ export const PaymentHistoryItemSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ status: z.nativeEnum(PAYMENT_STATUS),
7
+ sum: z.number(),
8
+ description: z.string(),
9
+ type: z.nativeEnum(PAYMENT_HISTORY_ITEM_TYPE),
10
+ createdAt: z.date(),
11
+ updatedAt: z.date(),
12
+ });
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { SubscriptionSchema } from './subscription.schema';
3
+
4
+ export const SubscriptionUpgradeSchema = z.intersection(
5
+ SubscriptionSchema,
6
+ z.object({
7
+ upgradePrice: z.number(),
8
+ }),
9
+ );
@@ -1,13 +1,33 @@
1
1
  import { z } from 'zod';
2
2
  import { FeaturesSchema } from './product.schema';
3
+ import { SUBSCRIPTION_ACTION, SUBSCRIPTION_PLAN, SUBSCRIPTION_TYPE } from '../constants';
3
4
 
4
5
  export const SubscriptionSchema = z.object({
5
6
  uuid: z.string().uuid(),
7
+ mainSubscriptionId: z.nullable(z.string().uuid()),
6
8
  name: z.string().min(3).max(16384),
7
9
  requests: z.number(),
8
10
  price: z.number(),
9
11
  features: z.array(FeaturesSchema),
10
- lengthInDays: z.number(),
12
+ plan: z.nativeEnum(SUBSCRIPTION_PLAN),
13
+ type: z.nativeEnum(SUBSCRIPTION_TYPE),
14
+ discount: z.number(),
15
+ period: z.number(),
16
+ tokens: z.number(),
11
17
  createdAt: z.date(),
12
18
  updatedAt: z.date(),
13
19
  });
20
+
21
+ export const SubscriptionWithActionSchema = z.intersection(
22
+ SubscriptionSchema,
23
+ z.object({
24
+ action: z.nativeEnum(SUBSCRIPTION_ACTION),
25
+ }),
26
+ );
27
+
28
+ export const SubscriptionWithSubTypesSchema = z.intersection(
29
+ SubscriptionWithActionSchema,
30
+ z.object({
31
+ subTypes: z.array(SubscriptionWithActionSchema),
32
+ }),
33
+ );
@@ -9,6 +9,7 @@ export const UserToSubscriptionSchema = z.object({
9
9
  tokenBalance: z.number(),
10
10
  status: z.string(),
11
11
  endDate: z.date().nullable(),
12
+ intervalEndDate: z.date().nullable(),
12
13
  createdAt: z.date(),
13
14
  updatedAt: z.date(),
14
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.7",
3
+ "version": "0.5.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {