@purpleschool/gptbot 0.10.7 → 0.10.8

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 (28) hide show
  1. package/api/controllers/http/team-account.ts +7 -0
  2. package/api/routes.ts +7 -0
  3. package/build/api/controllers/http/team-account.js +5 -0
  4. package/build/api/routes.js +5 -0
  5. package/build/commands/team-account/cancel-team-trial-subscription.command.js +12 -0
  6. package/build/commands/team-account/create-team-account-invoice-payment.command.js +25 -0
  7. package/build/commands/team-account/create-team-account.command.js +4 -1
  8. package/build/commands/team-account/find-current-team-account-subscriptions-by-team-account-id.command.js +14 -0
  9. package/build/commands/team-account/get-team-account-payment-history.command.js +14 -0
  10. package/build/commands/team-account/index.js +5 -0
  11. package/build/commands/team-account/leave-team-account-member.command.js +13 -0
  12. package/build/commands/team-account/update-team-account.command.js +4 -1
  13. package/build/constants/subscription/index.js +1 -0
  14. package/build/constants/subscription/team-trial-subscription.constant.js +4 -0
  15. package/build/models/team-account/team-account.schema.js +1 -0
  16. package/commands/team-account/cancel-team-trial-subscription.command.ts +11 -0
  17. package/commands/team-account/create-team-account-invoice-payment.command.ts +32 -0
  18. package/commands/team-account/create-team-account.command.ts +4 -1
  19. package/commands/team-account/find-current-team-account-subscriptions-by-team-account-id.command.ts +16 -0
  20. package/commands/team-account/get-team-account-payment-history.command.ts +16 -0
  21. package/commands/team-account/index.ts +5 -0
  22. package/commands/team-account/invite-team-account-member.command.ts +2 -1
  23. package/commands/team-account/leave-team-account-member.command.ts +15 -0
  24. package/commands/team-account/update-team-account.command.ts +4 -1
  25. package/constants/subscription/index.ts +1 -0
  26. package/constants/subscription/team-trial-subscription.constant.ts +1 -0
  27. package/models/team-account/team-account.schema.ts +6 -3
  28. package/package.json +1 -1
@@ -7,6 +7,7 @@ export const TEAM_ACCOUNT_ROUTES = {
7
7
  INVITE_MEMBER: 'invite',
8
8
  REVOKE_INVITE: 'invite/revoke',
9
9
  REMOVE_MEMBER: 'members/remove',
10
+ LEAVE_MEMBER: 'members/leave',
10
11
  ACCEPT_INVITE: 'invite/accept',
11
12
  GET_ME: 'me',
12
13
  GET_MEMBERS: 'members',
@@ -15,10 +16,16 @@ export const TEAM_ACCOUNT_ROUTES = {
15
16
  GET_SUBSCRIPTIONS: 'subscriptions',
16
17
  GET_CURRENT_PRODUCTS: 'products/current',
17
18
  GET_CURRENT_SUBSCRIPTIONS: 'subscriptions/current',
19
+ CANCEL_TRIAL_SUBSCRIPTION: 'subscriptions/trial/cancel',
18
20
  GET_BALANCE: 'balance',
19
21
  GET_STATISTICS_OVERVIEW: 'statistics/overview',
20
22
  GET_STATISTICS_BY_MONTH: 'statistics/by-month',
21
23
  CREATE_MANUAL_SUBSCRIPTION: 'manual/subscription',
22
24
  CREATE_MANUAL_PRODUCT: 'manual/product',
25
+ CREATE_INVOICE_PAYMENT: 'invoice-payment',
23
26
  ADMIN_FIND_BY_NAME: 'admin/find',
27
+ ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId: string) =>
28
+ `admin/subscriptions/current/${teamAccountId}`,
29
+ ADMIN_GET_PAYMENT_HISTORY: (teamAccountId: string) =>
30
+ `admin/payments/history/${teamAccountId}`,
24
31
  } as const;
package/api/routes.ts CHANGED
@@ -190,6 +190,7 @@ export const REST_API = {
190
190
  INVITE_MEMBER: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.INVITE_MEMBER}`,
191
191
  REVOKE_INVITE: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REVOKE_INVITE}`,
