@purpleschool/multisite 0.0.21 → 0.0.22
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/index.ts +2 -0
- package/api/controller/http/user-to-product.ts +7 -0
- package/api/controller/http/user-to-subscription.ts +8 -0
- package/api/routes.ts +18 -0
- package/build/api/controller/http/index.d.ts +2 -0
- package/build/api/controller/http/index.d.ts.map +1 -1
- package/build/api/controller/http/index.js +2 -0
- package/build/api/controller/http/user-to-product.d.ts +7 -0
- package/build/api/controller/http/user-to-product.d.ts.map +1 -0
- package/build/api/controller/http/user-to-product.js +9 -0
- package/build/api/controller/http/user-to-subscription.d.ts +8 -0
- package/build/api/controller/http/user-to-subscription.d.ts.map +1 -0
- package/build/api/controller/http/user-to-subscription.js +10 -0
- package/build/api/routes.d.ts +11 -0
- package/build/api/routes.d.ts.map +1 -1
- package/build/api/routes.js +11 -0
- package/build/commands/image-editor/execute-image-editor.command.d.ts +4 -4
- package/build/commands/image-editor/retry-image-editor-job.command.d.ts +4 -4
- package/build/commands/image-editor/set-reaction-to-image-editor-job.command.d.ts +4 -4
- package/build/commands/image-editor/update-image-editor-job-title.command.d.ts +4 -4
- package/build/commands/image-generation/execute-image-generation.command.d.ts +4 -4
- package/build/commands/image-generation/retry-image-generation-job.command.d.ts +4 -4
- package/build/commands/image-generation/set-reaction-to-image-generation-job.command.d.ts +4 -4
- package/build/commands/image-generation/update-image-generation-job-title.command.d.ts +4 -4
- package/build/commands/index.d.ts +2 -0
- package/build/commands/index.d.ts.map +1 -1
- package/build/commands/index.js +2 -0
- package/build/commands/page/create-page.command.d.ts +4 -4
- package/build/commands/page/find-page-by-alias.command.d.ts +12 -12
- package/build/commands/page/find-page-by-criteria.command.d.ts +4 -4
- package/build/commands/page/find-page.command.d.ts +8 -8
- package/build/commands/page/update-page.command.d.ts +4 -4
- package/build/commands/payment/cloud-payments.command.d.ts +2 -2
- package/build/commands/stt/execute-stt.command.d.ts +12 -12
- package/build/commands/stt/retry-stt-job.command.d.ts +12 -12
- package/build/commands/stt/set-reaction-to-stt-job.command.d.ts +12 -12
- package/build/commands/stt/update-stt-job-title.command.d.ts +12 -12
- package/build/commands/tts/execute-tts.command.d.ts +12 -12
- package/build/commands/tts/retry-tts-job.command.d.ts +12 -12
- package/build/commands/tts/set-reaction-to-tts-job.command.d.ts +12 -12
- package/build/commands/tts/update-tts-job-title.command.d.ts +12 -12
- package/build/commands/unregistered-user/upsert-unregistered-user.command.d.ts +4 -4
- package/build/commands/user-to-product/delete-user-to-product.command.d.ts +20 -0
- package/build/commands/user-to-product/delete-user-to-product.command.d.ts.map +1 -0
- package/build/commands/user-to-product/delete-user-to-product.command.js +13 -0
- package/build/commands/user-to-product/get-user-to-product-by-uuid.command.d.ts +75 -0
- package/build/commands/user-to-product/get-user-to-product-by-uuid.command.d.ts.map +1 -0
- package/build/commands/user-to-product/get-user-to-product-by-uuid.command.js +14 -0
- package/build/commands/user-to-product/index.d.ts +4 -0
- package/build/commands/user-to-product/index.d.ts.map +1 -0
- package/build/commands/user-to-product/index.js +19 -0
- package/build/commands/user-to-product/update-user-to-product.command.d.ts +93 -0
- package/build/commands/user-to-product/update-user-to-product.command.d.ts.map +1 -0
- package/build/commands/user-to-product/update-user-to-product.command.js +21 -0
- package/build/commands/user-to-subscription/admin-cancel-subscription.command.d.ts +14 -0
- package/build/commands/user-to-subscription/admin-cancel-subscription.command.d.ts.map +1 -0
- package/build/commands/user-to-subscription/admin-cancel-subscription.command.js +11 -0
- package/build/commands/user-to-subscription/delete-user-to-subscription.command.d.ts +20 -0
- package/build/commands/user-to-subscription/delete-user-to-subscription.command.d.ts.map +1 -0
- package/build/commands/user-to-subscription/delete-user-to-subscription.command.js +13 -0
- package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.d.ts +115 -0
- package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.d.ts.map +1 -0
- package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.js +14 -0
- package/build/commands/user-to-subscription/index.d.ts +5 -0
- package/build/commands/user-to-subscription/index.d.ts.map +1 -0
- package/build/commands/user-to-subscription/index.js +20 -0
- package/build/commands/user-to-subscription/update-user-to-subscription.command.d.ts +157 -0
- package/build/commands/user-to-subscription/update-user-to-subscription.command.d.ts.map +1 -0
- package/build/commands/user-to-subscription/update-user-to-subscription.command.js +29 -0
- package/build/constants/errors/errors.d.ts +60 -0
- package/build/constants/errors/errors.d.ts.map +1 -1
- package/build/constants/errors/errors.js +62 -0
- package/build/models/image-editor/image-editor-config.schema.d.ts +10 -10
- package/build/models/image-editor/image-editor-job.schema.d.ts +2 -2
- package/build/models/image-editor/image-editor-model.schema.d.ts +2 -2
- package/build/models/image-editor/image-editor-prompt-group.schema.d.ts +4 -4
- package/build/models/image-editor/image-editor-system-prompt.schema.d.ts +2 -2
- package/build/models/image-generation/image-generation-config.schema.d.ts +6 -6
- package/build/models/image-generation/image-generation-job.schema.d.ts +2 -2
- package/build/models/image-generation/image-generation-model.schema.d.ts +2 -2
- package/build/models/image-generation/image-generation-vendor.schema.d.ts +4 -4
- package/build/models/index.d.ts +2 -0
- package/build/models/index.d.ts.map +1 -1
- package/build/models/index.js +2 -0
- package/build/models/page.schema.d.ts +4 -4
- package/build/models/stt/stt-config.schema.d.ts +8 -8
- package/build/models/stt/stt-job.schema.d.ts +6 -6
- package/build/models/stt/stt-model.schema.d.ts +4 -4
- package/build/models/tts/tts-config.schema.d.ts +8 -8
- package/build/models/tts/tts-job.schema.d.ts +6 -6
- package/build/models/tts/tts-model.schema.d.ts +4 -4
- package/build/models/user-to-product.schema.d.ts +37 -0
- package/build/models/user-to-product.schema.d.ts.map +1 -0
- package/build/models/user-to-product.schema.js +17 -0
- package/build/models/user-to-subscription.schema.d.ts +61 -0
- package/build/models/user-to-subscription.schema.d.ts.map +1 -0
- package/build/models/user-to-subscription.schema.js +25 -0
- package/build/queries/image-editor/find-image-editor-jobs.command.d.ts +4 -4
- package/build/queries/image-editor/get-image-editor-config.command.d.ts +14 -14
- package/build/queries/image-editor/get-image-editor-job.command.d.ts +4 -4
- package/build/queries/image-generation/find-image-generation-jobs.command.d.ts +4 -4
- package/build/queries/image-generation/get-image-generation-config.command.d.ts +8 -8
- package/build/queries/image-generation/get-image-generation-job.command.d.ts +4 -4
- package/build/queries/payment/get-payment-history.command.d.ts +6 -6
- package/build/queries/stt/find-stt-jobs.command.d.ts +12 -12
- package/build/queries/stt/get-stt-config.command.d.ts +12 -12
- package/build/queries/stt/get-stt-job.command.d.ts +12 -12
- package/build/queries/subscription/get-subscriptions-summary.command.d.ts +16 -16
- package/build/queries/tts/find-tts-jobs.command.d.ts +12 -12
- package/build/queries/tts/get-tts-config.command.d.ts +12 -12
- package/build/queries/tts/get-tts-job.command.d.ts +12 -12
- package/build/queries/user/get-my-products.command.d.ts +8 -8
- package/build/queries/user/get-my-subscriptions.command.d.ts +12 -12
- package/build/queries/user/get-user-payments.command.d.ts +18 -18
- package/commands/index.ts +2 -0
- package/commands/user-to-product/delete-user-to-product.command.ts +13 -0
- package/commands/user-to-product/get-user-to-product-by-uuid.command.ts +14 -0
- package/commands/user-to-product/index.ts +3 -0
- package/commands/user-to-product/update-user-to-product.command.ts +23 -0
- package/commands/user-to-subscription/admin-cancel-subscription.command.ts +11 -0
- package/commands/user-to-subscription/delete-user-to-subscription.command.ts +13 -0
- package/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.ts +14 -0
- package/commands/user-to-subscription/index.ts +4 -0
- package/commands/user-to-subscription/update-user-to-subscription.command.ts +31 -0
- package/constants/errors/errors.ts +64 -0
- package/models/index.ts +2 -0
- package/models/user-to-product.schema.ts +15 -0
- package/models/user-to-subscription.schema.ts +23 -0
- package/package.json +1 -1
|
@@ -19,14 +19,14 @@ export declare namespace GetUserPaymentsCommand {
|
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
uuid: string;
|
|
21
21
|
description: string;
|
|
22
|
-
currency: string;
|
|
23
|
-
updatedAt: string | Date;
|
|
24
22
|
userId: string;
|
|
23
|
+
productId: string | null;
|
|
24
|
+
updatedAt: string | Date;
|
|
25
25
|
subscriptionId: string | null;
|
|
26
|
+
currency: string;
|
|
26
27
|
sum: number;
|
|
27
28
|
orderType: ORDER_TYPE;
|
|
28
29
|
orderStatus: ORDER_STATUS;
|
|
29
|
-
productId: string | null;
|
|
30
30
|
productName: string | null;
|
|
31
31
|
subscriptionName: string | null;
|
|
32
32
|
paymentStatus: PAYMENT_STATUS;
|
|
@@ -34,14 +34,14 @@ export declare namespace GetUserPaymentsCommand {
|
|
|
34
34
|
}, {
|
|
35
35
|
uuid: string;
|
|
36
36
|
description: string;
|
|
37
|
-
currency: string;
|
|
38
|
-
updatedAt: string | Date;
|
|
39
37
|
userId: string;
|
|
38
|
+
productId: string | null;
|
|
39
|
+
updatedAt: string | Date;
|
|
40
40
|
subscriptionId: string | null;
|
|
41
|
+
currency: string;
|
|
41
42
|
sum: number;
|
|
42
43
|
orderType: ORDER_TYPE;
|
|
43
44
|
orderStatus: ORDER_STATUS;
|
|
44
|
-
productId: string | null;
|
|
45
45
|
productName: string | null;
|
|
46
46
|
subscriptionName: string | null;
|
|
47
47
|
paymentStatus: PAYMENT_STATUS;
|
|
@@ -66,14 +66,14 @@ export declare namespace GetUserPaymentsCommand {
|
|
|
66
66
|
}, "strip", z.ZodTypeAny, {
|
|
67
67
|
uuid: string;
|
|
68
68
|
description: string;
|
|
69
|
-
currency: string;
|
|
70
|
-
updatedAt: string | Date;
|
|
71
69
|
userId: string;
|
|
70
|
+
productId: string | null;
|
|
71
|
+
updatedAt: string | Date;
|
|
72
72
|
subscriptionId: string | null;
|
|
73
|
+
currency: string;
|
|
73
74
|
sum: number;
|
|
74
75
|
orderType: ORDER_TYPE;
|
|
75
76
|
orderStatus: ORDER_STATUS;
|
|
76
|
-
productId: string | null;
|
|
77
77
|
productName: string | null;
|
|
78
78
|
subscriptionName: string | null;
|
|
79
79
|
paymentStatus: PAYMENT_STATUS;
|
|
@@ -81,14 +81,14 @@ export declare namespace GetUserPaymentsCommand {
|
|
|
81
81
|
}, {
|
|
82
82
|
uuid: string;
|
|
83
83
|
description: string;
|
|
84
|
-
currency: string;
|
|
85
|
-
updatedAt: string | Date;
|
|
86
84
|
userId: string;
|
|
85
|
+
productId: string | null;
|
|
86
|
+
updatedAt: string | Date;
|
|
87
87
|
subscriptionId: string | null;
|
|
88
|
+
currency: string;
|
|
88
89
|
sum: number;
|
|
89
90
|
orderType: ORDER_TYPE;
|
|
90
91
|
orderStatus: ORDER_STATUS;
|
|
91
|
-
productId: string | null;
|
|
92
92
|
productName: string | null;
|
|
93
93
|
subscriptionName: string | null;
|
|
94
94
|
paymentStatus: PAYMENT_STATUS;
|
|
@@ -98,14 +98,14 @@ export declare namespace GetUserPaymentsCommand {
|
|
|
98
98
|
data: {
|
|
99
99
|
uuid: string;
|
|
100
100
|
description: string;
|
|
101
|
-
currency: string;
|
|
102
|
-
updatedAt: string | Date;
|
|
103
101
|
userId: string;
|
|
102
|
+
productId: string | null;
|
|
103
|
+
updatedAt: string | Date;
|
|
104
104
|
subscriptionId: string | null;
|
|
105
|
+
currency: string;
|
|
105
106
|
sum: number;
|
|
106
107
|
orderType: ORDER_TYPE;
|
|
107
108
|
orderStatus: ORDER_STATUS;
|
|
108
|
-
productId: string | null;
|
|
109
109
|
productName: string | null;
|
|
110
110
|
subscriptionName: string | null;
|
|
111
111
|
paymentStatus: PAYMENT_STATUS;
|
|
@@ -115,14 +115,14 @@ export declare namespace GetUserPaymentsCommand {
|
|
|
115
115
|
data: {
|
|
116
116
|
uuid: string;
|
|
117
117
|
description: string;
|
|
118
|
-
currency: string;
|
|
119
|
-
updatedAt: string | Date;
|
|
120
118
|
userId: string;
|
|
119
|
+
productId: string | null;
|
|
120
|
+
updatedAt: string | Date;
|
|
121
121
|
subscriptionId: string | null;
|
|
122
|
+
currency: string;
|
|
122
123
|
sum: number;
|
|
123
124
|
orderType: ORDER_TYPE;
|
|
124
125
|
orderStatus: ORDER_STATUS;
|
|
125
|
-
productId: string | null;
|
|
126
126
|
productName: string | null;
|
|
127
127
|
subscriptionName: string | null;
|
|
128
128
|
paymentStatus: PAYMENT_STATUS;
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeleteUserToProductCommand {
|
|
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,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserToProductSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetUserToProductByUuidCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: UserToProductSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_TO_PRODUCT_STATUS } from '../../constants';
|
|
3
|
+
import { UserToProductSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateUserToProductCommand {
|
|
6
|
+
export const RequestParamSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
10
|
+
|
|
11
|
+
export const RequestSchema = z.object({
|
|
12
|
+
initTokenBalance: z.number().int().min(0).optional(),
|
|
13
|
+
tokenBalance: z.number().int().min(0).optional(),
|
|
14
|
+
status: z.nativeEnum(USER_TO_PRODUCT_STATUS).optional(),
|
|
15
|
+
orderId: z.string().uuid().nullable().optional(),
|
|
16
|
+
});
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: UserToProductSchema,
|
|
21
|
+
});
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace AdminCancelSubscriptionCommand {
|
|
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 DeleteUserToSubscriptionCommand {
|
|
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,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserToSubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetUserToSubscriptionByUuidCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: UserToSubscriptionSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_TO_SUBSCRIPTION_STATUS, USER_TO_SUBSCRIPTION_TYPE } from '../../constants';
|
|
3
|
+
import { UserToSubscriptionSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace AdminUpdateUserToSubscriptionCommand {
|
|
6
|
+
export const RequestParamSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
10
|
+
|
|
11
|
+
export const RequestSchema = z.object({
|
|
12
|
+
orderId: z.string().uuid().nullable().optional(),
|
|
13
|
+
cloudPaymentsSubscriptionId: z.string().nullable().optional(),
|
|
14
|
+
type: z.nativeEnum(USER_TO_SUBSCRIPTION_TYPE).optional(),
|
|
15
|
+
initTokenBalance: z.number().int().min(0).optional(),
|
|
16
|
+
tokenBalance: z.number().int().min(0).optional(),
|
|
17
|
+
initCarriedOverTokenBalance: z.number().int().min(0).optional(),
|
|
18
|
+
carriedOverTokenBalance: z.number().int().min(0).optional(),
|
|
19
|
+
status: z.nativeEnum(USER_TO_SUBSCRIPTION_STATUS).optional(),
|
|
20
|
+
active: z.boolean().optional(),
|
|
21
|
+
startDate: z.coerce.date().nullable().optional(),
|
|
22
|
+
intervalEndDate: z.coerce.date().nullable().optional(),
|
|
23
|
+
endDate: z.coerce.date().nullable().optional(),
|
|
24
|
+
});
|
|
25
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
26
|
+
|
|
27
|
+
export const ResponseSchema = z.object({
|
|
28
|
+
data: UserToSubscriptionSchema,
|
|
29
|
+
});
|
|
30
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
31
|
+
}
|
|
@@ -184,6 +184,38 @@ export const ERRORS = {
|
|
|
184
184
|
code: 'PRODUCT_004',
|
|
185
185
|
httpCode: 500,
|
|
186
186
|
},
|
|
187
|
+
PRODUCT_UPDATE_ERROR: {
|
|
188
|
+
message: 'Ошибка при обновлении продукта',
|
|
189
|
+
code: 'PRODUCT_005',
|
|
190
|
+
httpCode: 500,
|
|
191
|
+
},
|
|
192
|
+
PRODUCT_DELETE_ERROR: {
|
|
193
|
+
message: 'Ошибка при удалении продукта',
|
|
194
|
+
code: 'PRODUCT_006',
|
|
195
|
+
httpCode: 500,
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
// USER TO PRODUCT
|
|
199
|
+
USER_TO_PRODUCT_NOT_FOUND: {
|
|
200
|
+
message: 'Продукт пользователя не найден',
|
|
201
|
+
code: 'USER_TO_PRODUCT_001',
|
|
202
|
+
httpCode: 404,
|
|
203
|
+
},
|
|
204
|
+
USER_TO_PRODUCT_FIND_ERROR: {
|
|
205
|
+
message: 'Ошибка при поиске продукта пользователя',
|
|
206
|
+
code: 'USER_TO_PRODUCT_002',
|
|
207
|
+
httpCode: 500,
|
|
208
|
+
},
|
|
209
|
+
USER_TO_PRODUCT_UPDATE_ERROR: {
|
|
210
|
+
message: 'Ошибка при обновлении продукта пользователя',
|
|
211
|
+
code: 'USER_TO_PRODUCT_003',
|
|
212
|
+
httpCode: 500,
|
|
213
|
+
},
|
|
214
|
+
USER_TO_PRODUCT_DELETE_ERROR: {
|
|
215
|
+
message: 'Ошибка при удалении продукта пользователя',
|
|
216
|
+
code: 'USER_TO_PRODUCT_004',
|
|
217
|
+
httpCode: 500,
|
|
218
|
+
},
|
|
187
219
|
|
|
188
220
|
// SUBSCRIPTION
|
|
189
221
|
SUBSCRIPTION_NOT_FOUND: {
|
|
@@ -226,6 +258,38 @@ export const ERRORS = {
|
|
|
226
258
|
code: 'SUBSCRIPTION_008',
|
|
227
259
|
httpCode: 500,
|
|
228
260
|
},
|
|
261
|
+
SUBSCRIPTION_UPDATE_ERROR: {
|
|
262
|
+
message: 'Ошибка при обновлении подписки',
|
|
263
|
+
code: 'SUBSCRIPTION_009',
|
|
264
|
+
httpCode: 500,
|
|
265
|
+
},
|
|
266
|
+
SUBSCRIPTION_DELETE_ERROR: {
|
|
267
|
+
message: 'Ошибка при удалении подписки',
|
|
268
|
+
code: 'SUBSCRIPTION_010',
|
|
269
|
+
httpCode: 500,
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
// USER TO SUBSCRIPTION
|
|
273
|
+
USER_TO_SUBSCRIPTION_NOT_FOUND: {
|
|
274
|
+
message: 'Подписка пользователя не найдена',
|
|
275
|
+
code: 'USER_TO_SUBSCRIPTION_001',
|
|
276
|
+
httpCode: 404,
|
|
277
|
+
},
|
|
278
|
+
USER_TO_SUBSCRIPTION_FIND_ERROR: {
|
|
279
|
+
message: 'Ошибка при поиске подписки пользователя',
|
|
280
|
+
code: 'USER_TO_SUBSCRIPTION_002',
|
|
281
|
+
httpCode: 500,
|
|
282
|
+
},
|
|
283
|
+
USER_TO_SUBSCRIPTION_UPDATE_ERROR: {
|
|
284
|
+
message: 'Ошибка при обновлении подписки пользователя',
|
|
285
|
+
code: 'USER_TO_SUBSCRIPTION_003',
|
|
286
|
+
httpCode: 500,
|
|
287
|
+
},
|
|
288
|
+
USER_TO_SUBSCRIPTION_DELETE_ERROR: {
|
|
289
|
+
message: 'Ошибка при удалении подписки пользователя',
|
|
290
|
+
code: 'USER_TO_SUBSCRIPTION_004',
|
|
291
|
+
httpCode: 500,
|
|
292
|
+
},
|
|
229
293
|
|
|
230
294
|
// ORDER
|
|
231
295
|
ORDER_NOT_FOUND: {
|
package/models/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './user.schema';
|
|
2
2
|
export * from './product.schema';
|
|
3
3
|
export * from './subscription.schema';
|
|
4
|
+
export * from './user-to-product.schema';
|
|
5
|
+
export * from './user-to-subscription.schema';
|
|
4
6
|
export * from './cloud-payments-widget.schema';
|
|
5
7
|
export * from './cloud-payments-widget-data.schema';
|
|
6
8
|
export * from './image-generation';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_TO_PRODUCT_STATUS } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const UserToProductSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
siteId: z.string().uuid(),
|
|
7
|
+
userId: z.string().uuid(),
|
|
8
|
+
productId: z.string().uuid(),
|
|
9
|
+
orderId: z.string().uuid().nullable(),
|
|
10
|
+
initTokenBalance: z.number().int().min(0),
|
|
11
|
+
tokenBalance: z.number().int().min(0),
|
|
12
|
+
status: z.nativeEnum(USER_TO_PRODUCT_STATUS),
|
|
13
|
+
createdAt: z.date(),
|
|
14
|
+
updatedAt: z.date(),
|
|
15
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_TO_SUBSCRIPTION_STATUS, USER_TO_SUBSCRIPTION_TYPE } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const UserToSubscriptionSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
siteId: z.string().uuid(),
|
|
7
|
+
userId: z.string().uuid(),
|
|
8
|
+
subscriptionId: z.string().uuid(),
|
|
9
|
+
orderId: z.string().uuid().nullable(),
|
|
10
|
+
cloudPaymentsSubscriptionId: z.string().nullable(),
|
|
11
|
+
type: z.nativeEnum(USER_TO_SUBSCRIPTION_TYPE),
|
|
12
|
+
initTokenBalance: z.number().int().min(0),
|
|
13
|
+
tokenBalance: z.number().int().min(0),
|
|
14
|
+
initCarriedOverTokenBalance: z.number().int().min(0),
|
|
15
|
+
carriedOverTokenBalance: z.number().int().min(0),
|
|
16
|
+
status: z.nativeEnum(USER_TO_SUBSCRIPTION_STATUS),
|
|
17
|
+
active: z.boolean(),
|
|
18
|
+
startDate: z.date().nullable(),
|
|
19
|
+
intervalEndDate: z.date().nullable(),
|
|
20
|
+
endDate: z.date().nullable(),
|
|
21
|
+
createdAt: z.date(),
|
|
22
|
+
updatedAt: z.date(),
|
|
23
|
+
});
|