@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.
Files changed (129) hide show
  1. package/api/controller/http/index.ts +2 -0
  2. package/api/controller/http/user-to-product.ts +7 -0
  3. package/api/controller/http/user-to-subscription.ts +8 -0
  4. package/api/routes.ts +18 -0
  5. package/build/api/controller/http/index.d.ts +2 -0
  6. package/build/api/controller/http/index.d.ts.map +1 -1
  7. package/build/api/controller/http/index.js +2 -0
  8. package/build/api/controller/http/user-to-product.d.ts +7 -0
  9. package/build/api/controller/http/user-to-product.d.ts.map +1 -0
  10. package/build/api/controller/http/user-to-product.js +9 -0
  11. package/build/api/controller/http/user-to-subscription.d.ts +8 -0
  12. package/build/api/controller/http/user-to-subscription.d.ts.map +1 -0
  13. package/build/api/controller/http/user-to-subscription.js +10 -0
  14. package/build/api/routes.d.ts +11 -0
  15. package/build/api/routes.d.ts.map +1 -1
  16. package/build/api/routes.js +11 -0
  17. package/build/commands/image-editor/execute-image-editor.command.d.ts +4 -4
  18. package/build/commands/image-editor/retry-image-editor-job.command.d.ts +4 -4
  19. package/build/commands/image-editor/set-reaction-to-image-editor-job.command.d.ts +4 -4
  20. package/build/commands/image-editor/update-image-editor-job-title.command.d.ts +4 -4
  21. package/build/commands/image-generation/execute-image-generation.command.d.ts +4 -4
  22. package/build/commands/image-generation/retry-image-generation-job.command.d.ts +4 -4
  23. package/build/commands/image-generation/set-reaction-to-image-generation-job.command.d.ts +4 -4
  24. package/build/commands/image-generation/update-image-generation-job-title.command.d.ts +4 -4
  25. package/build/commands/index.d.ts +2 -0
  26. package/build/commands/index.d.ts.map +1 -1
  27. package/build/commands/index.js +2 -0
  28. package/build/commands/page/create-page.command.d.ts +4 -4
  29. package/build/commands/page/find-page-by-alias.command.d.ts +12 -12
  30. package/build/commands/page/find-page-by-criteria.command.d.ts +4 -4
  31. package/build/commands/page/find-page.command.d.ts +8 -8
  32. package/build/commands/page/update-page.command.d.ts +4 -4
  33. package/build/commands/payment/cloud-payments.command.d.ts +2 -2
  34. package/build/commands/stt/execute-stt.command.d.ts +12 -12
  35. package/build/commands/stt/retry-stt-job.command.d.ts +12 -12
  36. package/build/commands/stt/set-reaction-to-stt-job.command.d.ts +12 -12
  37. package/build/commands/stt/update-stt-job-title.command.d.ts +12 -12
  38. package/build/commands/tts/execute-tts.command.d.ts +12 -12
  39. package/build/commands/tts/retry-tts-job.command.d.ts +12 -12
  40. package/build/commands/tts/set-reaction-to-tts-job.command.d.ts +12 -12
  41. package/build/commands/tts/update-tts-job-title.command.d.ts +12 -12
  42. package/build/commands/unregistered-user/upsert-unregistered-user.command.d.ts +4 -4
  43. package/build/commands/user-to-product/delete-user-to-product.command.d.ts +20 -0
  44. package/build/commands/user-to-product/delete-user-to-product.command.d.ts.map +1 -0
  45. package/build/commands/user-to-product/delete-user-to-product.command.js +13 -0
  46. package/build/commands/user-to-product/get-user-to-product-by-uuid.command.d.ts +75 -0
  47. package/build/commands/user-to-product/get-user-to-product-by-uuid.command.d.ts.map +1 -0
  48. package/build/commands/user-to-product/get-user-to-product-by-uuid.command.js +14 -0
  49. package/build/commands/user-to-product/index.d.ts +4 -0
  50. package/build/commands/user-to-product/index.d.ts.map +1 -0
  51. package/build/commands/user-to-product/index.js +19 -0
  52. package/build/commands/user-to-product/update-user-to-product.command.d.ts +93 -0
  53. package/build/commands/user-to-product/update-user-to-product.command.d.ts.map +1 -0
  54. package/build/commands/user-to-product/update-user-to-product.command.js +21 -0
  55. package/build/commands/user-to-subscription/admin-cancel-subscription.command.d.ts +14 -0
  56. package/build/commands/user-to-subscription/admin-cancel-subscription.command.d.ts.map +1 -0
  57. package/build/commands/user-to-subscription/admin-cancel-subscription.command.js +11 -0
  58. package/build/commands/user-to-subscription/delete-user-to-subscription.command.d.ts +20 -0
  59. package/build/commands/user-to-subscription/delete-user-to-subscription.command.d.ts.map +1 -0
  60. package/build/commands/user-to-subscription/delete-user-to-subscription.command.js +13 -0
  61. package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.d.ts +115 -0
  62. package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.d.ts.map +1 -0
  63. package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.js +14 -0
  64. package/build/commands/user-to-subscription/index.d.ts +5 -0
  65. package/build/commands/user-to-subscription/index.d.ts.map +1 -0
  66. package/build/commands/user-to-subscription/index.js +20 -0
  67. package/build/commands/user-to-subscription/update-user-to-subscription.command.d.ts +157 -0
  68. package/build/commands/user-to-subscription/update-user-to-subscription.command.d.ts.map +1 -0
  69. package/build/commands/user-to-subscription/update-user-to-subscription.command.js +29 -0
  70. package/build/constants/errors/errors.d.ts +60 -0
  71. package/build/constants/errors/errors.d.ts.map +1 -1
  72. package/build/constants/errors/errors.js +62 -0
  73. package/build/models/image-editor/image-editor-config.schema.d.ts +10 -10
  74. package/build/models/image-editor/image-editor-job.schema.d.ts +2 -2
  75. package/build/models/image-editor/image-editor-model.schema.d.ts +2 -2
  76. package/build/models/image-editor/image-editor-prompt-group.schema.d.ts +4 -4
  77. package/build/models/image-editor/image-editor-system-prompt.schema.d.ts +2 -2
  78. package/build/models/image-generation/image-generation-config.schema.d.ts +6 -6
  79. package/build/models/image-generation/image-generation-job.schema.d.ts +2 -2
  80. package/build/models/image-generation/image-generation-model.schema.d.ts +2 -2
  81. package/build/models/image-generation/image-generation-vendor.schema.d.ts +4 -4
  82. package/build/models/index.d.ts +2 -0
  83. package/build/models/index.d.ts.map +1 -1
  84. package/build/models/index.js +2 -0
  85. package/build/models/page.schema.d.ts +4 -4
  86. package/build/models/stt/stt-config.schema.d.ts +8 -8
  87. package/build/models/stt/stt-job.schema.d.ts +6 -6
  88. package/build/models/stt/stt-model.schema.d.ts +4 -4
  89. package/build/models/tts/tts-config.schema.d.ts +8 -8
  90. package/build/models/tts/tts-job.schema.d.ts +6 -6
  91. package/build/models/tts/tts-model.schema.d.ts +4 -4
  92. package/build/models/user-to-product.schema.d.ts +37 -0
  93. package/build/models/user-to-product.schema.d.ts.map +1 -0
  94. package/build/models/user-to-product.schema.js +17 -0
  95. package/build/models/user-to-subscription.schema.d.ts +61 -0
  96. package/build/models/user-to-subscription.schema.d.ts.map +1 -0
  97. package/build/models/user-to-subscription.schema.js +25 -0
  98. package/build/queries/image-editor/find-image-editor-jobs.command.d.ts +4 -4
  99. package/build/queries/image-editor/get-image-editor-config.command.d.ts +14 -14
  100. package/build/queries/image-editor/get-image-editor-job.command.d.ts +4 -4
  101. package/build/queries/image-generation/find-image-generation-jobs.command.d.ts +4 -4
  102. package/build/queries/image-generation/get-image-generation-config.command.d.ts +8 -8
  103. package/build/queries/image-generation/get-image-generation-job.command.d.ts +4 -4
  104. package/build/queries/payment/get-payment-history.command.d.ts +6 -6
  105. package/build/queries/stt/find-stt-jobs.command.d.ts +12 -12
  106. package/build/queries/stt/get-stt-config.command.d.ts +12 -12
  107. package/build/queries/stt/get-stt-job.command.d.ts +12 -12
  108. package/build/queries/subscription/get-subscriptions-summary.command.d.ts +16 -16
  109. package/build/queries/tts/find-tts-jobs.command.d.ts +12 -12
  110. package/build/queries/tts/get-tts-config.command.d.ts +12 -12
  111. package/build/queries/tts/get-tts-job.command.d.ts +12 -12
  112. package/build/queries/user/get-my-products.command.d.ts +8 -8
  113. package/build/queries/user/get-my-subscriptions.command.d.ts +12 -12
  114. package/build/queries/user/get-user-payments.command.d.ts +18 -18
  115. package/commands/index.ts +2 -0
  116. package/commands/user-to-product/delete-user-to-product.command.ts +13 -0
  117. package/commands/user-to-product/get-user-to-product-by-uuid.command.ts +14 -0
  118. package/commands/user-to-product/index.ts +3 -0
  119. package/commands/user-to-product/update-user-to-product.command.ts +23 -0
  120. package/commands/user-to-subscription/admin-cancel-subscription.command.ts +11 -0
  121. package/commands/user-to-subscription/delete-user-to-subscription.command.ts +13 -0
  122. package/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.ts +14 -0
  123. package/commands/user-to-subscription/index.ts +4 -0
  124. package/commands/user-to-subscription/update-user-to-subscription.command.ts +31 -0
  125. package/constants/errors/errors.ts +64 -0
  126. package/models/index.ts +2 -0
  127. package/models/user-to-product.schema.ts +15 -0
  128. package/models/user-to-subscription.schema.ts +23 -0
  129. 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
@@ -1,6 +1,8 @@
1
1
  export * from './auth';
2
2
  export * from './product';
3
3
  export * from './subscription';
4
+ export * from './user-to-product';
5
+ export * from './user-to-subscription';
4
6
  export * from './payment';
5
7
  export * from './transaction';
6
8
  export * from './image-generation';
@@ -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,3 @@
1
+ export * from './get-user-to-product-by-uuid.command';
2
+ export * from './update-user-to-product.command';
3
+ export * from './delete-user-to-product.command';
@@ -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,4 @@
1
+ export * from './get-user-to-subscription-by-uuid.command';
2
+ export * from './update-user-to-subscription.command';
3
+ export * from './delete-user-to-subscription.command';
4
+ export * from './admin-cancel-subscription.command';
@@ -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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/multisite",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Multisite API contracts (DTO schemas, routes, constants)",
5
5
  "type": "commonjs",
6
6
  "main": "build/index.js",