@purpleschool/gptbot 0.10.4 → 0.10.6
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/api/controllers/http/team-account.ts +2 -0
- package/build/api/controllers/http/team-account.js +2 -0
- package/build/commands/payment/get-payment-history.command.js +4 -0
- package/build/commands/team-account/create-team-account.command.js +1 -0
- package/build/commands/team-account/find-team-accounts-by-name.command.js +1 -1
- package/build/commands/team-account/get-my-team-account.command.js +1 -1
- package/build/commands/team-account/get-team-account-statistics-by-month.command.js +34 -0
- package/build/commands/team-account/get-team-account-statistics-overview.command.js +28 -0
- package/build/commands/team-account/index.js +2 -0
- package/build/commands/team-account/update-team-account.command.js +5 -1
- package/build/constants/subscription/index.js +1 -0
- package/build/constants/subscription/team-baseline-subscription.constant.js +4 -0
- package/build/models/team-account/index.js +1 -0
- package/build/models/team-account/team-account-with-balance.schema.js +13 -0
- package/build/models/team-account/team-account.schema.js +26 -1
- package/commands/payment/get-payment-history.command.ts +7 -0
- package/commands/team-account/create-team-account.command.ts +1 -0
- package/commands/team-account/find-team-accounts-by-name.command.ts +2 -2
- package/commands/team-account/get-my-team-account.command.ts +2 -2
- package/commands/team-account/get-team-account-statistics-by-month.command.ts +37 -0
- package/commands/team-account/get-team-account-statistics-overview.command.ts +31 -0
- package/commands/team-account/index.ts +2 -0
- package/commands/team-account/update-team-account.command.ts +5 -1
- package/constants/subscription/index.ts +1 -0
- package/constants/subscription/team-baseline-subscription.constant.ts +1 -0
- package/models/team-account/index.ts +1 -0
- package/models/team-account/team-account-with-balance.schema.ts +11 -0
- package/models/team-account/team-account.schema.ts +26 -0
- package/package.json +1 -1
|
@@ -16,6 +16,8 @@ export const TEAM_ACCOUNT_ROUTES = {
|
|
|
16
16
|
GET_CURRENT_PRODUCTS: 'products/current',
|
|
17
17
|
GET_CURRENT_SUBSCRIPTIONS: 'subscriptions/current',
|
|
18
18
|
GET_BALANCE: 'balance',
|
|
19
|
+
GET_STATISTICS_OVERVIEW: 'statistics/overview',
|
|
20
|
+
GET_STATISTICS_BY_MONTH: 'statistics/by-month',
|
|
19
21
|
CREATE_MANUAL_SUBSCRIPTION: 'manual/subscription',
|
|
20
22
|
CREATE_MANUAL_PRODUCT: 'manual/product',
|
|
21
23
|
ADMIN_FIND_BY_NAME: 'admin/find',
|
|
@@ -18,6 +18,8 @@ exports.TEAM_ACCOUNT_ROUTES = {
|
|
|
18
18
|
GET_CURRENT_PRODUCTS: 'products/current',
|
|
19
19
|
GET_CURRENT_SUBSCRIPTIONS: 'subscriptions/current',
|
|
20
20
|
GET_BALANCE: 'balance',
|
|
21
|
+
GET_STATISTICS_OVERVIEW: 'statistics/overview',
|
|
22
|
+
GET_STATISTICS_BY_MONTH: 'statistics/by-month',
|
|
21
23
|
CREATE_MANUAL_SUBSCRIPTION: 'manual/subscription',
|
|
22
24
|
CREATE_MANUAL_PRODUCT: 'manual/product',
|
|
23
25
|
ADMIN_FIND_BY_NAME: 'admin/find',
|
|
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetPaymentHistoryCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const payment_history_item_schema_1 = require("../../models/payment-history-item.schema");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
var GetPaymentHistoryCommand;
|
|
7
8
|
(function (GetPaymentHistoryCommand) {
|
|
9
|
+
GetPaymentHistoryCommand.RequestQuerySchema = zod_1.z.object({
|
|
10
|
+
billingScope: zod_1.z.nativeEnum(constants_1.BILLING_SCOPE).default(constants_1.BILLING_SCOPE.USER),
|
|
11
|
+
});
|
|
8
12
|
GetPaymentHistoryCommand.ResponseSchema = zod_1.z.object({
|
|
9
13
|
data: zod_1.z.array(payment_history_item_schema_1.PaymentHistoryItemSchema),
|
|
10
14
|
});
|
|
@@ -9,6 +9,7 @@ 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
13
|
});
|
|
13
14
|
CreateTeamAccountCommand.ResponseSchema = zod_1.z.object({
|
|
14
15
|
data: models_1.TeamAccountSchema,
|
|
@@ -11,7 +11,7 @@ var FindTeamAccountsByNameCommand;
|
|
|
11
11
|
offset: zod_1.z.coerce.number().int().min(0).default(0).optional(),
|
|
12
12
|
});
|
|
13
13
|
FindTeamAccountsByNameCommand.ResponseSchema = zod_1.z.object({
|
|
14
|
-
data: zod_1.z.array(models_1.
|
|
14
|
+
data: zod_1.z.array(models_1.TeamAccountWithBalanceSchema),
|
|
15
15
|
page: zod_1.z.number(),
|
|
16
16
|
totalPages: zod_1.z.number(),
|
|
17
17
|
});
|
|
@@ -6,6 +6,6 @@ const models_1 = require("../../models");
|
|
|
6
6
|
var GetMyTeamAccountCommand;
|
|
7
7
|
(function (GetMyTeamAccountCommand) {
|
|
8
8
|
GetMyTeamAccountCommand.ResponseSchema = zod_1.z.object({
|
|
9
|
-
data: models_1.
|
|
9
|
+
data: models_1.TeamAccountCabinetSchema.nullable(),
|
|
10
10
|
});
|
|
11
11
|
})(GetMyTeamAccountCommand || (exports.GetMyTeamAccountCommand = GetMyTeamAccountCommand = {}));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTeamAccountStatisticsByMonthCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetTeamAccountStatisticsByMonthCommand;
|
|
7
|
+
(function (GetTeamAccountStatisticsByMonthCommand) {
|
|
8
|
+
GetTeamAccountStatisticsByMonthCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
origin: zod_1.z.nativeEnum(constants_1.JOB_REQUEST_ORIGIN).default(constants_1.JOB_REQUEST_ORIGIN.API).optional(),
|
|
10
|
+
metric: zod_1.z
|
|
11
|
+
.nativeEnum(constants_1.STATISTICS_METRIC_TYPE)
|
|
12
|
+
.default(constants_1.STATISTICS_METRIC_TYPE.REQUESTS)
|
|
13
|
+
.optional(),
|
|
14
|
+
memberUserId: zod_1.z.string().uuid().optional(),
|
|
15
|
+
});
|
|
16
|
+
GetTeamAccountStatisticsByMonthCommand.TeamAccountStatisticsByMonthItemSchema = zod_1.z.object({
|
|
17
|
+
month: zod_1.z.string(),
|
|
18
|
+
total_texts: zod_1.z.number(),
|
|
19
|
+
total_audios: zod_1.z.number(),
|
|
20
|
+
total_images: zod_1.z.number(),
|
|
21
|
+
total_videos: zod_1.z.number(),
|
|
22
|
+
total_presentations: zod_1.z.number(),
|
|
23
|
+
total_paraphrases: zod_1.z.number(),
|
|
24
|
+
writers: zod_1.z.object({
|
|
25
|
+
total_writers: zod_1.z.number(),
|
|
26
|
+
total_writer_actions: zod_1.z.number(),
|
|
27
|
+
}),
|
|
28
|
+
total_video_edits: zod_1.z.number(),
|
|
29
|
+
total_musics: zod_1.z.number(),
|
|
30
|
+
});
|
|
31
|
+
GetTeamAccountStatisticsByMonthCommand.ResponseSchema = zod_1.z.object({
|
|
32
|
+
data: zod_1.z.array(GetTeamAccountStatisticsByMonthCommand.TeamAccountStatisticsByMonthItemSchema),
|
|
33
|
+
});
|
|
34
|
+
})(GetTeamAccountStatisticsByMonthCommand || (exports.GetTeamAccountStatisticsByMonthCommand = GetTeamAccountStatisticsByMonthCommand = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTeamAccountStatisticsOverviewCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetTeamAccountStatisticsOverviewCommand;
|
|
7
|
+
(function (GetTeamAccountStatisticsOverviewCommand) {
|
|
8
|
+
GetTeamAccountStatisticsOverviewCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
startDate: zod_1.z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
10
|
+
message: 'from must be a valid date string',
|
|
11
|
+
}),
|
|
12
|
+
endDate: zod_1.z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
13
|
+
message: 'to must be a valid date string',
|
|
14
|
+
}),
|
|
15
|
+
groupBy: zod_1.z.nativeEnum(constants_1.GROUP_BY).default(constants_1.GROUP_BY.DAY),
|
|
16
|
+
origin: zod_1.z.nativeEnum(constants_1.JOB_REQUEST_ORIGIN).default(constants_1.JOB_REQUEST_ORIGIN.API).optional(),
|
|
17
|
+
memberUserId: zod_1.z.string().uuid().optional(),
|
|
18
|
+
});
|
|
19
|
+
GetTeamAccountStatisticsOverviewCommand.TeamAccountStatisticsOverviewItemSchema = zod_1.z.object({
|
|
20
|
+
startDate: zod_1.z.string(),
|
|
21
|
+
endDate: zod_1.z.string(),
|
|
22
|
+
total_tokens: zod_1.z.number(),
|
|
23
|
+
total_messages: zod_1.z.number(),
|
|
24
|
+
});
|
|
25
|
+
GetTeamAccountStatisticsOverviewCommand.ResponseSchema = zod_1.z.object({
|
|
26
|
+
data: zod_1.z.array(GetTeamAccountStatisticsOverviewCommand.TeamAccountStatisticsOverviewItemSchema),
|
|
27
|
+
});
|
|
28
|
+
})(GetTeamAccountStatisticsOverviewCommand || (exports.GetTeamAccountStatisticsOverviewCommand = GetTeamAccountStatisticsOverviewCommand = {}));
|
|
@@ -28,6 +28,8 @@ __exportStar(require("./find-team-account-products.command"), exports);
|
|
|
28
28
|
__exportStar(require("./find-team-account-subscriptions.command"), exports);
|
|
29
29
|
__exportStar(require("./find-current-team-account-products.command"), exports);
|
|
30
30
|
__exportStar(require("./find-current-team-account-subscriptions.command"), exports);
|
|
31
|
+
__exportStar(require("./get-team-account-statistics-overview.command"), exports);
|
|
32
|
+
__exportStar(require("./get-team-account-statistics-by-month.command"), exports);
|
|
31
33
|
__exportStar(require("./get-team-account-balance.command"), exports);
|
|
32
34
|
__exportStar(require("./create-manual-team-subscription.command"), exports);
|
|
33
35
|
__exportStar(require("./create-manual-team-product.command"), exports);
|
|
@@ -10,8 +10,12 @@ 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
14
|
})
|
|
14
|
-
.refine((data) => data.name !== undefined ||
|
|
15
|
+
.refine((data) => data.name !== undefined ||
|
|
16
|
+
data.email !== undefined ||
|
|
17
|
+
data.logoUUID !== undefined ||
|
|
18
|
+
data.tin !== undefined, { message: 'At least one field must be provided' });
|
|
15
19
|
UpdateTeamAccountCommand.ResponseSchema = zod_1.z.object({
|
|
16
20
|
data: models_1.TeamAccountSchema,
|
|
17
21
|
});
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./team-account.schema"), exports);
|
|
18
|
+
__exportStar(require("./team-account-with-balance.schema"), exports);
|
|
18
19
|
__exportStar(require("./team-account-member.schema"), exports);
|
|
19
20
|
__exportStar(require("./team-account-member-list-item.schema"), exports);
|
|
20
21
|
__exportStar(require("./team-account-invite.schema"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeamAccountWithBalanceSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const team_account_schema_1 = require("./team-account.schema");
|
|
6
|
+
exports.TeamAccountWithBalanceSchema = team_account_schema_1.TeamAccountSchema.extend({
|
|
7
|
+
balance: zod_1.z.object({
|
|
8
|
+
totalTokenBalance: zod_1.z.number(),
|
|
9
|
+
subscriptionBalance: zod_1.z.number(),
|
|
10
|
+
productBalance: zod_1.z.number(),
|
|
11
|
+
carriedOverBalance: zod_1.z.number(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TeamAccountSchema = void 0;
|
|
3
|
+
exports.TeamAccountCabinetSchema = exports.TeamAccountSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
5
6
|
exports.TeamAccountSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string().uuid(),
|
|
7
8
|
ownerUserId: zod_1.z.string().uuid(),
|
|
8
9
|
name: zod_1.z.string(),
|
|
9
10
|
email: zod_1.z.string().email(),
|
|
10
11
|
logoUrl: zod_1.z.string().nullable(),
|
|
12
|
+
tin: zod_1.z.string().nullable(),
|
|
11
13
|
isActive: zod_1.z.boolean(),
|
|
12
14
|
createdAt: zod_1.z.date(),
|
|
13
15
|
updatedAt: zod_1.z.date(),
|
|
14
16
|
});
|
|
17
|
+
exports.TeamAccountCabinetSchema = zod_1.z.object({
|
|
18
|
+
account: zod_1.z.object({
|
|
19
|
+
uuid: zod_1.z.string().uuid(),
|
|
20
|
+
name: zod_1.z.string(),
|
|
21
|
+
email: zod_1.z.string().email().optional(),
|
|
22
|
+
logoUrl: zod_1.z.string().nullable(),
|
|
23
|
+
}),
|
|
24
|
+
membership: zod_1.z.object({
|
|
25
|
+
role: zod_1.z.nativeEnum(constants_1.TEAM_ACCOUNT_MEMBER_ROLE),
|
|
26
|
+
}),
|
|
27
|
+
balance: zod_1.z.object({
|
|
28
|
+
remaining: zod_1.z.number().int(),
|
|
29
|
+
limit: zod_1.z.number().int().nullable(),
|
|
30
|
+
}),
|
|
31
|
+
subscription: zod_1.z.object({
|
|
32
|
+
planName: zod_1.z.string().nullable(),
|
|
33
|
+
activeUntil: zod_1.z.date().nullable(),
|
|
34
|
+
isActive: zod_1.z.boolean(),
|
|
35
|
+
}),
|
|
36
|
+
products: zod_1.z.array(zod_1.z.object({
|
|
37
|
+
planName: zod_1.z.string().nullable(),
|
|
38
|
+
})),
|
|
39
|
+
});
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PaymentHistoryItemSchema } from '../../models/payment-history-item.schema';
|
|
3
|
+
import { BILLING_SCOPE } from '../../constants';
|
|
3
4
|
|
|
4
5
|
export namespace GetPaymentHistoryCommand {
|
|
6
|
+
export const RequestQuerySchema = z.object({
|
|
7
|
+
billingScope: z.nativeEnum(BILLING_SCOPE).default(BILLING_SCOPE.USER),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
11
|
+
|
|
5
12
|
export const ResponseSchema = z.object({
|
|
6
13
|
data: z.array(PaymentHistoryItemSchema),
|
|
7
14
|
});
|
|
@@ -6,6 +6,7 @@ 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
10
|
});
|
|
10
11
|
|
|
11
12
|
export type Request = z.infer<typeof RequestSchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { TeamAccountWithBalanceSchema } from '../../models';
|
|
3
3
|
|
|
4
4
|
export namespace FindTeamAccountsByNameCommand {
|
|
5
5
|
export const RequestSchema = z.object({
|
|
@@ -11,7 +11,7 @@ export namespace FindTeamAccountsByNameCommand {
|
|
|
11
11
|
export type Request = z.infer<typeof RequestSchema>;
|
|
12
12
|
|
|
13
13
|
export const ResponseSchema = z.object({
|
|
14
|
-
data: z.array(
|
|
14
|
+
data: z.array(TeamAccountWithBalanceSchema),
|
|
15
15
|
page: z.number(),
|
|
16
16
|
totalPages: z.number(),
|
|
17
17
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { TeamAccountCabinetSchema } from '../../models';
|
|
3
3
|
|
|
4
4
|
export namespace GetMyTeamAccountCommand {
|
|
5
5
|
export const ResponseSchema = z.object({
|
|
6
|
-
data:
|
|
6
|
+
data: TeamAccountCabinetSchema.nullable(),
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_REQUEST_ORIGIN, STATISTICS_METRIC_TYPE } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace GetTeamAccountStatisticsByMonthCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
origin: z.nativeEnum(JOB_REQUEST_ORIGIN).default(JOB_REQUEST_ORIGIN.API).optional(),
|
|
7
|
+
metric: z
|
|
8
|
+
.nativeEnum(STATISTICS_METRIC_TYPE)
|
|
9
|
+
.default(STATISTICS_METRIC_TYPE.REQUESTS)
|
|
10
|
+
.optional(),
|
|
11
|
+
memberUserId: z.string().uuid().optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
15
|
+
|
|
16
|
+
export const TeamAccountStatisticsByMonthItemSchema = z.object({
|
|
17
|
+
month: z.string(),
|
|
18
|
+
total_texts: z.number(),
|
|
19
|
+
total_audios: z.number(),
|
|
20
|
+
total_images: z.number(),
|
|
21
|
+
total_videos: z.number(),
|
|
22
|
+
total_presentations: z.number(),
|
|
23
|
+
total_paraphrases: z.number(),
|
|
24
|
+
writers: z.object({
|
|
25
|
+
total_writers: z.number(),
|
|
26
|
+
total_writer_actions: z.number(),
|
|
27
|
+
}),
|
|
28
|
+
total_video_edits: z.number(),
|
|
29
|
+
total_musics: z.number(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const ResponseSchema = z.object({
|
|
33
|
+
data: z.array(TeamAccountStatisticsByMonthItemSchema),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GROUP_BY, JOB_REQUEST_ORIGIN } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace GetTeamAccountStatisticsOverviewCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
startDate: z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
7
|
+
message: 'from must be a valid date string',
|
|
8
|
+
}),
|
|
9
|
+
endDate: z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
10
|
+
message: 'to must be a valid date string',
|
|
11
|
+
}),
|
|
12
|
+
groupBy: z.nativeEnum(GROUP_BY).default(GROUP_BY.DAY),
|
|
13
|
+
origin: z.nativeEnum(JOB_REQUEST_ORIGIN).default(JOB_REQUEST_ORIGIN.API).optional(),
|
|
14
|
+
memberUserId: z.string().uuid().optional(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const TeamAccountStatisticsOverviewItemSchema = z.object({
|
|
20
|
+
startDate: z.string(),
|
|
21
|
+
endDate: z.string(),
|
|
22
|
+
total_tokens: z.number(),
|
|
23
|
+
total_messages: z.number(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const ResponseSchema = z.object({
|
|
27
|
+
data: z.array(TeamAccountStatisticsOverviewItemSchema),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
31
|
+
}
|
|
@@ -12,6 +12,8 @@ export * from './find-team-account-products.command';
|
|
|
12
12
|
export * from './find-team-account-subscriptions.command';
|
|
13
13
|
export * from './find-current-team-account-products.command';
|
|
14
14
|
export * from './find-current-team-account-subscriptions.command';
|
|
15
|
+
export * from './get-team-account-statistics-overview.command';
|
|
16
|
+
export * from './get-team-account-statistics-by-month.command';
|
|
15
17
|
export * from './get-team-account-balance.command';
|
|
16
18
|
export * from './create-manual-team-subscription.command';
|
|
17
19
|
export * from './create-manual-team-product.command';
|
|
@@ -7,10 +7,14 @@ 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
11
|
})
|
|
11
12
|
.refine(
|
|
12
13
|
(data) =>
|
|
13
|
-
data.name !== undefined ||
|
|
14
|
+
data.name !== undefined ||
|
|
15
|
+
data.email !== undefined ||
|
|
16
|
+
data.logoUUID !== undefined ||
|
|
17
|
+
data.tin !== undefined,
|
|
14
18
|
{ message: 'At least one field must be provided' },
|
|
15
19
|
);
|
|
16
20
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TEAM_BASELINE_SUBSCRIPTION_ID = '3b5f3d3e-2c60-4a76-a3d8-9c91f7f2c0b1';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TeamAccountSchema } from './team-account.schema';
|
|
3
|
+
|
|
4
|
+
export const TeamAccountWithBalanceSchema = TeamAccountSchema.extend({
|
|
5
|
+
balance: z.object({
|
|
6
|
+
totalTokenBalance: z.number(),
|
|
7
|
+
subscriptionBalance: z.number(),
|
|
8
|
+
productBalance: z.number(),
|
|
9
|
+
carriedOverBalance: z.number(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { TEAM_ACCOUNT_MEMBER_ROLE } from '../../constants';
|
|
2
3
|
|
|
3
4
|
export const TeamAccountSchema = z.object({
|
|
4
5
|
uuid: z.string().uuid(),
|
|
@@ -6,7 +7,32 @@ export const TeamAccountSchema = z.object({
|
|
|
6
7
|
name: z.string(),
|
|
7
8
|
email: z.string().email(),
|
|
8
9
|
logoUrl: z.string().nullable(),
|
|
10
|
+
tin: z.string().nullable(),
|
|
9
11
|
isActive: z.boolean(),
|
|
10
12
|
createdAt: z.date(),
|
|
11
13
|
updatedAt: z.date(),
|
|
12
14
|
});
|
|
15
|
+
|
|
16
|
+
export const TeamAccountCabinetSchema = z.object({
|
|
17
|
+
account: z.object({
|
|
18
|
+
uuid: z.string().uuid(),
|
|
19
|
+
name: z.string(),
|
|
20
|
+
email: z.string().email().optional(),
|
|
21
|
+
logoUrl: z.string().nullable(),
|
|
22
|
+
}),
|
|
23
|
+
membership: z.object({
|
|
24
|
+
role: z.nativeEnum(TEAM_ACCOUNT_MEMBER_ROLE),
|
|
25
|
+
}),
|
|
26
|
+
balance: z.object({
|
|
27
|
+
remaining: z.number().int(),
|
|
28
|
+
limit: z.number().int().nullable(),
|
|
29
|
+
}),
|
|
30
|
+
subscription: z.object({
|
|
31
|
+
planName: z.string().nullable(),
|
|
32
|
+
activeUntil: z.date().nullable(),
|
|
33
|
+
isActive: z.boolean(),
|
|
34
|
+
}),
|
|
35
|
+
products: z.array(z.object({
|
|
36
|
+
planName: z.string().nullable(),
|
|
37
|
+
})),
|
|
38
|
+
});
|