@purpleschool/multisite 0.0.21 → 0.0.23

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 (133) hide show
  1. package/api/controller/http/index.ts +3 -0
  2. package/api/controller/http/sitemap.ts +5 -0
  3. package/api/controller/http/user-to-product.ts +7 -0
  4. package/api/controller/http/user-to-subscription.ts +8 -0
  5. package/api/routes.ts +21 -0
  6. package/build/api/controller/http/index.d.ts +3 -0
  7. package/build/api/controller/http/index.d.ts.map +1 -1
  8. package/build/api/controller/http/index.js +3 -0
  9. package/build/api/controller/http/sitemap.d.ts +5 -0
  10. package/build/api/controller/http/sitemap.d.ts.map +1 -0
  11. package/build/api/controller/http/sitemap.js +7 -0
  12. package/build/api/controller/http/user-to-product.d.ts +7 -0
  13. package/build/api/controller/http/user-to-product.d.ts.map +1 -0
  14. package/build/api/controller/http/user-to-product.js +9 -0
  15. package/build/api/controller/http/user-to-subscription.d.ts +8 -0
  16. package/build/api/controller/http/user-to-subscription.d.ts.map +1 -0
  17. package/build/api/controller/http/user-to-subscription.js +10 -0
  18. package/build/api/routes.d.ts +14 -0
  19. package/build/api/routes.d.ts.map +1 -1
  20. package/build/api/routes.js +14 -0
  21. package/build/commands/image-editor/execute-image-editor.command.d.ts +4 -4
  22. package/build/commands/image-editor/retry-image-editor-job.command.d.ts +4 -4
  23. package/build/commands/image-editor/set-reaction-to-image-editor-job.command.d.ts +4 -4
  24. package/build/commands/image-editor/update-image-editor-job-title.command.d.ts +4 -4
  25. package/build/commands/image-generation/execute-image-generation.command.d.ts +4 -4
  26. package/build/commands/image-generation/retry-image-generation-job.command.d.ts +4 -4
  27. package/build/commands/image-generation/set-reaction-to-image-generation-job.command.d.ts +4 -4
  28. package/build/commands/image-generation/update-image-generation-job-title.command.d.ts +4 -4
  29. package/build/commands/index.d.ts +2 -0
  30. package/build/commands/index.d.ts.map +1 -1
  31. package/build/commands/index.js +2 -0
  32. package/build/commands/page/create-page.command.d.ts +4 -4
  33. package/build/commands/page/find-page-by-alias.command.d.ts +12 -12
  34. package/build/commands/page/find-page-by-criteria.command.d.ts +4 -4
  35. package/build/commands/page/find-page.command.d.ts +8 -8
  36. package/build/commands/page/update-page.command.d.ts +4 -4
  37. package/build/commands/payment/cloud-payments.command.d.ts +2 -2
  38. package/build/commands/stt/execute-stt.command.d.ts +12 -12
  39. package/build/commands/stt/retry-stt-job.command.d.ts +12 -12
  40. package/build/commands/stt/set-reaction-to-stt-job.command.d.ts +12 -12
  41. package/build/commands/stt/update-stt-job-title.command.d.ts +12 -12
  42. package/build/commands/tts/execute-tts.command.d.ts +12 -12
  43. package/build/commands/tts/retry-tts-job.command.d.ts +12 -12
  44. package/build/commands/tts/set-reaction-to-tts-job.command.d.ts +12 -12
  45. package/build/commands/tts/update-tts-job-title.command.d.ts +12 -12
  46. package/build/commands/unregistered-user/upsert-unregistered-user.command.d.ts +4 -4
  47. package/build/commands/user-to-product/delete-user-to-product.command.d.ts +20 -0
  48. package/build/commands/user-to-product/delete-user-to-product.command.d.ts.map +1 -0
  49. package/build/commands/user-to-product/delete-user-to-product.command.js +13 -0
  50. package/build/commands/user-to-product/get-user-to-product-by-uuid.command.d.ts +75 -0
  51. package/build/commands/user-to-product/get-user-to-product-by-uuid.command.d.ts.map +1 -0
  52. package/build/commands/user-to-product/get-user-to-product-by-uuid.command.js +14 -0
  53. package/build/commands/user-to-product/index.d.ts +4 -0
  54. package/build/commands/user-to-product/index.d.ts.map +1 -0
  55. package/build/commands/user-to-product/index.js +19 -0
  56. package/build/commands/user-to-product/update-user-to-product.command.d.ts +93 -0
  57. package/build/commands/user-to-product/update-user-to-product.command.d.ts.map +1 -0
  58. package/build/commands/user-to-product/update-user-to-product.command.js +21 -0
  59. package/build/commands/user-to-subscription/admin-cancel-subscription.command.d.ts +14 -0
  60. package/build/commands/user-to-subscription/admin-cancel-subscription.command.d.ts.map +1 -0
  61. package/build/commands/user-to-subscription/admin-cancel-subscription.command.js +11 -0
  62. package/build/commands/user-to-subscription/delete-user-to-subscription.command.d.ts +20 -0
  63. package/build/commands/user-to-subscription/delete-user-to-subscription.command.d.ts.map +1 -0
  64. package/build/commands/user-to-subscription/delete-user-to-subscription.command.js +13 -0
  65. package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.d.ts +115 -0
  66. package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.d.ts.map +1 -0
  67. package/build/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.js +14 -0
  68. package/build/commands/user-to-subscription/index.d.ts +5 -0
  69. package/build/commands/user-to-subscription/index.d.ts.map +1 -0
  70. package/build/commands/user-to-subscription/index.js +20 -0
  71. package/build/commands/user-to-subscription/update-user-to-subscription.command.d.ts +157 -0
  72. package/build/commands/user-to-subscription/update-user-to-subscription.command.d.ts.map +1 -0
  73. package/build/commands/user-to-subscription/update-user-to-subscription.command.js +29 -0
  74. package/build/constants/errors/errors.d.ts +60 -0
  75. package/build/constants/errors/errors.d.ts.map +1 -1
  76. package/build/constants/errors/errors.js +62 -0
  77. package/build/models/image-editor/image-editor-config.schema.d.ts +10 -10
  78. package/build/models/image-editor/image-editor-job.schema.d.ts +2 -2
  79. package/build/models/image-editor/image-editor-model.schema.d.ts +2 -2
  80. package/build/models/image-editor/image-editor-prompt-group.schema.d.ts +4 -4
  81. package/build/models/image-editor/image-editor-system-prompt.schema.d.ts +2 -2
  82. package/build/models/image-generation/image-generation-config.schema.d.ts +6 -6
  83. package/build/models/image-generation/image-generation-job.schema.d.ts +2 -2
  84. package/build/models/image-generation/image-generation-model.schema.d.ts +2 -2
  85. package/build/models/image-generation/image-generation-vendor.schema.d.ts +4 -4
  86. package/build/models/index.d.ts +2 -0
  87. package/build/models/index.d.ts.map +1 -1
  88. package/build/models/index.js +2 -0
  89. package/build/models/page.schema.d.ts +4 -4
  90. package/build/models/stt/stt-config.schema.d.ts +8 -8
  91. package/build/models/stt/stt-job.schema.d.ts +6 -6
  92. package/build/models/stt/stt-model.schema.d.ts +4 -4
  93. package/build/models/tts/tts-config.schema.d.ts +8 -8
  94. package/build/models/tts/tts-job.schema.d.ts +6 -6
  95. package/build/models/tts/tts-model.schema.d.ts +4 -4
  96. package/build/models/user-to-product.schema.d.ts +37 -0
  97. package/build/models/user-to-product.schema.d.ts.map +1 -0
  98. package/build/models/user-to-product.schema.js +17 -0
  99. package/build/models/user-to-subscription.schema.d.ts +61 -0
  100. package/build/models/user-to-subscription.schema.d.ts.map +1 -0
  101. package/build/models/user-to-subscription.schema.js +25 -0
  102. package/build/queries/image-editor/find-image-editor-jobs.command.d.ts +4 -4
  103. package/build/queries/image-editor/get-image-editor-config.command.d.ts +14 -14
  104. package/build/queries/image-editor/get-image-editor-job.command.d.ts +4 -4
  105. package/build/queries/image-generation/find-image-generation-jobs.command.d.ts +4 -4
  106. package/build/queries/image-generation/get-image-generation-config.command.d.ts +8 -8
  107. package/build/queries/image-generation/get-image-generation-job.command.d.ts +4 -4
  108. package/build/queries/payment/get-payment-history.command.d.ts +6 -6
  109. package/build/queries/stt/find-stt-jobs.command.d.ts +12 -12
  110. package/build/queries/stt/get-stt-config.command.d.ts +12 -12
  111. package/build/queries/stt/get-stt-job.command.d.ts +12 -12
  112. package/build/queries/subscription/get-subscriptions-summary.command.d.ts +16 -16
  113. package/build/queries/tts/find-tts-jobs.command.d.ts +12 -12
  114. package/build/queries/tts/get-tts-config.command.d.ts +12 -12
  115. package/build/queries/tts/get-tts-job.command.d.ts +12 -12
  116. package/build/queries/user/get-my-products.command.d.ts +8 -8
  117. package/build/queries/user/get-my-subscriptions.command.d.ts +12 -12
  118. package/build/queries/user/get-user-payments.command.d.ts +18 -18
  119. package/commands/index.ts +2 -0
  120. package/commands/user-to-product/delete-user-to-product.command.ts +13 -0
  121. package/commands/user-to-product/get-user-to-product-by-uuid.command.ts +14 -0
  122. package/commands/user-to-product/index.ts +3 -0
  123. package/commands/user-to-product/update-user-to-product.command.ts +23 -0
  124. package/commands/user-to-subscription/admin-cancel-subscription.command.ts +11 -0
  125. package/commands/user-to-subscription/delete-user-to-subscription.command.ts +13 -0
  126. package/commands/user-to-subscription/get-user-to-subscription-by-uuid.command.ts +14 -0
  127. package/commands/user-to-subscription/index.ts +4 -0
  128. package/commands/user-to-subscription/update-user-to-subscription.command.ts +31 -0
  129. package/constants/errors/errors.ts +64 -0
  130. package/models/index.ts +2 -0
  131. package/models/user-to-product.schema.ts +15 -0
  132. package/models/user-to-subscription.schema.ts +23 -0
  133. package/package.json +1 -1