192
192
  REMOVE_MEMBER: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REMOVE_MEMBER}`,
193
+ LEAVE_MEMBER: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.LEAVE_MEMBER}`,
193
194
  ACCEPT_INVITE: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ACCEPT_INVITE}`,
194
195
  GET_ME: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_ME}`,
195
196
  GET_MEMBERS: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_MEMBERS}`,
@@ -198,10 +199,16 @@ export const REST_API = {
198
199
  GET_SUBSCRIPTIONS: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_SUBSCRIPTIONS}`,
199
200
  GET_CURRENT_PRODUCTS: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_CURRENT_PRODUCTS}`,
200
201
  GET_CURRENT_SUBSCRIPTIONS: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_CURRENT_SUBSCRIPTIONS}`,
202
+ CANCEL_TRIAL_SUBSCRIPTION: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CANCEL_TRIAL_SUBSCRIPTION}`,
201
203
  GET_BALANCE: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_BALANCE}`,
202
204
  CREATE_MANUAL_SUBSCRIPTION: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_MANUAL_SUBSCRIPTION}`,
203
205
  CREATE_MANUAL_PRODUCT: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_MANUAL_PRODUCT}`,
206
+ CREATE_INVOICE_PAYMENT: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_INVOICE_PAYMENT}`,
204
207
  ADMIN_FIND_BY_NAME: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_FIND_BY_NAME}`,
208
+ ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId: string) =>
209
+ `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_CURRENT_SUBSCRIPTIONS(teamAccountId)}`,
210
+ ADMIN_GET_PAYMENT_HISTORY: (teamAccountId: string) =>
211
+ `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_PAYMENT_HISTORY(teamAccountId)}`,
205
212
  },
206
213
  FILES: {
207
214
  UPLOAD_FILE: `${ROOT}/${CONTROLLERS.FILE_CONTROLLER}/${CONTROLLERS.FILE_ROUTES.UPLOAD_FILE}`,
@@ -9,6 +9,7 @@ exports.TEAM_ACCOUNT_ROUTES = {
9
9
  INVITE_MEMBER: 'invite',
10
10
  REVOKE_INVITE: 'invite/revoke',
11
11
  REMOVE_MEMBER: 'members/remove',
12
+ LEAVE_MEMBER: 'members/leave',
12
13
  ACCEPT_INVITE: 'invite/accept',
13
14
  GET_ME: 'me',
14
15
  GET_MEMBERS: 'members',
@@ -17,10 +18,14 @@ exports.TEAM_ACCOUNT_ROUTES = {
17
18
  GET_SUBSCRIPTIONS: 'subscriptions',
18
19
  GET_CURRENT_PRODUCTS: 'products/current',
19
20
  GET_CURRENT_SUBSCRIPTIONS: 'subscriptions/current',
21
+ CANCEL_TRIAL_SUBSCRIPTION: 'subscriptions/trial/cancel',
20
22
  GET_BALANCE: 'balance',
21
23
  GET_STATISTICS_OVERVIEW: 'statistics/overview',
22
24
  GET_STATISTICS_BY_MONTH: 'statistics/by-month',
23
25
  CREATE_MANUAL_SUBSCRIPTION: 'manual/subscription',
24
26
  CREATE_MANUAL_PRODUCT: 'manual/product',
27
+ CREATE_INVOICE_PAYMENT: 'invoice-payment',
25
28
  ADMIN_FIND_BY_NAME: 'admin/find',
29
+ ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId) => `admin/subscriptions/current/${teamAccountId}`,
30
+ ADMIN_GET_PAYMENT_HISTORY: (teamAccountId) => `admin/payments/history/${teamAccountId}`,
26
31
  };
@@ -189,6 +189,7 @@ exports.REST_API = {
189
189
  INVITE_MEMBER: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.INVITE_MEMBER}`,
190
190
  REVOKE_INVITE: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REVOKE_INVITE}`,
191
191
  REMOVE_MEMBER: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REMOVE_MEMBER}`,
192
+ LEAVE_MEMBER: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.LEAVE_MEMBER}`,
192
193
  ACCEPT_INVITE: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ACCEPT_INVITE}`,
193
194
  GET_ME: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_ME}`,
