@purpleschool/gptbot 0.10.4 → 0.10.5
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/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/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/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
|
@@ -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 = {}));
|
|
@@ -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>;
|
|
@@ -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
|
+
});
|