@ai-grator/api 0.2.64 → 0.2.66
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/admin/endpoints/admin.ts +4 -0
- package/admin/endpoints/commands/ban-admin-users.command.ts +44 -0
- package/admin/endpoints/commands/index.ts +1 -0
- package/admin/endpoints/queries/get-admin-linked-account-clusters.query.ts +56 -0
- package/admin/endpoints/queries/get-admin-partners.query.ts +5 -0
- package/admin/endpoints/queries/get-admin-users.query.ts +4 -1
- package/admin/endpoints/queries/index.ts +1 -0
- package/admin/enums/admin-bulk-ban-result.enum.ts +4 -0
- package/admin/enums/admin-bulk-ban-skip-reason.enum.ts +6 -0
- package/admin/enums/index.ts +4 -0
- package/admin/enums/linked-account-reason-type.enum.ts +5 -0
- package/admin/enums/linked-accounts-period.enum.ts +5 -0
- package/admin/models/admin-linked-account-cluster.schema.ts +62 -0
- package/admin/models/index.ts +1 -0
- package/build/admin/endpoints/admin.d.ts +2 -0
- package/build/admin/endpoints/admin.d.ts.map +1 -1
- package/build/admin/endpoints/admin.js +3 -0
- package/build/admin/endpoints/commands/ban-admin-users.command.d.ts +46 -0
- package/build/admin/endpoints/commands/ban-admin-users.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/ban-admin-users.command.js +38 -0
- package/build/admin/endpoints/commands/index.d.ts +1 -0
- package/build/admin/endpoints/commands/index.d.ts.map +1 -1
- package/build/admin/endpoints/commands/index.js +1 -0
- package/build/admin/endpoints/queries/export-admin-users.query.d.ts +6 -2
- package/build/admin/endpoints/queries/export-admin-users.query.d.ts.map +1 -1
- package/build/admin/endpoints/queries/get-admin-linked-account-clusters.query.d.ts +150 -0
- package/build/admin/endpoints/queries/get-admin-linked-account-clusters.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-linked-account-clusters.query.js +50 -0
- package/build/admin/endpoints/queries/get-admin-partners.query.d.ts +22 -0
- package/build/admin/endpoints/queries/get-admin-partners.query.d.ts.map +1 -1
- package/build/admin/endpoints/queries/get-admin-partners.query.js +4 -0
- package/build/admin/endpoints/queries/get-admin-users.query.d.ts +6 -2
- package/build/admin/endpoints/queries/get-admin-users.query.d.ts.map +1 -1
- package/build/admin/endpoints/queries/get-admin-users.query.js +4 -1
- package/build/admin/endpoints/queries/index.d.ts +1 -0
- package/build/admin/endpoints/queries/index.d.ts.map +1 -1
- package/build/admin/endpoints/queries/index.js +1 -0
- package/build/admin/enums/admin-bulk-ban-result.enum.d.ts +5 -0
- package/build/admin/enums/admin-bulk-ban-result.enum.d.ts.map +1 -0
- package/build/admin/enums/admin-bulk-ban-result.enum.js +8 -0
- package/build/admin/enums/admin-bulk-ban-skip-reason.enum.d.ts +7 -0
- package/build/admin/enums/admin-bulk-ban-skip-reason.enum.d.ts.map +1 -0
- package/build/admin/enums/admin-bulk-ban-skip-reason.enum.js +10 -0
- package/build/admin/enums/index.d.ts +4 -0
- package/build/admin/enums/index.d.ts.map +1 -1
- package/build/admin/enums/index.js +4 -0
- package/build/admin/enums/linked-account-reason-type.enum.d.ts +6 -0
- package/build/admin/enums/linked-account-reason-type.enum.d.ts.map +1 -0
- package/build/admin/enums/linked-account-reason-type.enum.js +9 -0
- package/build/admin/enums/linked-accounts-period.enum.d.ts +6 -0
- package/build/admin/enums/linked-accounts-period.enum.d.ts.map +1 -0
- package/build/admin/enums/linked-accounts-period.enum.js +9 -0
- package/build/admin/models/admin-linked-account-cluster.schema.d.ts +118 -0
- package/build/admin/models/admin-linked-account-cluster.schema.d.ts.map +1 -0
- package/build/admin/models/admin-linked-account-cluster.schema.js +52 -0
- package/build/admin/models/index.d.ts +1 -0
- package/build/admin/models/index.d.ts.map +1 -1
- package/build/admin/models/index.js +1 -0
- package/build/errors/errors.d.ts +5 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +5 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +5 -0
- package/package.json +1 -1
package/admin/endpoints/admin.ts
CHANGED
|
@@ -32,6 +32,10 @@ export const ADMIN_ROUTES = {
|
|
|
32
32
|
GET_USER: (userId: string) => `users/${userId}`,
|
|
33
33
|
GET_USER_TRANSACTIONS: (userId: string) => `users/${userId}/transactions`,
|
|
34
34
|
BAN_USER: (userId: string) => `users/${userId}/ban`,
|
|
35
|
+
BAN_USERS: 'users/ban',
|
|
36
|
+
|
|
37
|
+
// LINKED ACCOUNTS
|
|
38
|
+
GET_LINKED_ACCOUNT_CLUSTERS: 'linked-accounts/clusters',
|
|
35
39
|
|
|
36
40
|
// SUPPORT
|
|
37
41
|
GET_SUPPORT_CHATS: 'support/chats',
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { ADMIN_BULK_BAN_RESULT, ADMIN_BULK_BAN_SKIP_REASON } from '../../enums';
|
|
4
|
+
import { ADMIN_ROUTES } from '../admin';
|
|
5
|
+
|
|
6
|
+
export const ADMIN_BULK_BAN_MAX_USERS = 100;
|
|
7
|
+
|
|
8
|
+
export const BanAdminUsersCommandBody = z.object({
|
|
9
|
+
userIds: z
|
|
10
|
+
.array(z.uuid())
|
|
11
|
+
.min(1)
|
|
12
|
+
.max(ADMIN_BULK_BAN_MAX_USERS)
|
|
13
|
+
.refine((userIds) => new Set(userIds).size === userIds.length, 'userIds не должны повторяться'),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const AdminBulkBanItemResultSchema = z.object({
|
|
17
|
+
userId: z.uuid(),
|
|
18
|
+
result: z.enum(ADMIN_BULK_BAN_RESULT),
|
|
19
|
+
reason: z.enum(ADMIN_BULK_BAN_SKIP_REASON).nullable(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const BanAdminUsersCommandResponse = z.object({
|
|
23
|
+
results: z.array(AdminBulkBanItemResultSchema),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const BanAdminUsersCommand = defineContract({
|
|
27
|
+
method: HTTP_METHODS.POST,
|
|
28
|
+
path: ADMIN_ROUTES.BAN_USERS,
|
|
29
|
+
summary: 'Ban several users at once, returning a per-user result',
|
|
30
|
+
request: {
|
|
31
|
+
body: BanAdminUsersCommandBody,
|
|
32
|
+
},
|
|
33
|
+
responses: {
|
|
34
|
+
200: BanAdminUsersCommandResponse,
|
|
35
|
+
400: HttpErrorResponseSchema,
|
|
36
|
+
401: HttpErrorResponseSchema,
|
|
37
|
+
403: HttpErrorResponseSchema,
|
|
38
|
+
500: HttpErrorResponseSchema,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export type BanAdminUsersCommandBodyType = z.infer<typeof BanAdminUsersCommandBody>;
|
|
43
|
+
export type AdminBulkBanItemResultSchemaType = z.infer<typeof AdminBulkBanItemResultSchema>;
|
|
44
|
+
export type BanAdminUsersCommandResponseType = z.infer<typeof BanAdminUsersCommandResponse>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, defineOffsetPaginationQuery, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { LINKED_ACCOUNTS_PERIOD } from '../../enums';
|
|
4
|
+
import { AdminLinkedAccountClusterSchema } from '../../models';
|
|
5
|
+
import { ADMIN_ROUTES } from '../admin';
|
|
6
|
+
|
|
7
|
+
export const LINKED_ACCOUNT_CLUSTER_DEFAULT_MIN_SIZE = 2;
|
|
8
|
+
|
|
9
|
+
const SORT_ORDER = z.enum(['asc', 'desc']);
|
|
10
|
+
const SORT_BY = z.enum(['size', 'referralBonusesTotal']);
|
|
11
|
+
|
|
12
|
+
export const GetAdminLinkedAccountClustersQueryQuery = defineOffsetPaginationQuery()
|
|
13
|
+
.extend({
|
|
14
|
+
period: z.enum(LINKED_ACCOUNTS_PERIOD).optional(),
|
|
15
|
+
from: z.iso.date().optional(),
|
|
16
|
+
to: z.iso.date().optional(),
|
|
17
|
+
minSize: z.coerce.number().int().min(2).default(LINKED_ACCOUNT_CLUSTER_DEFAULT_MIN_SIZE),
|
|
18
|
+
hasUnbanned: z.stringbool().optional(),
|
|
19
|
+
sortBy: SORT_BY.default('size'),
|
|
20
|
+
sortOrder: SORT_ORDER.default('desc'),
|
|
21
|
+
})
|
|
22
|
+
.refine((query) => !(query.period && (query.from || query.to)), {
|
|
23
|
+
message: 'Нельзя одновременно передавать period и from/to',
|
|
24
|
+
path: ['period'],
|
|
25
|
+
})
|
|
26
|
+
.refine((query) => !(query.from && query.to && query.from > query.to), {
|
|
27
|
+
message: 'from не может быть позже to',
|
|
28
|
+
path: ['from'],
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const GetAdminLinkedAccountClustersQueryResponse = z.object({
|
|
32
|
+
clusters: z.array(AdminLinkedAccountClusterSchema),
|
|
33
|
+
total: z.number().int().nonnegative(),
|
|
34
|
+
page: z.number().int().positive(),
|
|
35
|
+
limit: z.number().int().positive(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const GetAdminLinkedAccountClustersQuery = defineContract({
|
|
39
|
+
method: HTTP_METHODS.GET,
|
|
40
|
+
path: ADMIN_ROUTES.GET_LINKED_ACCOUNT_CLUSTERS,
|
|
41
|
+
summary:
|
|
42
|
+
'Get clusters of accounts linked by shared signals within a period (Moscow day boundaries, defaults to the last 7 days)',
|
|
43
|
+
request: {
|
|
44
|
+
query: GetAdminLinkedAccountClustersQueryQuery,
|
|
45
|
+
},
|
|
46
|
+
responses: {
|
|
47
|
+
200: GetAdminLinkedAccountClustersQueryResponse,
|
|
48
|
+
400: HttpErrorResponseSchema,
|
|
49
|
+
401: HttpErrorResponseSchema,
|
|
50
|
+
403: HttpErrorResponseSchema,
|
|
51
|
+
500: HttpErrorResponseSchema,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export type GetAdminLinkedAccountClustersQueryQueryType = z.infer<typeof GetAdminLinkedAccountClustersQueryQuery>;
|
|
56
|
+
export type GetAdminLinkedAccountClustersQueryResponseType = z.infer<typeof GetAdminLinkedAccountClustersQueryResponse>;
|
|
@@ -4,10 +4,15 @@ import { ADMIN_PARTNER_RATES_TYPE, ADMIN_PARTNER_STATUS } from '../../enums';
|
|
|
4
4
|
import { AdminPartnerResponseSchema } from '../../models';
|
|
5
5
|
import { ADMIN_ROUTES } from '../admin';
|
|
6
6
|
|
|
7
|
+
const SORT_ORDER = z.enum(['asc', 'desc']);
|
|
8
|
+
const SORT_BY = z.enum(['createdAt', 'referralsTotal', 'activeReferrals', 'bonusBalance', 'earnedTotal']);
|
|
9
|
+
|
|
7
10
|
export const GetAdminPartnersQueryQuery = defineCursorPaginationQuery(z.uuid()).extend({
|
|
8
11
|
search: z.string().trim().max(255).optional(),
|
|
9
12
|
status: z.enum(ADMIN_PARTNER_STATUS).optional(),
|
|
10
13
|
ratesType: z.enum(ADMIN_PARTNER_RATES_TYPE).optional(),
|
|
14
|
+
sortBy: SORT_BY.default('createdAt'),
|
|
15
|
+
sortOrder: SORT_ORDER.default('desc'),
|
|
11
16
|
});
|
|
12
17
|
|
|
13
18
|
export const GetAdminPartnersQueryResponse = z.object({
|
|
@@ -6,12 +6,15 @@ import { ADMIN_ROUTES } from '../admin';
|
|
|
6
6
|
|
|
7
7
|
const SORT_ORDER = z.enum(['asc', 'desc']);
|
|
8
8
|
const SORT_BY = z.enum(['depositsTotal', 'cashBalance', 'createdAt']);
|
|
9
|
+
const PERIOD_END = z.union([z.iso.date().transform((date) => new Date(`${date}T23:59:59.999Z`)), z.coerce.date()]);
|
|
9
10
|
|
|
10
11
|
export const GetAdminUsersQueryQuery = defineOffsetPaginationQuery().extend({
|
|
11
12
|
search: z.string().trim().max(255).optional(),
|
|
12
13
|
status: z.enum(USER_STATUS).optional(),
|
|
13
14
|
createdAtFrom: z.coerce.date().optional(),
|
|
14
|
-
createdAtTo:
|
|
15
|
+
createdAtTo: PERIOD_END.optional(),
|
|
16
|
+
depositedAtFrom: z.coerce.date().optional(),
|
|
17
|
+
depositedAtTo: PERIOD_END.optional(),
|
|
15
18
|
sortBy: SORT_BY.default('createdAt'),
|
|
16
19
|
sortOrder: SORT_ORDER.default('desc'),
|
|
17
20
|
});
|
|
@@ -21,3 +21,4 @@ export * from './get-admin-partner-referrals-deposits-stats.query';
|
|
|
21
21
|
export * from './get-admin-partner-referral-deposits.query';
|
|
22
22
|
export * from './get-admin-dashboard.query';
|
|
23
23
|
export * from './export-admin-dashboard.query';
|
|
24
|
+
export * from './get-admin-linked-account-clusters.query';
|
package/admin/enums/index.ts
CHANGED
|
@@ -6,3 +6,7 @@ export * from './admin-users-export-format.enum';
|
|
|
6
6
|
export * from './admin-partner-status.enum';
|
|
7
7
|
export * from './admin-dashboard-metric.enum';
|
|
8
8
|
export * from './admin-dashboard-export-format.enum';
|
|
9
|
+
export * from './linked-account-reason-type.enum';
|
|
10
|
+
export * from './linked-accounts-period.enum';
|
|
11
|
+
export * from './admin-bulk-ban-result.enum';
|
|
12
|
+
export * from './admin-bulk-ban-skip-reason.enum';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_ROLE, USER_STATUS } from '../../users';
|
|
3
|
+
import { LINKED_ACCOUNT_REASON_TYPE } from '../enums';
|
|
4
|
+
|
|
5
|
+
export const AdminLinkedAccountRefSchema = z.object({
|
|
6
|
+
uuid: z.uuid(),
|
|
7
|
+
email: z.email(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const AdminLinkedAccountReferrerSchema = AdminLinkedAccountRefSchema.extend({
|
|
11
|
+
inCluster: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const AdminLinkedAccountIpSchema = z.object({
|
|
15
|
+
ip: z.string(),
|
|
16
|
+
firstSeenAt: z.iso.datetime(),
|
|
17
|
+
lastSeenAt: z.iso.datetime(),
|
|
18
|
+
count: z.number().int().positive(),
|
|
19
|
+
userAgent: z.string().nullable(),
|
|
20
|
+
shared: z.boolean(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const AdminLinkedAccountReasonSchema = z.object({
|
|
24
|
+
type: z.enum(LINKED_ACCOUNT_REASON_TYPE),
|
|
25
|
+
value: z.string().nullable(),
|
|
26
|
+
linkedWith: z.array(AdminLinkedAccountRefSchema),
|
|
27
|
+
firstSeenAt: z.iso.datetime().nullable(),
|
|
28
|
+
lastSeenAt: z.iso.datetime().nullable(),
|
|
29
|
+
text: z.string(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const AdminLinkedAccountUserSchema = z.object({
|
|
33
|
+
uuid: z.uuid(),
|
|
34
|
+
email: z.email(),
|
|
35
|
+
name: z.string().nullable(),
|
|
36
|
+
status: z.enum(USER_STATUS),
|
|
37
|
+
role: z.enum(USER_ROLE),
|
|
38
|
+
cashBalance: z.number(),
|
|
39
|
+
bonusBalance: z.number(),
|
|
40
|
+
depositsTotal: z.number().nonnegative(),
|
|
41
|
+
referralBonusesTotal: z.number().nonnegative(),
|
|
42
|
+
createdAt: z.iso.datetime(),
|
|
43
|
+
lastLoginAt: z.iso.datetime().nullable(),
|
|
44
|
+
referrer: AdminLinkedAccountReferrerSchema.nullable(),
|
|
45
|
+
ips: z.array(AdminLinkedAccountIpSchema),
|
|
46
|
+
reasons: z.array(AdminLinkedAccountReasonSchema),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const AdminLinkedAccountClusterSchema = z.object({
|
|
50
|
+
size: z.number().int().positive(),
|
|
51
|
+
depositsTotal: z.number().nonnegative(),
|
|
52
|
+
referralBonusesTotal: z.number().nonnegative(),
|
|
53
|
+
hasSelfReferral: z.boolean(),
|
|
54
|
+
users: z.array(AdminLinkedAccountUserSchema),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type AdminLinkedAccountRefSchemaType = z.infer<typeof AdminLinkedAccountRefSchema>;
|
|
58
|
+
export type AdminLinkedAccountReferrerSchemaType = z.infer<typeof AdminLinkedAccountReferrerSchema>;
|
|
59
|
+
export type AdminLinkedAccountIpSchemaType = z.infer<typeof AdminLinkedAccountIpSchema>;
|
|
60
|
+
export type AdminLinkedAccountReasonSchemaType = z.infer<typeof AdminLinkedAccountReasonSchema>;
|
|
61
|
+
export type AdminLinkedAccountUserSchemaType = z.infer<typeof AdminLinkedAccountUserSchema>;
|
|
62
|
+
export type AdminLinkedAccountClusterSchemaType = z.infer<typeof AdminLinkedAccountClusterSchema>;
|
package/admin/models/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare const ADMIN_ROUTES: {
|
|
|
21
21
|
readonly GET_USER: (userId: string) => string;
|
|
22
22
|
readonly GET_USER_TRANSACTIONS: (userId: string) => string;
|
|
23
23
|
readonly BAN_USER: (userId: string) => string;
|
|
24
|
+
readonly BAN_USERS: "users/ban";
|
|
25
|
+
readonly GET_LINKED_ACCOUNT_CLUSTERS: "linked-accounts/clusters";
|
|
24
26
|
readonly GET_SUPPORT_CHATS: "support/chats";
|
|
25
27
|
readonly GET_SUPPORT_CHAT_MESSAGES: (userId: string) => string;
|
|
26
28
|
readonly SEND_SUPPORT_REPLY: (userId: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../admin/endpoints/admin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;sCAGI,MAAM;gDACI,MAAM;iDACL,MAAM;sDACD,MAAM;yDACH,MAAM;kDACb,MAAM;+DACO,MAAM;wDACb,MAAM,aAAa,MAAM;uDAE1B,MAAM;yDACJ,MAAM;;;;;;;;gCAgB/B,MAAM;6CACO,MAAM;gCACnB,MAAM
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../admin/endpoints/admin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;sCAGI,MAAM;gDACI,MAAM;iDACL,MAAM;sDACD,MAAM;yDACH,MAAM;kDACb,MAAM;+DACO,MAAM;wDACb,MAAM,aAAa,MAAM;uDAE1B,MAAM;yDACJ,MAAM;;;;;;;;gCAgB/B,MAAM;6CACO,MAAM;gCACnB,MAAM;;;;iDAQW,MAAM;0CACb,MAAM;8CACF,MAAM;;;gCAKpB,MAAM;mCACH,MAAM;mCACN,MAAM;0CACC,MAAM;;;6CAKH,MAAM;6CACN,MAAM;;;CAKhC,CAAC"}
|
|
@@ -29,6 +29,9 @@ exports.ADMIN_ROUTES = {
|
|
|
29
29
|
GET_USER: (userId) => `users/${userId}`,
|
|
30
30
|
GET_USER_TRANSACTIONS: (userId) => `users/${userId}/transactions`,
|
|
31
31
|
BAN_USER: (userId) => `users/${userId}/ban`,
|
|
32
|
+
BAN_USERS: 'users/ban',
|
|
33
|
+
// LINKED ACCOUNTS
|
|
34
|
+
GET_LINKED_ACCOUNT_CLUSTERS: 'linked-accounts/clusters',
|
|
32
35
|
// SUPPORT
|
|
33
36
|
GET_SUPPORT_CHATS: 'support/chats',
|
|
34
37
|
GET_SUPPORT_CHAT_MESSAGES: (userId) => `support/chats/${userId}/messages`,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../../_common';
|
|
3
|
+
import { ADMIN_BULK_BAN_RESULT, ADMIN_BULK_BAN_SKIP_REASON } from '../../enums';
|
|
4
|
+
export declare const ADMIN_BULK_BAN_MAX_USERS = 100;
|
|
5
|
+
export declare const BanAdminUsersCommandBody: z.ZodObject<{
|
|
6
|
+
userIds: z.ZodArray<z.ZodUUID>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const AdminBulkBanItemResultSchema: z.ZodObject<{
|
|
9
|
+
userId: z.ZodUUID;
|
|
10
|
+
result: z.ZodEnum<typeof ADMIN_BULK_BAN_RESULT>;
|
|
11
|
+
reason: z.ZodNullable<z.ZodEnum<typeof ADMIN_BULK_BAN_SKIP_REASON>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const BanAdminUsersCommandResponse: z.ZodObject<{
|
|
14
|
+
results: z.ZodArray<z.ZodObject<{
|
|
15
|
+
userId: z.ZodUUID;
|
|
16
|
+
result: z.ZodEnum<typeof ADMIN_BULK_BAN_RESULT>;
|
|
17
|
+
reason: z.ZodNullable<z.ZodEnum<typeof ADMIN_BULK_BAN_SKIP_REASON>>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const BanAdminUsersCommand: {
|
|
21
|
+
method: HTTP_METHODS.POST;
|
|
22
|
+
path: "users/ban";
|
|
23
|
+
summary: string;
|
|
24
|
+
request: {
|
|
25
|
+
body: z.ZodObject<{
|
|
26
|
+
userIds: z.ZodArray<z.ZodUUID>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
};
|
|
29
|
+
responses: {
|
|
30
|
+
200: z.ZodObject<{
|
|
31
|
+
results: z.ZodArray<z.ZodObject<{
|
|
32
|
+
userId: z.ZodUUID;
|
|
33
|
+
result: z.ZodEnum<typeof ADMIN_BULK_BAN_RESULT>;
|
|
34
|
+
reason: z.ZodNullable<z.ZodEnum<typeof ADMIN_BULK_BAN_SKIP_REASON>>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
400: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
38
|
+
401: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
39
|
+
403: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
40
|
+
500: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type BanAdminUsersCommandBodyType = z.infer<typeof BanAdminUsersCommandBody>;
|
|
44
|
+
export type AdminBulkBanItemResultSchemaType = z.infer<typeof AdminBulkBanItemResultSchema>;
|
|
45
|
+
export type BanAdminUsersCommandResponseType = z.infer<typeof BanAdminUsersCommandResponse>;
|
|
46
|
+
//# sourceMappingURL=ban-admin-users.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ban-admin-users.command.d.ts","sourceRoot":"","sources":["../../../../admin/endpoints/commands/ban-admin-users.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAGhF,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,eAAO,MAAM,wBAAwB;;iBAMnC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;iBAEvC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;CAc/B,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACpF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAC5F,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BanAdminUsersCommand = exports.BanAdminUsersCommandResponse = exports.AdminBulkBanItemResultSchema = exports.BanAdminUsersCommandBody = exports.ADMIN_BULK_BAN_MAX_USERS = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const _common_1 = require("../../../_common");
|
|
6
|
+
const enums_1 = require("../../enums");
|
|
7
|
+
const admin_1 = require("../admin");
|
|
8
|
+
exports.ADMIN_BULK_BAN_MAX_USERS = 100;
|
|
9
|
+
exports.BanAdminUsersCommandBody = zod_1.z.object({
|
|
10
|
+
userIds: zod_1.z
|
|
11
|
+
.array(zod_1.z.uuid())
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(exports.ADMIN_BULK_BAN_MAX_USERS)
|
|
14
|
+
.refine((userIds) => new Set(userIds).size === userIds.length, 'userIds не должны повторяться'),
|
|
15
|
+
});
|
|
16
|
+
exports.AdminBulkBanItemResultSchema = zod_1.z.object({
|
|
17
|
+
userId: zod_1.z.uuid(),
|
|
18
|
+
result: zod_1.z.enum(enums_1.ADMIN_BULK_BAN_RESULT),
|
|
19
|
+
reason: zod_1.z.enum(enums_1.ADMIN_BULK_BAN_SKIP_REASON).nullable(),
|
|
20
|
+
});
|
|
21
|
+
exports.BanAdminUsersCommandResponse = zod_1.z.object({
|
|
22
|
+
results: zod_1.z.array(exports.AdminBulkBanItemResultSchema),
|
|
23
|
+
});
|
|
24
|
+
exports.BanAdminUsersCommand = (0, _common_1.defineContract)({
|
|
25
|
+
method: _common_1.HTTP_METHODS.POST,
|
|
26
|
+
path: admin_1.ADMIN_ROUTES.BAN_USERS,
|
|
27
|
+
summary: 'Ban several users at once, returning a per-user result',
|
|
28
|
+
request: {
|
|
29
|
+
body: exports.BanAdminUsersCommandBody,
|
|
30
|
+
},
|
|
31
|
+
responses: {
|
|
32
|
+
200: exports.BanAdminUsersCommandResponse,
|
|
33
|
+
400: _common_1.HttpErrorResponseSchema,
|
|
34
|
+
401: _common_1.HttpErrorResponseSchema,
|
|
35
|
+
403: _common_1.HttpErrorResponseSchema,
|
|
36
|
+
500: _common_1.HttpErrorResponseSchema,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -12,4 +12,5 @@ export * from './create-admin-model-family.command';
|
|
|
12
12
|
export * from './update-admin-model-family.command';
|
|
13
13
|
export * from './delete-admin-model-family.command';
|
|
14
14
|
export * from './update-admin-organization.command';
|
|
15
|
+
export * from './ban-admin-users.command';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../admin/endpoints/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../admin/endpoints/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC"}
|
|
@@ -28,3 +28,4 @@ __exportStar(require("./create-admin-model-family.command"), exports);
|
|
|
28
28
|
__exportStar(require("./update-admin-model-family.command"), exports);
|
|
29
29
|
__exportStar(require("./delete-admin-model-family.command"), exports);
|
|
30
30
|
__exportStar(require("./update-admin-organization.command"), exports);
|
|
31
|
+
__exportStar(require("./ban-admin-users.command"), exports);
|
|
@@ -6,7 +6,9 @@ export declare const ExportAdminUsersQueryQuery: z.ZodObject<{
|
|
|
6
6
|
search: z.ZodOptional<z.ZodString>;
|
|
7
7
|
status: z.ZodOptional<z.ZodEnum<typeof import("../../..").USER_STATUS>>;
|
|
8
8
|
createdAtFrom: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
9
|
-
createdAtTo: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
9
|
+
createdAtTo: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodISODate, z.ZodTransform<Date, string>>, z.ZodCoercedDate<unknown>]>>;
|
|
10
|
+
depositedAtFrom: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
11
|
+
depositedAtTo: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodISODate, z.ZodTransform<Date, string>>, z.ZodCoercedDate<unknown>]>>;
|
|
10
12
|
sortBy: z.ZodDefault<z.ZodEnum<{
|
|
11
13
|
createdAt: "createdAt";
|
|
12
14
|
cashBalance: "cashBalance";
|
|
@@ -33,7 +35,9 @@ export declare const ExportAdminUsersQuery: {
|
|
|
33
35
|
search: z.ZodOptional<z.ZodString>;
|
|
34
36
|
status: z.ZodOptional<z.ZodEnum<typeof import("../../..").USER_STATUS>>;
|
|
35
37
|
createdAtFrom: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
36
|
-
createdAtTo: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
38
|
+
createdAtTo: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodISODate, z.ZodTransform<Date, string>>, z.ZodCoercedDate<unknown>]>>;
|
|
39
|
+
depositedAtFrom: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
40
|
+
depositedAtTo: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodISODate, z.ZodTransform<Date, string>>, z.ZodCoercedDate<unknown>]>>;
|
|
37
41
|
sortBy: z.ZodDefault<z.ZodEnum<{
|
|
38
42
|
createdAt: "createdAt";
|
|
39
43
|
cashBalance: "cashBalance";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-admin-users.query.d.ts","sourceRoot":"","sources":["../../../../admin/endpoints/queries/export-admin-users.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAKxD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"export-admin-users.query.d.ts","sourceRoot":"","sources":["../../../../admin/endpoints/queries/export-admin-users.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAKxD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;iBAKrC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;iBAExC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAehC,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACxF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../../_common';
|
|
3
|
+
import { LINKED_ACCOUNTS_PERIOD } from '../../enums';
|
|
4
|
+
export declare const LINKED_ACCOUNT_CLUSTER_DEFAULT_MIN_SIZE = 2;
|
|
5
|
+
export declare const GetAdminLinkedAccountClustersQueryQuery: z.ZodObject<{
|
|
6
|
+
page: z.ZodOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
7
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
8
|
+
period: z.ZodOptional<z.ZodEnum<typeof LINKED_ACCOUNTS_PERIOD>>;
|
|
9
|
+
from: z.ZodOptional<z.ZodISODate>;
|
|
10
|
+
to: z.ZodOptional<z.ZodISODate>;
|
|
11
|
+
minSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
hasUnbanned: z.ZodOptional<z.ZodCodec<z.ZodString, z.ZodBoolean>>;
|
|
13
|
+
sortBy: z.ZodDefault<z.ZodEnum<{
|
|
14
|
+
size: "size";
|
|
15
|
+
referralBonusesTotal: "referralBonusesTotal";
|
|
16
|
+
}>>;
|
|
17
|
+
sortOrder: z.ZodDefault<z.ZodEnum<{
|
|
18
|
+
asc: "asc";
|
|
19
|
+
desc: "desc";
|
|
20
|
+
}>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const GetAdminLinkedAccountClustersQueryResponse: z.ZodObject<{
|
|
23
|
+
clusters: z.ZodArray<z.ZodObject<{
|
|
24
|
+
size: z.ZodNumber;
|
|
25
|
+
depositsTotal: z.ZodNumber;
|
|
26
|
+
referralBonusesTotal: z.ZodNumber;
|
|
27
|
+
hasSelfReferral: z.ZodBoolean;
|
|
28
|
+
users: z.ZodArray<z.ZodObject<{
|
|
29
|
+
uuid: z.ZodUUID;
|
|
30
|
+
email: z.ZodEmail;
|
|
31
|
+
name: z.ZodNullable<z.ZodString>;
|
|
32
|
+
status: z.ZodEnum<typeof import("../../..").USER_STATUS>;
|
|
33
|
+
role: z.ZodEnum<typeof import("../../..").USER_ROLE>;
|
|
34
|
+
cashBalance: z.ZodNumber;
|
|
35
|
+
bonusBalance: z.ZodNumber;
|
|
36
|
+
depositsTotal: z.ZodNumber;
|
|
37
|
+
referralBonusesTotal: z.ZodNumber;
|
|
38
|
+
createdAt: z.ZodISODateTime;
|
|
39
|
+
lastLoginAt: z.ZodNullable<z.ZodISODateTime>;
|
|
40
|
+
referrer: z.ZodNullable<z.ZodObject<{
|
|
41
|
+
uuid: z.ZodUUID;
|
|
42
|
+
email: z.ZodEmail;
|
|
43
|
+
inCluster: z.ZodBoolean;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
ips: z.ZodArray<z.ZodObject<{
|
|
46
|
+
ip: z.ZodString;
|
|
47
|
+
firstSeenAt: z.ZodISODateTime;
|
|
48
|
+
lastSeenAt: z.ZodISODateTime;
|
|
49
|
+
count: z.ZodNumber;
|
|
50
|
+
userAgent: z.ZodNullable<z.ZodString>;
|
|
51
|
+
shared: z.ZodBoolean;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
reasons: z.ZodArray<z.ZodObject<{
|
|
54
|
+
type: z.ZodEnum<typeof import("../../enums").LINKED_ACCOUNT_REASON_TYPE>;
|
|
55
|
+
value: z.ZodNullable<z.ZodString>;
|
|
56
|
+
linkedWith: z.ZodArray<z.ZodObject<{
|
|
57
|
+
uuid: z.ZodUUID;
|
|
58
|
+
email: z.ZodEmail;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
firstSeenAt: z.ZodNullable<z.ZodISODateTime>;
|
|
61
|
+
lastSeenAt: z.ZodNullable<z.ZodISODateTime>;
|
|
62
|
+
text: z.ZodString;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
total: z.ZodNumber;
|
|
67
|
+
page: z.ZodNumber;
|
|
68
|
+
limit: z.ZodNumber;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export declare const GetAdminLinkedAccountClustersQuery: {
|
|
71
|
+
method: HTTP_METHODS.GET;
|
|
72
|
+
path: "linked-accounts/clusters";
|
|
73
|
+
summary: string;
|
|
74
|
+
request: {
|
|
75
|
+
query: z.ZodObject<{
|
|
76
|
+
page: z.ZodOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
77
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
78
|
+
period: z.ZodOptional<z.ZodEnum<typeof LINKED_ACCOUNTS_PERIOD>>;
|
|
79
|
+
from: z.ZodOptional<z.ZodISODate>;
|
|
80
|
+
to: z.ZodOptional<z.ZodISODate>;
|
|
81
|
+
minSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
82
|
+
hasUnbanned: z.ZodOptional<z.ZodCodec<z.ZodString, z.ZodBoolean>>;
|
|
83
|
+
sortBy: z.ZodDefault<z.ZodEnum<{
|
|
84
|
+
size: "size";
|
|
85
|
+
referralBonusesTotal: "referralBonusesTotal";
|
|
86
|
+
}>>;
|
|
87
|
+
sortOrder: z.ZodDefault<z.ZodEnum<{
|
|
88
|
+
asc: "asc";
|
|
89
|
+
desc: "desc";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
};
|
|
93
|
+
responses: {
|
|
94
|
+
200: z.ZodObject<{
|
|
95
|
+
clusters: z.ZodArray<z.ZodObject<{
|
|
96
|
+
size: z.ZodNumber;
|
|
97
|
+
depositsTotal: z.ZodNumber;
|
|
98
|
+
referralBonusesTotal: z.ZodNumber;
|
|
99
|
+
hasSelfReferral: z.ZodBoolean;
|
|
100
|
+
users: z.ZodArray<z.ZodObject<{
|
|
101
|
+
uuid: z.ZodUUID;
|
|
102
|
+
email: z.ZodEmail;
|
|
103
|
+
name: z.ZodNullable<z.ZodString>;
|
|
104
|
+
status: z.ZodEnum<typeof import("../../..").USER_STATUS>;
|
|
105
|
+
role: z.ZodEnum<typeof import("../../..").USER_ROLE>;
|
|
106
|
+
cashBalance: z.ZodNumber;
|
|
107
|
+
bonusBalance: z.ZodNumber;
|
|
108
|
+
depositsTotal: z.ZodNumber;
|
|
109
|
+
referralBonusesTotal: z.ZodNumber;
|
|
110
|
+
createdAt: z.ZodISODateTime;
|
|
111
|
+
lastLoginAt: z.ZodNullable<z.ZodISODateTime>;
|
|
112
|
+
referrer: z.ZodNullable<z.ZodObject<{
|
|
113
|
+
uuid: z.ZodUUID;
|
|
114
|
+
email: z.ZodEmail;
|
|
115
|
+
inCluster: z.ZodBoolean;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
ips: z.ZodArray<z.ZodObject<{
|
|
118
|
+
ip: z.ZodString;
|
|
119
|
+
firstSeenAt: z.ZodISODateTime;
|
|
120
|
+
lastSeenAt: z.ZodISODateTime;
|
|
121
|
+
count: z.ZodNumber;
|
|
122
|
+
userAgent: z.ZodNullable<z.ZodString>;
|
|
123
|
+
shared: z.ZodBoolean;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
reasons: z.ZodArray<z.ZodObject<{
|
|
126
|
+
type: z.ZodEnum<typeof import("../../enums").LINKED_ACCOUNT_REASON_TYPE>;
|
|
127
|
+
value: z.ZodNullable<z.ZodString>;
|
|
128
|
+
linkedWith: z.ZodArray<z.ZodObject<{
|
|
129
|
+
uuid: z.ZodUUID;
|
|
130
|
+
email: z.ZodEmail;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
firstSeenAt: z.ZodNullable<z.ZodISODateTime>;
|
|
133
|
+
lastSeenAt: z.ZodNullable<z.ZodISODateTime>;
|
|
134
|
+
text: z.ZodString;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
total: z.ZodNumber;
|
|
139
|
+
page: z.ZodNumber;
|
|
140
|
+
limit: z.ZodNumber;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
400: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
143
|
+
401: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
144
|
+
403: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
145
|
+
500: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
export type GetAdminLinkedAccountClustersQueryQueryType = z.infer<typeof GetAdminLinkedAccountClustersQueryQuery>;
|
|
149
|
+
export type GetAdminLinkedAccountClustersQueryResponseType = z.infer<typeof GetAdminLinkedAccountClustersQueryResponse>;
|
|
150
|
+
//# sourceMappingURL=get-admin-linked-account-clusters.query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-admin-linked-account-clusters.query.d.ts","sourceRoot":"","sources":["../../../../admin/endpoints/queries/get-admin-linked-account-clusters.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA+C,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AACtH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIrD,eAAO,MAAM,uCAAuC,IAAI,CAAC;AAKzD,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;iBAiB9C,CAAC;AAEP,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKrD,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAe7C,CAAC;AAEH,MAAM,MAAM,2CAA2C,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAClH,MAAM,MAAM,8CAA8C,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0CAA0C,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAdminLinkedAccountClustersQuery = exports.GetAdminLinkedAccountClustersQueryResponse = exports.GetAdminLinkedAccountClustersQueryQuery = exports.LINKED_ACCOUNT_CLUSTER_DEFAULT_MIN_SIZE = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const _common_1 = require("../../../_common");
|
|
6
|
+
const enums_1 = require("../../enums");
|
|
7
|
+
const models_1 = require("../../models");
|
|
8
|
+
const admin_1 = require("../admin");
|
|
9
|
+
exports.LINKED_ACCOUNT_CLUSTER_DEFAULT_MIN_SIZE = 2;
|
|
10
|
+
const SORT_ORDER = zod_1.z.enum(['asc', 'desc']);
|
|
11
|
+
const SORT_BY = zod_1.z.enum(['size', 'referralBonusesTotal']);
|
|
12
|
+
exports.GetAdminLinkedAccountClustersQueryQuery = (0, _common_1.defineOffsetPaginationQuery)()
|
|
13
|
+
.extend({
|
|
14
|
+
period: zod_1.z.enum(enums_1.LINKED_ACCOUNTS_PERIOD).optional(),
|
|
15
|
+
from: zod_1.z.iso.date().optional(),
|
|
16
|
+
to: zod_1.z.iso.date().optional(),
|
|
17
|
+
minSize: zod_1.z.coerce.number().int().min(2).default(exports.LINKED_ACCOUNT_CLUSTER_DEFAULT_MIN_SIZE),
|
|
18
|
+
hasUnbanned: zod_1.z.stringbool().optional(),
|
|
19
|
+
sortBy: SORT_BY.default('size'),
|
|
20
|
+
sortOrder: SORT_ORDER.default('desc'),
|
|
21
|
+
})
|
|
22
|
+
.refine((query) => !(query.period && (query.from || query.to)), {
|
|
23
|
+
message: 'Нельзя одновременно передавать period и from/to',
|
|
24
|
+
path: ['period'],
|
|
25
|
+
})
|
|
26
|
+
.refine((query) => !(query.from && query.to && query.from > query.to), {
|
|
27
|
+
message: 'from не может быть позже to',
|
|
28
|
+
path: ['from'],
|
|
29
|
+
});
|
|
30
|
+
exports.GetAdminLinkedAccountClustersQueryResponse = zod_1.z.object({
|
|
31
|
+
clusters: zod_1.z.array(models_1.AdminLinkedAccountClusterSchema),
|
|
32
|
+
total: zod_1.z.number().int().nonnegative(),
|
|
33
|
+
page: zod_1.z.number().int().positive(),
|
|
34
|
+
limit: zod_1.z.number().int().positive(),
|
|
35
|
+
});
|
|
36
|
+
exports.GetAdminLinkedAccountClustersQuery = (0, _common_1.defineContract)({
|
|
37
|
+
method: _common_1.HTTP_METHODS.GET,
|
|
38
|
+
path: admin_1.ADMIN_ROUTES.GET_LINKED_ACCOUNT_CLUSTERS,
|
|
39
|
+
summary: 'Get clusters of accounts linked by shared signals within a period (Moscow day boundaries, defaults to the last 7 days)',
|
|
40
|
+
request: {
|
|
41
|
+
query: exports.GetAdminLinkedAccountClustersQueryQuery,
|
|
42
|
+
},
|
|
43
|
+
responses: {
|
|
44
|
+
200: exports.GetAdminLinkedAccountClustersQueryResponse,
|
|
45
|
+
400: _common_1.HttpErrorResponseSchema,
|
|
46
|
+
401: _common_1.HttpErrorResponseSchema,
|
|
47
|
+
403: _common_1.HttpErrorResponseSchema,
|
|
48
|
+
500: _common_1.HttpErrorResponseSchema,
|
|
49
|
+
},
|
|
50
|
+
});
|