194
195
  GET_MEMBERS: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_MEMBERS}`,
@@ -197,10 +198,14 @@ exports.REST_API = {
197
198
  GET_SUBSCRIPTIONS: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_SUBSCRIPTIONS}`,
198
199
  GET_CURRENT_PRODUCTS: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_CURRENT_PRODUCTS}`,
199
200
  GET_CURRENT_SUBSCRIPTIONS: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_CURRENT_SUBSCRIPTIONS}`,
201
+ CANCEL_TRIAL_SUBSCRIPTION: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CANCEL_TRIAL_SUBSCRIPTION}`,
200
202
  GET_BALANCE: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_BALANCE}`,
201
203
  CREATE_MANUAL_SUBSCRIPTION: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_MANUAL_SUBSCRIPTION}`,
202
204
  CREATE_MANUAL_PRODUCT: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_MANUAL_PRODUCT}`,
205
+ CREATE_INVOICE_PAYMENT: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_INVOICE_PAYMENT}`,
203
206
  ADMIN_FIND_BY_NAME: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_FIND_BY_NAME}`,
207
+ ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId) => `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_CURRENT_SUBSCRIPTIONS(teamAccountId)}`,
208
+ ADMIN_GET_PAYMENT_HISTORY: (teamAccountId) => `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_PAYMENT_HISTORY(teamAccountId)}`,
204
209
  },
205
210
  FILES: {
206
211
  UPLOAD_FILE: `${exports.ROOT}/${CONTROLLERS.FILE_CONTROLLER}/${CONTROLLERS.FILE_ROUTES.UPLOAD_FILE}`,
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelTeamTrialSubscriptionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var CancelTeamTrialSubscriptionCommand;
6
+ (function (CancelTeamTrialSubscriptionCommand) {
7
+ CancelTeamTrialSubscriptionCommand.ResponseSchema = zod_1.z.object({
8
+ data: zod_1.z.object({
9
+ isCancelled: zod_1.z.boolean(),
10
+ }),
11
+ });
12
+ })(CancelTeamTrialSubscriptionCommand || (exports.CancelTeamTrialSubscriptionCommand = CancelTeamTrialSubscriptionCommand = {}));
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateTeamAccountInvoicePaymentCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var CreateTeamAccountInvoicePaymentCommand;
6
+ (function (CreateTeamAccountInvoicePaymentCommand) {
7
+ CreateTeamAccountInvoicePaymentCommand.RequestSchema = zod_1.z
8
+ .object({
9
+ email: zod_1.z.string().email(),
10
+ name: zod_1.z.string().trim().min(1).max(255),
11
+ inn: zod_1.z.string().regex(/^\d{10}(\d{2})?$/, 'ИНН должен содержать 10 или 12 цифр'),
12
+ amount: zod_1.z.number().positive(),
13
+ subscriptionUuid: zod_1.z.string().uuid().optional(),
14
+ productUuid: zod_1.z.string().uuid().optional(),
15
+ })
16
+ .refine(({ subscriptionUuid, productUuid }) => Number(Boolean(subscriptionUuid)) + Number(Boolean(productUuid)) === 1, {
17
+ message: 'Нужно передать ровно один идентификатор: subscriptionUuid или productUuid',
18
+ });
19
+ CreateTeamAccountInvoicePaymentCommand.ResponseSchema = zod_1.z.object({
20
+ data: zod_1.z.object({
21
+ pdfUrl: zod_1.z.string().min(1),
22
+ invoiceNumber: zod_1.z.string().min(1),
23
+ }),
24
+ });
25
+ })(CreateTeamAccountInvoicePaymentCommand || (exports.CreateTeamAccountInvoicePaymentCommand = CreateTeamAccountInvoicePaymentCommand = {}));
@@ -9,7 +9,10 @@ var CreateTeamAccountCommand;
9
9
  name: zod_1.z.string().trim().min(1).max(255),
10
10
  email: zod_1.z.string().email().optional(),
11
11
  logoUUID: zod_1.z.string().uuid().optional(),
12
- tin: zod_1.z.string().regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр').optional(),
12
+ tin: zod_1.z
13
+ .string()
14
+ .regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр')
15
+ .optional(),
13
16
  });