@@ -51,9 +51,9 @@ export declare namespace GetMyProductsCommand {
51
51
  }, "strip", z.ZodTypeAny, {
52
52
  uuid: string;
53
53
  status: USER_TO_PRODUCT_STATUS;
54
- createdAt: string | Date;
55
- tokenBalance: number;
56
54
  initTokenBalance: number;
55
+ tokenBalance: number;
56
+ createdAt: string | Date;
57
57
  product: {
58
58
  price: number;
59
59
  uuid: string;
@@ -69,9 +69,9 @@ export declare namespace GetMyProductsCommand {
69
69
  }, {
70
70
  uuid: string;
71
71
  status: USER_TO_PRODUCT_STATUS;
72
- createdAt: string | Date;
73
- tokenBalance: number;
74
72
  initTokenBalance: number;
73
+ tokenBalance: number;
74
+ createdAt: string | Date;
75
75
  product: {
76
76
  price: number;
77
77
  uuid: string;
@@ -89,9 +89,9 @@ export declare namespace GetMyProductsCommand {
89
89
  data: {
90
90
  uuid: string;
91
91
  status: USER_TO_PRODUCT_STATUS;
92
- createdAt: string | Date;
93
- tokenBalance: number;
94
92
  initTokenBalance: number;
93
+ tokenBalance: number;
94
+ createdAt: string | Date;
95
95
  product: {
96
96
  price: number;
97
97
  uuid: string;
@@ -109,9 +109,9 @@ export declare namespace GetMyProductsCommand {
109
109
  data: {
110
110
  uuid: string;
111
111
  status: USER_TO_PRODUCT_STATUS;
112
- createdAt: string | Date;
113
- tokenBalance: number;
114
112
  initTokenBalance: number;
113
+ tokenBalance: number;
114
+ createdAt: string | Date;
115
115
  product: {
116
116
  price: number;
117
117
  uuid: string;
@@ -67,10 +67,11 @@ export declare namespace GetMySubscriptionsCommand {
67
67
  active: boolean;
68
68
  uuid: string;
69
69
  status: USER_TO_SUBSCRIPTION_STATUS;
70
- createdAt: string | Date;
71
- tokenBalance: number;
72
70
  initTokenBalance: number;
71
+ tokenBalance: number;
72
+ createdAt: string | Date;
73
73
  carriedOverTokenBalance: number;
74
+ endDate: string | Date | null;
74
75
  subscription: {
75
76
  price: number;
76
77
  interval: string;
@@ -87,15 +88,15 @@ export declare namespace GetMySubscriptionsCommand {
87
88
  discount: number;
88
89
  carryoverPercent: number;
89
90
  };
90
- endDate: string | Date | null;
91
91
  }, {
92
92
  active: boolean;
93
93
  uuid: string;
94
94
  status: USER_TO_SUBSCRIPTION_STATUS;
95
- createdAt: string | Date;
96
- tokenBalance: number;
97
95
  initTokenBalance: number;
96
+ tokenBalance: number;
97
+ createdAt: string | Date;
98
98
  carriedOverTokenBalance: number;
99
+ endDate: string | Date | null;
99
100
  subscription: {
100
101
  price: number;
101
102
  interval: string;
@@ -112,17 +113,17 @@ export declare namespace GetMySubscriptionsCommand {
112
113
  discount: number;
113
114
  carryoverPercent: number;
114
115
  };
115
- endDate: string | Date | null;
116
116
  }>, "many">;
117
117
  }, "strip", z.ZodTypeAny, {
118
118
  data: {
119
119
  active: boolean;
120
120
  uuid: string;
121
121
  status: USER_TO_SUBSCRIPTION_STATUS;
122
- createdAt: string | Date;
123
- tokenBalance: number;
124
122
  initTokenBalance: number;
123
+ tokenBalance: number;
124
+ createdAt: string | Date;
125
125
  carriedOverTokenBalance: number;
126
+ endDate: string | Date | null;
126
127
  subscription: {
127
128
  price: number;
128
129
  interval: string;
@@ -139,17 +140,17 @@ export declare namespace GetMySubscriptionsCommand {
139
140
  discount: number;
140
141
  carryoverPercent: number;
141
142
  };
142
- endDate: string | Date | null;
143
143
  }[];
144
144
  }, {
145
145
  data: {
146
146
  active: boolean;
147
147
  uuid: string;
148
148
  status: USER_TO_SUBSCRIPTION_STATUS;
149
- createdAt: string | Date;
150
- tokenBalance: number;
151
149
  initTokenBalance: number;
150
+ tokenBalance: number;
151
+ createdAt: string | Date;
152
152
  carriedOverTokenBalance: number;
153
+ endDate: string | Date | null;
153
154
  subscription: {
154
155
  price: number;
155
156
  interval: string;
@@ -166,7 +167,6 @@ export declare namespace GetMySubscriptionsCommand {
166
167
  discount: number;
167
168
  carryoverPercent: number;
168
169
  };
169
- endDate: string | Date | null;
170
170
  }[];
171
171
  }>;
172
172
  type Response = z.infer<typeof ResponseSchema>;
@@ -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.23",
4
4
  "description": "Multisite API contracts (DTO schemas, routes, constants)",
5
5
  "type": "commonjs",
6
6
  "main": "build/index.js",