@purpleschool/multisite 0.0.18 → 0.0.20
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/controller/http/subscription.ts +5 -1
- package/api/controller/http/user.ts +7 -0
- package/api/routes.ts +21 -1
- package/build/api/controller/http/subscription.d.ts +5 -1
- package/build/api/controller/http/subscription.d.ts.map +1 -1
- package/build/api/controller/http/subscription.js +5 -1
- package/build/api/controller/http/user.d.ts +7 -0
- package/build/api/controller/http/user.d.ts.map +1 -1
- package/build/api/controller/http/user.js +7 -0
- package/build/api/routes.d.ts +11 -0
- package/build/api/routes.d.ts.map +1 -1
- package/build/api/routes.js +12 -1
- package/build/commands/subscription/delete-subscription.command.d.ts +20 -0
- package/build/commands/subscription/delete-subscription.command.d.ts.map +1 -0
- package/build/commands/subscription/delete-subscription.command.js +13 -0
- package/build/commands/subscription/index.d.ts +4 -0
- package/build/commands/subscription/index.d.ts.map +1 -1
- package/build/commands/subscription/index.js +4 -0
- package/build/commands/subscription/recover-subscription.command.d.ts +14 -0
- package/build/commands/subscription/recover-subscription.command.d.ts.map +1 -0
- package/build/commands/subscription/recover-subscription.command.js +11 -0
- package/build/commands/subscription/refund-subscription.command.d.ts +20 -0
- package/build/commands/subscription/refund-subscription.command.d.ts.map +1 -0
- package/build/commands/subscription/refund-subscription.command.js +13 -0
- package/build/commands/subscription/update-subscription.command.d.ts +148 -0
- package/build/commands/subscription/update-subscription.command.d.ts.map +1 -0
- package/build/commands/subscription/update-subscription.command.js +30 -0
- package/build/constants/cloud-payments/index.d.ts +1 -0
- package/build/constants/cloud-payments/index.d.ts.map +1 -1
- package/build/constants/cloud-payments/index.js +2 -1
- package/build/constants/errors/errors.d.ts +10 -0
- package/build/constants/errors/errors.d.ts.map +1 -1
- package/build/constants/errors/errors.js +10 -0
- package/build/queries/user/find-users.command.d.ts +99 -0
- package/build/queries/user/find-users.command.d.ts.map +1 -0
- package/build/queries/user/find-users.command.js +29 -0
- package/build/queries/user/get-all-users.command.d.ts +48 -0
- package/build/queries/user/get-all-users.command.d.ts.map +1 -0
- package/build/queries/user/get-all-users.command.js +18 -0
- package/build/queries/user/get-my-subscriptions.command.d.ts +5 -0
- package/build/queries/user/get-my-subscriptions.command.d.ts.map +1 -1
- package/build/queries/user/get-my-subscriptions.command.js +1 -0
- package/build/queries/user/get-user-payments.command.d.ts +134 -0
- package/build/queries/user/get-user-payments.command.d.ts.map +1 -0
- package/build/queries/user/get-user-payments.command.js +27 -0
- package/build/queries/user/get-user.command.d.ts +11 -1
- package/build/queries/user/get-user.command.d.ts.map +1 -1
- package/build/queries/user/get-user.command.js +2 -0
- package/build/queries/user/index.d.ts +3 -0
- package/build/queries/user/index.d.ts.map +1 -1
- package/build/queries/user/index.js +3 -0
- package/commands/subscription/delete-subscription.command.ts +13 -0
- package/commands/subscription/index.ts +4 -0
- package/commands/subscription/recover-subscription.command.ts +11 -0
- package/commands/subscription/refund-subscription.command.ts +13 -0
- package/commands/subscription/update-subscription.command.ts +34 -0
- package/constants/cloud-payments/index.ts +1 -0
- package/constants/errors/errors.ts +10 -0
- package/package.json +1 -1
- package/queries/user/find-users.command.ts +31 -0
- package/queries/user/get-all-users.command.ts +19 -0
- package/queries/user/get-my-subscriptions.command.ts +1 -0
- package/queries/user/get-user-payments.command.ts +26 -0
- package/queries/user/get-user.command.ts +3 -1
- package/queries/user/index.ts +3 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_ROLE, USER_STATUS } from '../../constants';
|
|
3
|
+
export declare namespace FindUsersCommand {
|
|
4
|
+
const RequestQuerySchema: z.ZodObject<{
|
|
5
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
6
|
+
email: z.ZodOptional<z.ZodString>;
|
|
7
|
+
role: z.ZodOptional<z.ZodNativeEnum<typeof USER_ROLE>>;
|
|
8
|
+
status: z.ZodOptional<z.ZodNativeEnum<typeof USER_STATUS>>;
|
|
9
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
10
|
+
offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
email?: string | undefined;
|
|
13
|
+
uuid?: string | undefined;
|
|
14
|
+
role?: USER_ROLE | undefined;
|
|
15
|
+
status?: USER_STATUS | undefined;
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
offset?: number | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
email?: string | undefined;
|
|
20
|
+
uuid?: string | undefined;
|
|
21
|
+
role?: USER_ROLE | undefined;
|
|
22
|
+
status?: USER_STATUS | undefined;
|
|
23
|
+
limit?: number | undefined;
|
|
24
|
+
offset?: number | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
27
|
+
const ResponseItemSchema: z.ZodObject<{
|
|
28
|
+
uuid: z.ZodString;
|
|
29
|
+
email: z.ZodString;
|
|
30
|
+
role: z.ZodNativeEnum<typeof USER_ROLE>;
|
|
31
|
+
status: z.ZodNativeEnum<typeof USER_STATUS>;
|
|
32
|
+
siteId: z.ZodString;
|
|
33
|
+
tokenBonusBalance: z.ZodNumber;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
email: string;
|
|
36
|
+
uuid: string;
|
|
37
|
+
siteId: string;
|
|
38
|
+
role: USER_ROLE;
|
|
39
|
+
status: USER_STATUS;
|
|
40
|
+
tokenBonusBalance: number;
|
|
41
|
+
}, {
|
|
42
|
+
email: string;
|
|
43
|
+
uuid: string;
|
|
44
|
+
siteId: string;
|
|
45
|
+
role: USER_ROLE;
|
|
46
|
+
status: USER_STATUS;
|
|
47
|
+
tokenBonusBalance: number;
|
|
48
|
+
}>;
|
|
49
|
+
const ResponseSchema: z.ZodObject<{
|
|
50
|
+
data: z.ZodArray<z.ZodObject<{
|
|
51
|
+
uuid: z.ZodString;
|
|
52
|
+
email: z.ZodString;
|
|
53
|
+
role: z.ZodNativeEnum<typeof USER_ROLE>;
|
|
54
|
+
status: z.ZodNativeEnum<typeof USER_STATUS>;
|
|
55
|
+
siteId: z.ZodString;
|
|
56
|
+
tokenBonusBalance: z.ZodNumber;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
email: string;
|
|
59
|
+
uuid: string;
|
|
60
|
+
siteId: string;
|
|
61
|
+
role: USER_ROLE;
|
|
62
|
+
status: USER_STATUS;
|
|
63
|
+
tokenBonusBalance: number;
|
|
64
|
+
}, {
|
|
65
|
+
email: string;
|
|
66
|
+
uuid: string;
|
|
67
|
+
siteId: string;
|
|
68
|
+
role: USER_ROLE;
|
|
69
|
+
status: USER_STATUS;
|
|
70
|
+
tokenBonusBalance: number;
|
|
71
|
+
}>, "many">;
|
|
72
|
+
totalPages: z.ZodNumber;
|
|
73
|
+
page: z.ZodNumber;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
page: number;
|
|
76
|
+
data: {
|
|
77
|
+
email: string;
|
|
78
|
+
uuid: string;
|
|
79
|
+
siteId: string;
|
|
80
|
+
role: USER_ROLE;
|
|
81
|
+
status: USER_STATUS;
|
|
82
|
+
tokenBonusBalance: number;
|
|
83
|
+
}[];
|
|
84
|
+
totalPages: number;
|
|
85
|
+
}, {
|
|
86
|
+
page: number;
|
|
87
|
+
data: {
|
|
88
|
+
email: string;
|
|
89
|
+
uuid: string;
|
|
90
|
+
siteId: string;
|
|
91
|
+
role: USER_ROLE;
|
|
92
|
+
status: USER_STATUS;
|
|
93
|
+
tokenBonusBalance: number;
|
|
94
|
+
}[];
|
|
95
|
+
totalPages: number;
|
|
96
|
+
}>;
|
|
97
|
+
type Response = z.infer<typeof ResponseSchema>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=find-users.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-users.command.d.ts","sourceRoot":"","sources":["../../../queries/user/find-users.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,gBAAgB,CAAC;IACvB,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;MAO7B,CAAC;IAEH,KAAY,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAEvD,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;MAO7B,CAAC;IAEI,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindUsersCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var FindUsersCommand;
|
|
7
|
+
(function (FindUsersCommand) {
|
|
8
|
+
FindUsersCommand.RequestQuerySchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid().optional(),
|
|
10
|
+
email: zod_1.z.string().email().optional(),
|
|
11
|
+
role: zod_1.z.nativeEnum(constants_1.USER_ROLE).optional(),
|
|
12
|
+
status: zod_1.z.nativeEnum(constants_1.USER_STATUS).optional(),
|
|
13
|
+
limit: zod_1.z.coerce.number().int().min(1).default(20).optional(),
|
|
14
|
+
offset: zod_1.z.coerce.number().int().min(0).default(0).optional(),
|
|
15
|
+
});
|
|
16
|
+
FindUsersCommand.ResponseItemSchema = zod_1.z.object({
|
|
17
|
+
uuid: zod_1.z.string().uuid(),
|
|
18
|
+
email: zod_1.z.string().email(),
|
|
19
|
+
role: zod_1.z.nativeEnum(constants_1.USER_ROLE),
|
|
20
|
+
status: zod_1.z.nativeEnum(constants_1.USER_STATUS),
|
|
21
|
+
siteId: zod_1.z.string().uuid(),
|
|
22
|
+
tokenBonusBalance: zod_1.z.number().int(),
|
|
23
|
+
});
|
|
24
|
+
FindUsersCommand.ResponseSchema = zod_1.z.object({
|
|
25
|
+
data: zod_1.z.array(FindUsersCommand.ResponseItemSchema),
|
|
26
|
+
totalPages: zod_1.z.number().int(),
|
|
27
|
+
page: zod_1.z.number().int(),
|
|
28
|
+
});
|
|
29
|
+
})(FindUsersCommand || (exports.FindUsersCommand = FindUsersCommand = {}));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_ROLE, USER_STATUS } from '../../constants';
|
|
3
|
+
export declare namespace GetAllUsersCommand {
|
|
4
|
+
const ResponseSchema: z.ZodObject<{
|
|
5
|
+
data: z.ZodArray<z.ZodObject<{
|
|
6
|
+
uuid: z.ZodString;
|
|
7
|
+
email: z.ZodString;
|
|
8
|
+
role: z.ZodNativeEnum<typeof USER_ROLE>;
|
|
9
|
+
status: z.ZodNativeEnum<typeof USER_STATUS>;
|
|
10
|
+
siteId: z.ZodString;
|
|
11
|
+
tokenBonusBalance: z.ZodNumber;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
email: string;
|
|
14
|
+
uuid: string;
|
|
15
|
+
siteId: string;
|
|
16
|
+
role: USER_ROLE;
|
|
17
|
+
status: USER_STATUS;
|
|
18
|
+
tokenBonusBalance: number;
|
|
19
|
+
}, {
|
|
20
|
+
email: string;
|
|
21
|
+
uuid: string;
|
|
22
|
+
siteId: string;
|
|
23
|
+
role: USER_ROLE;
|
|
24
|
+
status: USER_STATUS;
|
|
25
|
+
tokenBonusBalance: number;
|
|
26
|
+
}>, "many">;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
data: {
|
|
29
|
+
email: string;
|
|
30
|
+
uuid: string;
|
|
31
|
+
siteId: string;
|
|
32
|
+
role: USER_ROLE;
|
|
33
|
+
status: USER_STATUS;
|
|
34
|
+
tokenBonusBalance: number;
|
|
35
|
+
}[];
|
|
36
|
+
}, {
|
|
37
|
+
data: {
|
|
38
|
+
email: string;
|
|
39
|
+
uuid: string;
|
|
40
|
+
siteId: string;
|
|
41
|
+
role: USER_ROLE;
|
|
42
|
+
status: USER_STATUS;
|
|
43
|
+
tokenBonusBalance: number;
|
|
44
|
+
}[];
|
|
45
|
+
}>;
|
|
46
|
+
type Response = z.infer<typeof ResponseSchema>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=get-all-users.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-users.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-all-users.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,kBAAkB,CAAC;IACzB,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAllUsersCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetAllUsersCommand;
|
|
7
|
+
(function (GetAllUsersCommand) {
|
|
8
|
+
GetAllUsersCommand.ResponseSchema = zod_1.z.object({
|
|
9
|
+
data: zod_1.z.array(zod_1.z.object({
|
|
10
|
+
uuid: zod_1.z.string().uuid(),
|
|
11
|
+
email: zod_1.z.string().email(),
|
|
12
|
+
role: zod_1.z.nativeEnum(constants_1.USER_ROLE),
|
|
13
|
+
status: zod_1.z.nativeEnum(constants_1.USER_STATUS),
|
|
14
|
+
siteId: zod_1.z.string().uuid(),
|
|
15
|
+
tokenBonusBalance: zod_1.z.number().int(),
|
|
16
|
+
})),
|
|
17
|
+
});
|
|
18
|
+
})(GetAllUsersCommand || (exports.GetAllUsersCommand = GetAllUsersCommand = {}));
|
|
@@ -9,6 +9,7 @@ export declare namespace GetMySubscriptionsCommand {
|
|
|
9
9
|
carriedOverTokenBalance: z.ZodNumber;
|
|
10
10
|
status: z.ZodNativeEnum<typeof USER_TO_SUBSCRIPTION_STATUS>;
|
|
11
11
|
active: z.ZodBoolean;
|
|
12
|
+
endDate: z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodString]>>;
|
|
12
13
|
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
13
14
|
subscription: z.ZodObject<{
|
|
14
15
|
uuid: z.ZodString;
|
|
@@ -86,6 +87,7 @@ export declare namespace GetMySubscriptionsCommand {
|
|
|
86
87
|
discount: number;
|
|
87
88
|
carryoverPercent: number;
|
|
88
89
|
};
|
|
90
|
+
endDate: string | Date | null;
|
|
89
91
|
}, {
|
|
90
92
|
active: boolean;
|
|
91
93
|
uuid: string;
|
|
@@ -110,6 +112,7 @@ export declare namespace GetMySubscriptionsCommand {
|
|
|
110
112
|
discount: number;
|
|
111
113
|
carryoverPercent: number;
|
|
112
114
|
};
|
|
115
|
+
endDate: string | Date | null;
|
|
113
116
|
}>, "many">;
|
|
114
117
|
}, "strip", z.ZodTypeAny, {
|
|
115
118
|
data: {
|
|
@@ -136,6 +139,7 @@ export declare namespace GetMySubscriptionsCommand {
|
|
|
136
139
|
discount: number;
|
|
137
140
|
carryoverPercent: number;
|
|
138
141
|
};
|
|
142
|
+
endDate: string | Date | null;
|
|
139
143
|
}[];
|
|
140
144
|
}, {
|
|
141
145
|
data: {
|
|
@@ -162,6 +166,7 @@ export declare namespace GetMySubscriptionsCommand {
|
|
|
162
166
|
discount: number;
|
|
163
167
|
carryoverPercent: number;
|
|
164
168
|
};
|
|
169
|
+
endDate: string | Date | null;
|
|
165
170
|
}[];
|
|
166
171
|
}>;
|
|
167
172
|
type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-my-subscriptions.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-my-subscriptions.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"get-my-subscriptions.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-my-subscriptions.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAczB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -14,6 +14,7 @@ var GetMySubscriptionsCommand;
|
|
|
14
14
|
carriedOverTokenBalance: zod_1.z.number().int(),
|
|
15
15
|
status: zod_1.z.nativeEnum(constants_1.USER_TO_SUBSCRIPTION_STATUS),
|
|
16
16
|
active: zod_1.z.boolean(),
|
|
17
|
+
endDate: zod_1.z.date().or(zod_1.z.string().datetime()).nullable(),
|
|
17
18
|
createdAt: zod_1.z.date().or(zod_1.z.string().datetime()),
|
|
18
19
|
subscription: models_1.SubscriptionSchema,
|
|
19
20
|
})),
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ORDER_STATUS, ORDER_TYPE, PAYMENT_STATUS } from '../../constants';
|
|
3
|
+
export declare namespace GetUserPaymentsCommand {
|
|
4
|
+
const ResponseItemSchema: z.ZodObject<{
|
|
5
|
+
uuid: z.ZodString;
|
|
6
|
+
orderType: z.ZodNativeEnum<typeof ORDER_TYPE>;
|
|
7
|
+
orderStatus: z.ZodNativeEnum<typeof ORDER_STATUS>;
|
|
8
|
+
description: z.ZodString;
|
|
9
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
10
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
11
|
+
subscriptionId: z.ZodNullable<z.ZodString>;
|
|
12
|
+
subscriptionName: z.ZodNullable<z.ZodString>;
|
|
13
|
+
paymentStatus: z.ZodNativeEnum<typeof PAYMENT_STATUS>;
|
|
14
|
+
userId: z.ZodString;
|
|
15
|
+
userEmail: z.ZodString;
|
|
16
|
+
sum: z.ZodNumber;
|
|
17
|
+
currency: z.ZodString;
|
|
18
|
+
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
uuid: string;
|
|
21
|
+
description: string;
|
|
22
|
+
currency: string;
|
|
23
|
+
updatedAt: string | Date;
|
|
24
|
+
userId: string;
|
|
25
|
+
subscriptionId: string | null;
|
|
26
|
+
sum: number;
|
|
27
|
+
orderType: ORDER_TYPE;
|
|
28
|
+
orderStatus: ORDER_STATUS;
|
|
29
|
+
productId: string | null;
|
|
30
|
+
productName: string | null;
|
|
31
|
+
subscriptionName: string | null;
|
|
32
|
+
paymentStatus: PAYMENT_STATUS;
|
|
33
|
+
userEmail: string;
|
|
34
|
+
}, {
|
|
35
|
+
uuid: string;
|
|
36
|
+
description: string;
|
|
37
|
+
currency: string;
|
|
38
|
+
updatedAt: string | Date;
|
|
39
|
+
userId: string;
|
|
40
|
+
subscriptionId: string | null;
|
|
41
|
+
sum: number;
|
|
42
|
+
orderType: ORDER_TYPE;
|
|
43
|
+
orderStatus: ORDER_STATUS;
|
|
44
|
+
productId: string | null;
|
|
45
|
+
productName: string | null;
|
|
46
|
+
subscriptionName: string | null;
|
|
47
|
+
paymentStatus: PAYMENT_STATUS;
|
|
48
|
+
userEmail: string;
|
|
49
|
+
}>;
|
|
50
|
+
const ResponseSchema: z.ZodObject<{
|
|
51
|
+
data: z.ZodArray<z.ZodObject<{
|
|
52
|
+
uuid: z.ZodString;
|
|
53
|
+
orderType: z.ZodNativeEnum<typeof ORDER_TYPE>;
|
|
54
|
+
orderStatus: z.ZodNativeEnum<typeof ORDER_STATUS>;
|
|
55
|
+
description: z.ZodString;
|
|
56
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
57
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
58
|
+
subscriptionId: z.ZodNullable<z.ZodString>;
|
|
59
|
+
subscriptionName: z.ZodNullable<z.ZodString>;
|
|
60
|
+
paymentStatus: z.ZodNativeEnum<typeof PAYMENT_STATUS>;
|
|
61
|
+
userId: z.ZodString;
|
|
62
|
+
userEmail: z.ZodString;
|
|
63
|
+
sum: z.ZodNumber;
|
|
64
|
+
currency: z.ZodString;
|
|
65
|
+
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
uuid: string;
|
|
68
|
+
description: string;
|
|
69
|
+
currency: string;
|
|
70
|
+
updatedAt: string | Date;
|
|
71
|
+
userId: string;
|
|
72
|
+
subscriptionId: string | null;
|
|
73
|
+
sum: number;
|
|
74
|
+
orderType: ORDER_TYPE;
|
|
75
|
+
orderStatus: ORDER_STATUS;
|
|
76
|
+
productId: string | null;
|
|
77
|
+
productName: string | null;
|
|
78
|
+
subscriptionName: string | null;
|
|
79
|
+
paymentStatus: PAYMENT_STATUS;
|
|
80
|
+
userEmail: string;
|
|
81
|
+
}, {
|
|
82
|
+
uuid: string;
|
|
83
|
+
description: string;
|
|
84
|
+
currency: string;
|
|
85
|
+
updatedAt: string | Date;
|
|
86
|
+
userId: string;
|
|
87
|
+
subscriptionId: string | null;
|
|
88
|
+
sum: number;
|
|
89
|
+
orderType: ORDER_TYPE;
|
|
90
|
+
orderStatus: ORDER_STATUS;
|
|
91
|
+
productId: string | null;
|
|
92
|
+
productName: string | null;
|
|
93
|
+
subscriptionName: string | null;
|
|
94
|
+
paymentStatus: PAYMENT_STATUS;
|
|
95
|
+
userEmail: string;
|
|
96
|
+
}>, "many">;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
data: {
|
|
99
|
+
uuid: string;
|
|
100
|
+
description: string;
|
|
101
|
+
currency: string;
|
|
102
|
+
updatedAt: string | Date;
|
|
103
|
+
userId: string;
|
|
104
|
+
subscriptionId: string | null;
|
|
105
|
+
sum: number;
|
|
106
|
+
orderType: ORDER_TYPE;
|
|
107
|
+
orderStatus: ORDER_STATUS;
|
|
108
|
+
productId: string | null;
|
|
109
|
+
productName: string | null;
|
|
110
|
+
subscriptionName: string | null;
|
|
111
|
+
paymentStatus: PAYMENT_STATUS;
|
|
112
|
+
userEmail: string;
|
|
113
|
+
}[];
|
|
114
|
+
}, {
|
|
115
|
+
data: {
|
|
116
|
+
uuid: string;
|
|
117
|
+
description: string;
|
|
118
|
+
currency: string;
|
|
119
|
+
updatedAt: string | Date;
|
|
120
|
+
userId: string;
|
|
121
|
+
subscriptionId: string | null;
|
|
122
|
+
sum: number;
|
|
123
|
+
orderType: ORDER_TYPE;
|
|
124
|
+
orderStatus: ORDER_STATUS;
|
|
125
|
+
productId: string | null;
|
|
126
|
+
productName: string | null;
|
|
127
|
+
subscriptionName: string | null;
|
|
128
|
+
paymentStatus: PAYMENT_STATUS;
|
|
129
|
+
userEmail: string;
|
|
130
|
+
}[];
|
|
131
|
+
}>;
|
|
132
|
+
type Response = z.infer<typeof ResponseSchema>;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=get-user-payments.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-user-payments.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-user-payments.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3E,yBAAiB,sBAAsB,CAAC;IAC7B,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAe7B,CAAC;IAEI,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUserPaymentsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetUserPaymentsCommand;
|
|
7
|
+
(function (GetUserPaymentsCommand) {
|
|
8
|
+
GetUserPaymentsCommand.ResponseItemSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
orderType: zod_1.z.nativeEnum(constants_1.ORDER_TYPE),
|
|
11
|
+
orderStatus: zod_1.z.nativeEnum(constants_1.ORDER_STATUS),
|
|
12
|
+
description: zod_1.z.string(),
|
|
13
|
+
productId: zod_1.z.string().uuid().nullable(),
|
|
14
|
+
productName: zod_1.z.string().nullable(),
|
|
15
|
+
subscriptionId: zod_1.z.string().uuid().nullable(),
|
|
16
|
+
subscriptionName: zod_1.z.string().nullable(),
|
|
17
|
+
paymentStatus: zod_1.z.nativeEnum(constants_1.PAYMENT_STATUS),
|
|
18
|
+
userId: zod_1.z.string().uuid(),
|
|
19
|
+
userEmail: zod_1.z.string().email(),
|
|
20
|
+
sum: zod_1.z.number(),
|
|
21
|
+
currency: zod_1.z.string(),
|
|
22
|
+
updatedAt: zod_1.z.date().or(zod_1.z.string().datetime()),
|
|
23
|
+
});
|
|
24
|
+
GetUserPaymentsCommand.ResponseSchema = zod_1.z.object({
|
|
25
|
+
data: zod_1.z.array(GetUserPaymentsCommand.ResponseItemSchema),
|
|
26
|
+
});
|
|
27
|
+
})(GetUserPaymentsCommand || (exports.GetUserPaymentsCommand = GetUserPaymentsCommand = {}));
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { USER_ROLE } from '../../constants';
|
|
2
|
+
import { USER_ROLE, USER_STATUS } from '../../constants';
|
|
3
3
|
export declare namespace GetUserCommand {
|
|
4
4
|
const ResponseSchema: z.ZodObject<{
|
|
5
5
|
data: z.ZodObject<{
|
|
6
6
|
uuid: z.ZodString;
|
|
7
7
|
email: z.ZodString;
|
|
8
8
|
role: z.ZodNativeEnum<typeof USER_ROLE>;
|
|
9
|
+
status: z.ZodNativeEnum<typeof USER_STATUS>;
|
|
9
10
|
siteId: z.ZodString;
|
|
11
|
+
tokenBonusBalance: z.ZodNumber;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
13
|
email: string;
|
|
12
14
|
uuid: string;
|
|
13
15
|
siteId: string;
|
|
14
16
|
role: USER_ROLE;
|
|
17
|
+
status: USER_STATUS;
|
|
18
|
+
tokenBonusBalance: number;
|
|
15
19
|
}, {
|
|
16
20
|
email: string;
|
|
17
21
|
uuid: string;
|
|
18
22
|
siteId: string;
|
|
19
23
|
role: USER_ROLE;
|
|
24
|
+
status: USER_STATUS;
|
|
25
|
+
tokenBonusBalance: number;
|
|
20
26
|
}>;
|
|
21
27
|
}, "strip", z.ZodTypeAny, {
|
|
22
28
|
data: {
|
|
@@ -24,6 +30,8 @@ export declare namespace GetUserCommand {
|
|
|
24
30
|
uuid: string;
|
|
25
31
|
siteId: string;
|
|
26
32
|
role: USER_ROLE;
|
|
33
|
+
status: USER_STATUS;
|
|
34
|
+
tokenBonusBalance: number;
|
|
27
35
|
};
|
|
28
36
|
}, {
|
|
29
37
|
data: {
|
|
@@ -31,6 +39,8 @@ export declare namespace GetUserCommand {
|
|
|
31
39
|
uuid: string;
|
|
32
40
|
siteId: string;
|
|
33
41
|
role: USER_ROLE;
|
|
42
|
+
status: USER_STATUS;
|
|
43
|
+
tokenBonusBalance: number;
|
|
34
44
|
};
|
|
35
45
|
}>;
|
|
36
46
|
type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-user.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-user.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-user.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-user.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,cAAc,CAAC;IACrB,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MASzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -10,7 +10,9 @@ var GetUserCommand;
|
|
|
10
10
|
uuid: zod_1.z.string().uuid(),
|
|
11
11
|
email: zod_1.z.string().email(),
|
|
12
12
|
role: zod_1.z.nativeEnum(constants_1.USER_ROLE),
|
|
13
|
+
status: zod_1.z.nativeEnum(constants_1.USER_STATUS),
|
|
13
14
|
siteId: zod_1.z.string().uuid(),
|
|
15
|
+
tokenBonusBalance: zod_1.z.number().int(),
|
|
14
16
|
}),
|
|
15
17
|
});
|
|
16
18
|
})(GetUserCommand || (exports.GetUserCommand = GetUserCommand = {}));
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * from './get-user.command';
|
|
2
|
+
export * from './get-all-users.command';
|
|
2
3
|
export * from './get-user-balance.command';
|
|
3
4
|
export * from './get-my-products.command';
|
|
4
5
|
export * from './get-my-subscriptions.command';
|
|
6
|
+
export * from './find-users.command';
|
|
7
|
+
export * from './get-user-payments.command';
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC"}
|
|
@@ -15,6 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./get-user.command"), exports);
|
|
18
|
+
__exportStar(require("./get-all-users.command"), exports);
|
|
18
19
|
__exportStar(require("./get-user-balance.command"), exports);
|
|
19
20
|
__exportStar(require("./get-my-products.command"), exports);
|
|
20
21
|
__exportStar(require("./get-my-subscriptions.command"), exports);
|
|
22
|
+
__exportStar(require("./find-users.command"), exports);
|
|
23
|
+
__exportStar(require("./get-user-payments.command"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeleteSubscriptionCommand {
|
|
4
|
+
export const RequestParamSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export * from './buy-subscription.command';
|
|
2
2
|
export * from './fast-buy-subscription.command';
|
|
3
3
|
export * from './cancel-subscription.command';
|
|
4
|
+
export * from './recover-subscription.command';
|
|
5
|
+
export * from './update-subscription.command';
|
|
6
|
+
export * from './delete-subscription.command';
|
|
7
|
+
export * from './refund-subscription.command';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace RecoverSubscriptionCommand {
|
|
4
|
+
export const RequestParamSchema = z.object({
|
|
5
|
+
uuidSiteUserToSubscription: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.void();
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace RefundSubscriptionCommand {
|
|
4
|
+
export const RequestParamSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateSubscriptionCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestSchema = z.object({
|
|
11
|
+
name: z.string().min(1).max(200).optional(),
|
|
12
|
+
description: z.string().min(1).max(2000).optional(),
|
|
13
|
+
price: z.number().int().min(0).optional(),
|
|
14
|
+
interval: z.string().max(20).optional(),
|
|
15
|
+
period: z.number().int().min(1).max(36).optional(),
|
|
16
|
+
tokens: z.number().int().min(0).optional(),
|
|
17
|
+
discount: z.number().int().min(0).optional(),
|
|
18
|
+
features: z
|
|
19
|
+
.array(
|
|
20
|
+
z.object({
|
|
21
|
+
type: z.string(),
|
|
22
|
+
name: z.string(),
|
|
23
|
+
}),
|
|
24
|
+
)
|
|
25
|
+
.optional(),
|
|
26
|
+
carryoverPercent: z.number().int().min(0).max(100).optional(),
|
|
27
|
+
});
|
|
28
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
29
|
+
|
|
30
|
+
export const ResponseSchema = z.object({
|
|
31
|
+
data: SubscriptionSchema,
|
|
32
|
+
});
|
|
33
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
34
|
+
}
|
|
@@ -216,6 +216,16 @@ export const ERRORS = {
|
|
|
216
216
|
code: 'SUBSCRIPTION_006',
|
|
217
217
|
httpCode: 500,
|
|
218
218
|
},
|
|
219
|
+
SUBSCRIPTION_RECOVER_ERROR: {
|
|
220
|
+
message: 'Ошибка при восстановлении подписки',
|
|
221
|
+
code: 'SUBSCRIPTION_007',
|
|
222
|
+
httpCode: 500,
|
|
223
|
+
},
|
|
224
|
+
SUBSCRIPTION_REFUND_ERROR: {
|
|
225
|
+
message: 'Ошибка при возврате подписки',
|
|
226
|
+
code: 'SUBSCRIPTION_008',
|
|
227
|
+
httpCode: 500,
|
|
228
|
+
},
|
|
219
229
|
|
|
220
230
|
// ORDER
|
|
221
231
|
ORDER_NOT_FOUND: {
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_ROLE, USER_STATUS } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace FindUsersCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
uuid: z.string().uuid().optional(),
|
|
7
|
+
email: z.string().email().optional(),
|
|
8
|
+
role: z.nativeEnum(USER_ROLE).optional(),
|
|
9
|
+
status: z.nativeEnum(USER_STATUS).optional(),
|
|
10
|
+
limit: z.coerce.number().int().min(1).default(20).optional(),
|
|
11
|
+
offset: z.coerce.number().int().min(0).default(0).optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
15
|
+
|
|
16
|
+
export const ResponseItemSchema = z.object({
|
|
17
|
+
uuid: z.string().uuid(),
|
|
18
|
+
email: z.string().email(),
|
|
19
|
+
role: z.nativeEnum(USER_ROLE),
|
|
20
|
+
status: z.nativeEnum(USER_STATUS),
|
|
21
|
+
siteId: z.string().uuid(),
|
|
22
|
+
tokenBonusBalance: z.number().int(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const ResponseSchema = z.object({
|
|
26
|
+
data: z.array(ResponseItemSchema),
|
|
27
|
+
totalPages: z.number().int(),
|
|
28
|
+
page: z.number().int(),
|
|
29
|
+
});
|
|
30
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
31
|
+
}
|