14
17
  CreateTeamAccountCommand.ResponseSchema = zod_1.z.object({
15
18
  data: models_1.TeamAccountSchema,
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand;
7
+ (function (FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand) {
8
+ FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand.RequestParamSchema = zod_1.z.object({
9
+ teamAccountId: zod_1.z.string().uuid(),
10
+ });
11
+ FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand.ResponseSchema = zod_1.z.object({
12
+ data: zod_1.z.array(models_1.TeamToSubscriptionWithSubscriptionSchema),
13
+ });
14
+ })(FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand || (exports.FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand = FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetTeamAccountPaymentHistoryCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const payment_history_item_schema_1 = require("../../models/payment-history-item.schema");
6
+ var GetTeamAccountPaymentHistoryCommand;
7
+ (function (GetTeamAccountPaymentHistoryCommand) {
8
+ GetTeamAccountPaymentHistoryCommand.RequestParamSchema = zod_1.z.object({
9
+ teamAccountId: zod_1.z.string().uuid(),
10
+ });
11
+ GetTeamAccountPaymentHistoryCommand.ResponseSchema = zod_1.z.object({
12
+ data: zod_1.z.array(payment_history_item_schema_1.PaymentHistoryItemSchema),
13
+ });
14
+ })(GetTeamAccountPaymentHistoryCommand || (exports.GetTeamAccountPaymentHistoryCommand = GetTeamAccountPaymentHistoryCommand = {}));
@@ -16,9 +16,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-team-account.command"), exports);
18
18
  __exportStar(require("./update-team-account.command"), exports);
19
+ __exportStar(require("./cancel-team-trial-subscription.command"), exports);
19
20
  __exportStar(require("./invite-team-account-member.command"), exports);
20
21
  __exportStar(require("./accept-team-account-invite.command"), exports);
21
22
  __exportStar(require("./remove-team-account-member.command"), exports);
23
+ __exportStar(require("./leave-team-account-member.command"), exports);
22
24
  __exportStar(require("./revoke-team-account-invite.command"), exports);
23
25
  __exportStar(require("./update-team-account-member.command"), exports);
24
26
  __exportStar(require("./get-my-team-account.command"), exports);
@@ -28,9 +30,12 @@ __exportStar(require("./find-team-account-products.command"), exports);
28
30
  __exportStar(require("./find-team-account-subscriptions.command"), exports);
29
31
  __exportStar(require("./find-current-team-account-products.command"), exports);
30
32
  __exportStar(require("./find-current-team-account-subscriptions.command"), exports);
33
+ __exportStar(require("./find-current-team-account-subscriptions-by-team-account-id.command"), exports);
31
34
  __exportStar(require("./get-team-account-statistics-overview.command"), exports);
32
35
  __exportStar(require("./get-team-account-statistics-by-month.command"), exports);
33
36
  __exportStar(require("./get-team-account-balance.command"), exports);
34
37
  __exportStar(require("./create-manual-team-subscription.command"), exports);
35
38
  __exportStar(require("./create-manual-team-product.command"), exports);
36
39
  __exportStar(require("./find-team-accounts-by-name.command"), exports);
40
+ __exportStar(require("./create-team-account-invoice-payment.command"), exports);
41
+ __exportStar(require("./get-team-account-payment-history.command"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LeaveTeamAccountMemberCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var LeaveTeamAccountMemberCommand;
6
+ (function (LeaveTeamAccountMemberCommand) {
7
+ LeaveTeamAccountMemberCommand.RequestSchema = zod_1.z.object({});
8
+ LeaveTeamAccountMemberCommand.ResponseSchema = zod_1.z.object({
9
+ data: zod_1.z.object({
10
+ left: zod_1.z.boolean(),
11
+ }),
12
+ });
13
+ })(LeaveTeamAccountMemberCommand || (exports.LeaveTeamAccountMemberCommand = LeaveTeamAccountMemberCommand = {}));
@@ -10,7 +10,10 @@ var UpdateTeamAccountCommand;
10
10
  name: zod_1.z.string().trim().min(1).max(255).optional(),
11
11
  email: zod_1.z.string().email().optional(),
12
12
  logoUUID: zod_1.z.string().uuid().optional(),
13
- tin: zod_1.z.string().regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр').optional(),
13
+ tin: zod_1.z
14
+ .string()
15
+ .regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр')
16
+ .optional(),
14
17
  })
15
18
  .refine((data) => data.name !== undefined ||
16
19
  data.email !== undefined ||
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./enums"), exports);
18
18
  __exportStar(require("./team-baseline-subscription.constant"), exports);
19
+ __exportStar(require("./team-trial-subscription.constant"), exports);
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEAM_TRIAL_SUBSCRIPTION_ID = void 0;
4
+ exports.TEAM_TRIAL_SUBSCRIPTION_ID = 'f0c9b8a7-3d21-4f56-9cde-1234567890ab';
@@ -20,6 +20,7 @@ exports.TeamAccountCabinetSchema = zod_1.z.object({
20
20
  name: zod_1.z.string(),
21
21
  email: zod_1.z.string().email().optional(),
22
22
  logoUrl: zod_1.z.string().nullable(),
23
+ tin: zod_1.z.string().nullable().optional(),
23
24
  }),
24
25
  membership: zod_1.z.object({
25
26
  role: zod_1.z.nativeEnum(constants_1.TEAM_ACCOUNT_MEMBER_ROLE),
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CancelTeamTrialSubscriptionCommand {
4
+ export const ResponseSchema = z.object({
5
+ data: z.object({
6
+ isCancelled: z.boolean(),
7
+ }),
8
+ });
9
+
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CreateTeamAccountInvoicePaymentCommand {
4
+ export const RequestSchema = z
5
+ .object({
6
+ email: z.string().email(),
7
+ name: z.string().trim().min(1).max(255),
8
+ inn: z.string().regex(/^\d{10}(\d{2})?$/, 'ИНН должен содержать 10 или 12 цифр'),
9
+ amount: z.number().positive(),
10
+ subscriptionUuid: z.string().uuid().optional(),
11
+ productUuid: z.string().uuid().optional(),
12
+ })
13
+ .refine(
14
+ ({ subscriptionUuid, productUuid }) =>
15
+ Number(Boolean(subscriptionUuid)) + Number(Boolean(productUuid)) === 1,
16
+ {
17
+ message:
18
+ 'Нужно передать ровно один идентификатор: subscriptionUuid или productUuid',
19
+ },
20
+ );
21
+
22
+ export type Request = z.infer<typeof RequestSchema>;
23
+
24
+ export const ResponseSchema = z.object({
25
+ data: z.object({
26
+ pdfUrl: z.string().min(1),
27
+ invoiceNumber: z.string().min(1),
28
+ }),
29
+ });
30
+
31
+ export type Response = z.infer<typeof ResponseSchema>;
32
+ }
@@ -6,7 +6,10 @@ export namespace CreateTeamAccountCommand {
6
6
  name: z.string().trim().min(1).max(255),
7
7
  email: z.string().email().optional(),
8
8
  logoUUID: z.string().uuid().optional(),
9
- tin: z.string().regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр').optional(),
9
+ tin: z
10
+ .string()
11
+ .regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр')
12
+ .optional(),
10
13
  });
11
14
 
12
15
  export type Request = z.infer<typeof RequestSchema>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { TeamToSubscriptionWithSubscriptionSchema } from '../../models';
3
+
4
+ export namespace FindCurrentTeamAccountSubscriptionsByTeamAccountIdCommand {
5
+ export const RequestParamSchema = z.object({
6
+ teamAccountId: z.string().uuid(),
7
+ });
8
+
9
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.array(TeamToSubscriptionWithSubscriptionSchema),
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { PaymentHistoryItemSchema } from '../../models/payment-history-item.schema';
3
+
4
+ export namespace GetTeamAccountPaymentHistoryCommand {
5
+ export const RequestParamSchema = z.object({
6
+ teamAccountId: z.string().uuid(),
7
+ });
8
+
9
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.array(PaymentHistoryItemSchema),
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -1,8 +1,10 @@
1
1
  export * from './create-team-account.command';
2
2
  export * from './update-team-account.command';
3
+ export * from './cancel-team-trial-subscription.command';
3
4
  export * from './invite-team-account-member.command';
4
5
  export * from './accept-team-account-invite.command';
5
6
  export * from './remove-team-account-member.command';
7
+ export * from './leave-team-account-member.command';
6
8
  export * from './revoke-team-account-invite.command';
7
9
  export * from './update-team-account-member.command';
8
10
  export * from './get-my-team-account.command';
@@ -12,9 +14,12 @@ export * from './find-team-account-products.command';
12
14
  export * from './find-team-account-subscriptions.command';
13
15
  export * from './find-current-team-account-products.command';
14
16
  export * from './find-current-team-account-subscriptions.command';
17
+ export * from './find-current-team-account-subscriptions-by-team-account-id.command';
15
18
  export * from './get-team-account-statistics-overview.command';
16
19
  export * from './get-team-account-statistics-by-month.command';
17
20
  export * from './get-team-account-balance.command';
18
21
  export * from './create-manual-team-subscription.command';
19
22
  export * from './create-manual-team-product.command';
20
23
  export * from './find-team-accounts-by-name.command';
24
+ export * from './create-team-account-invoice-payment.command';
25
+ export * from './get-team-account-payment-history.command';
@@ -7,7 +7,8 @@ export namespace InviteTeamAccountMemberCommand {
7
7
  .array(z.string().email())
8
8
  .min(1)
9
9
  .refine(
10
- (emails) => new Set(emails.map((email) => email.toLowerCase())).size === emails.length,
10
+ (emails) =>
11
+ new Set(emails.map((email) => email.toLowerCase())).size === emails.length,
11
12
  {
12
13
  message: 'Emails must be unique (case-insensitive)',
13
14
  },
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace LeaveTeamAccountMemberCommand {
4
+ export const RequestSchema = z.object({});
5
+
6
+ export type Request = z.infer<typeof RequestSchema>;
7
+
8
+ export const ResponseSchema = z.object({
9
+ data: z.object({
10
+ left: z.boolean(),
11
+ }),
12
+ });
13
+
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -7,7 +7,10 @@ export namespace UpdateTeamAccountCommand {
7
7
  name: z.string().trim().min(1).max(255).optional(),
8
8
  email: z.string().email().optional(),
9
9
  logoUUID: z.string().uuid().optional(),
10
- tin: z.string().regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр').optional(),
10
+ tin: z
11
+ .string()
12
+ .regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр')
13
+ .optional(),
11
14
  })
12
15
  .refine(
13
16
  (data) =>
@@ -1,2 +1,3 @@
1
1
  export * from './enums';
2
2
  export * from './team-baseline-subscription.constant';
3
+ export * from './team-trial-subscription.constant';
@@ -0,0 +1 @@
1
+ export const TEAM_TRIAL_SUBSCRIPTION_ID = 'f0c9b8a7-3d21-4f56-9cde-1234567890ab';
@@ -19,6 +19,7 @@ export const TeamAccountCabinetSchema = z.object({
19
19
  name: z.string(),
20
20
  email: z.string().email().optional(),
21
21
  logoUrl: z.string().nullable(),
22
+ tin: z.string().nullable().optional(),
22
23
  }),
23
24
  membership: z.object({
24
25
  role: z.nativeEnum(TEAM_ACCOUNT_MEMBER_ROLE),
@@ -32,7 +33,9 @@ export const TeamAccountCabinetSchema = z.object({
32
33
  activeUntil: z.date().nullable(),
33
34
  isActive: z.boolean(),
34
35
  }),
35
- products: z.array(z.object({
36
- planName: z.string().nullable(),
37
- })),
36
+ products: z.array(
37
+ z.object({
38
+ planName: z.string().nullable(),
39
+ }),
40
+ ),
38
41
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.10.7",
3
+ "version": "0.10.8",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",