@purpleschool/gptbot 0.0.8 → 0.1.0
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/controllers/index.ts +2 -0
- package/api/controllers/product.ts +6 -0
- package/api/controllers/subscription.ts +6 -0
- package/api/routes.ts +16 -0
- package/build/api/controllers/index.js +2 -0
- package/build/api/controllers/product.js +8 -0
- package/build/api/controllers/subscription.js +8 -0
- package/build/api/routes.js +14 -0
- package/build/commands/index.js +2 -0
- package/build/commands/product/create-product.command.js +16 -0
- package/build/commands/product/delete-product.command.js +14 -0
- package/build/commands/product/find-product.command.js +17 -0
- package/build/commands/product/index.js +20 -0
- package/build/commands/product/update-product.command.js +19 -0
- package/build/commands/subscription/create-subscription.command.js +16 -0
- package/build/commands/subscription/delete-subscription.command.js +14 -0
- package/build/commands/subscription/find-subscription.command.js +17 -0
- package/build/commands/subscription/index.js +20 -0
- package/build/commands/subscription/update-subscription.command.js +19 -0
- package/build/constants/errors/errors.js +68 -0
- package/build/constants/index.js +2 -0
- package/build/constants/order/enums/index.js +17 -0
- package/build/constants/order/enums/order-status.enum.js +16 -0
- package/build/constants/order/index.js +17 -0
- package/build/constants/payment/enums/index.js +17 -0
- package/build/constants/payment/enums/payment-status.enum.js +9 -0
- package/build/constants/payment/index.js +17 -0
- package/build/models/index.js +3 -0
- package/build/models/order.schema.js +13 -0
- package/build/models/payment.schema.js +13 -0
- package/build/models/product.schema.js +13 -0
- package/build/models/subscription.schema.js +13 -0
- package/commands/index.ts +2 -0
- package/commands/product/create-product.command.ts +18 -0
- package/commands/product/delete-product.command.ts +15 -0
- package/commands/product/find-product.command.ts +22 -0
- package/commands/product/index.ts +4 -0
- package/commands/product/update-product.command.ts +24 -0
- package/commands/subscription/create-subscription.command.ts +18 -0
- package/commands/subscription/delete-subscription.command.ts +15 -0
- package/commands/subscription/find-subscription.command.ts +22 -0
- package/commands/subscription/index.ts +4 -0
- package/commands/subscription/update-subscription.command.ts +24 -0
- package/constants/errors/errors.ts +68 -0
- package/constants/index.ts +2 -0
- package/constants/order/enums/index.ts +1 -0
- package/constants/order/enums/order-status.enum.ts +12 -0
- package/constants/order/index.ts +1 -0
- package/constants/payment/enums/index.ts +1 -0
- package/constants/payment/enums/payment-status.enum.ts +5 -0
- package/constants/payment/index.ts +1 -0
- package/models/index.ts +3 -0
- package/models/order.schema.ts +12 -0
- package/models/payment.schema.ts +12 -0
- package/models/product.schema.ts +12 -0
- package/models/subscription.schema.ts +12 -0
- package/package.json +1 -1
package/api/controllers/index.ts
CHANGED
package/api/routes.ts
CHANGED
|
@@ -72,4 +72,20 @@ export const REST_API = {
|
|
|
72
72
|
CREATE_MESSAGE: (uuid: string): string =>
|
|
73
73
|
`${ROOT}/${CONTROLLERS.CHAT_PUBLIC_CONTROLLER}/${CONTROLLERS.CHAT_PUBLIC_ROUTES.CREATE_MESSAGE(uuid)}`,
|
|
74
74
|
},
|
|
75
|
+
PRODUCT: {
|
|
76
|
+
GET: `${ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${CONTROLLERS.PRODUCT_ROUTES.GET_ALL}`,
|
|
77
|
+
PATCH: (uuid: string) => `${ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${uuid}`,
|
|
78
|
+
DELETE: (uuid: string) => `${ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${uuid}`,
|
|
79
|
+
CREATE: `${ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}`,
|
|
80
|
+
GET_BY_UUID: (uuid: string): string =>
|
|
81
|
+
`${ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${CONTROLLERS.PRODUCT_ROUTES.FIND_BY_UUID}/${uuid}`,
|
|
82
|
+
},
|
|
83
|
+
SUBSCRIPTION: {
|
|
84
|
+
GET: `${ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET_ALL}`,
|
|
85
|
+
PATCH: (uuid: string) => `${ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${uuid}`,
|
|
86
|
+
DELETE: (uuid: string) => `${ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${uuid}`,
|
|
87
|
+
CREATE: `${ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}`,
|
|
88
|
+
GET_BY_UUID: (uuid: string): string =>
|
|
89
|
+
`${ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.FIND_BY_UUID}/${uuid}`,
|
|
90
|
+
},
|
|
75
91
|
} as const;
|
|
@@ -23,3 +23,5 @@ __exportStar(require("./unregistered-user"), exports);
|
|
|
23
23
|
__exportStar(require("./ai-model"), exports);
|
|
24
24
|
__exportStar(require("./chat-private"), exports);
|
|
25
25
|
__exportStar(require("./chat-public"), exports);
|
|
26
|
+
__exportStar(require("./product"), exports);
|
|
27
|
+
__exportStar(require("./subscription"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUBSCRIPTION_ROUTES = exports.SUBSCRIPTION_CONTROLLER = void 0;
|
|
4
|
+
exports.SUBSCRIPTION_CONTROLLER = 'subscription';
|
|
5
|
+
exports.SUBSCRIPTION_ROUTES = {
|
|
6
|
+
FIND_BY_UUID: 'by/uuid',
|
|
7
|
+
GET_ALL: 'all',
|
|
8
|
+
};
|
package/build/api/routes.js
CHANGED
|
@@ -88,4 +88,18 @@ exports.REST_API = {
|
|
|
88
88
|
GET_BY_LAST_ACTIVE_CHAT: `${exports.ROOT}/${CONTROLLERS.CHAT_PUBLIC_CONTROLLER}/${CONTROLLERS.CHAT_PUBLIC_ROUTES.GET_LAST_ACTIVE_CHAT}`,
|
|
89
89
|
CREATE_MESSAGE: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PUBLIC_CONTROLLER}/${CONTROLLERS.CHAT_PUBLIC_ROUTES.CREATE_MESSAGE(uuid)}`,
|
|
90
90
|
},
|
|
91
|
+
PRODUCT: {
|
|
92
|
+
GET: `${exports.ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${CONTROLLERS.PRODUCT_ROUTES.GET_ALL}`,
|
|
93
|
+
PATCH: (uuid) => `${exports.ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${uuid}`,
|
|
94
|
+
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${uuid}`,
|
|
95
|
+
CREATE: `${exports.ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}`,
|
|
96
|
+
GET_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.PRODUCT_CONTROLLER}/${CONTROLLERS.PRODUCT_ROUTES.FIND_BY_UUID}/${uuid}`,
|
|
97
|
+
},
|
|
98
|
+
SUBSCRIPTION: {
|
|
99
|
+
GET: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET_ALL}`,
|
|
100
|
+
PATCH: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${uuid}`,
|
|
101
|
+
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${uuid}`,
|
|
102
|
+
CREATE: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}`,
|
|
103
|
+
GET_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.FIND_BY_UUID}/${uuid}`,
|
|
104
|
+
},
|
|
91
105
|
};
|
package/build/commands/index.js
CHANGED
|
@@ -23,3 +23,5 @@ __exportStar(require("./unregistered-user"), exports);
|
|
|
23
23
|
__exportStar(require("./ai-model"), exports);
|
|
24
24
|
__exportStar(require("./chat"), exports);
|
|
25
25
|
__exportStar(require("./message"), exports);
|
|
26
|
+
__exportStar(require("./product"), exports);
|
|
27
|
+
__exportStar(require("./subscription"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateProductCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var CreateProductCommand;
|
|
7
|
+
(function (CreateProductCommand) {
|
|
8
|
+
CreateProductCommand.RequestSchema = models_1.ProductSchema.omit({
|
|
9
|
+
uuid: true,
|
|
10
|
+
createdAt: true,
|
|
11
|
+
updatedAt: true,
|
|
12
|
+
});
|
|
13
|
+
CreateProductCommand.ResponseSchema = zod_1.z.object({
|
|
14
|
+
data: models_1.ProductSchema,
|
|
15
|
+
});
|
|
16
|
+
})(CreateProductCommand || (exports.CreateProductCommand = CreateProductCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteProductCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var DeleteProductCommand;
|
|
7
|
+
(function (DeleteProductCommand) {
|
|
8
|
+
DeleteProductCommand.RequestSchema = models_1.ProductSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
DeleteProductCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
isDeleted: zod_1.z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
})(DeleteProductCommand || (exports.DeleteProductCommand = DeleteProductCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindProductCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var FindProductCommand;
|
|
7
|
+
(function (FindProductCommand) {
|
|
8
|
+
FindProductCommand.RequestSchema = models_1.ProductSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
FindProductCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: zod_1.z.array(models_1.ProductSchema),
|
|
13
|
+
});
|
|
14
|
+
FindProductCommand.ResponseByUUIDSchema = zod_1.z.object({
|
|
15
|
+
data: models_1.ProductSchema,
|
|
16
|
+
});
|
|
17
|
+
})(FindProductCommand || (exports.FindProductCommand = FindProductCommand = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./update-product.command"), exports);
|
|
18
|
+
__exportStar(require("./delete-product.command"), exports);
|
|
19
|
+
__exportStar(require("./create-product.command"), exports);
|
|
20
|
+
__exportStar(require("./find-product.command"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateProductCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var UpdateProductCommand;
|
|
7
|
+
(function (UpdateProductCommand) {
|
|
8
|
+
UpdateProductCommand.RequestSchema = models_1.ProductSchema.omit({
|
|
9
|
+
createdAt: true,
|
|
10
|
+
updatedAt: true,
|
|
11
|
+
uuid: true,
|
|
12
|
+
}).partial();
|
|
13
|
+
UpdateProductCommand.RequestParamSchema = zod_1.z.object({
|
|
14
|
+
uuid: zod_1.z.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
UpdateProductCommand.ResponseSchema = zod_1.z.object({
|
|
17
|
+
data: models_1.ProductSchema,
|
|
18
|
+
});
|
|
19
|
+
})(UpdateProductCommand || (exports.UpdateProductCommand = UpdateProductCommand = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateSubscriptionCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var CreateSubscriptionCommand;
|
|
7
|
+
(function (CreateSubscriptionCommand) {
|
|
8
|
+
CreateSubscriptionCommand.RequestSchema = models_1.SubscriptionSchema.omit({
|
|
9
|
+
uuid: true,
|
|
10
|
+
createdAt: true,
|
|
11
|
+
updatedAt: true,
|
|
12
|
+
});
|
|
13
|
+
CreateSubscriptionCommand.ResponseSchema = zod_1.z.object({
|
|
14
|
+
data: models_1.SubscriptionSchema,
|
|
15
|
+
});
|
|
16
|
+
})(CreateSubscriptionCommand || (exports.CreateSubscriptionCommand = CreateSubscriptionCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteSubscriptionCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var DeleteSubscriptionCommand;
|
|
7
|
+
(function (DeleteSubscriptionCommand) {
|
|
8
|
+
DeleteSubscriptionCommand.RequestSchema = models_1.SubscriptionSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
DeleteSubscriptionCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
isDeleted: zod_1.z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
})(DeleteSubscriptionCommand || (exports.DeleteSubscriptionCommand = DeleteSubscriptionCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindSubscriptionCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var FindSubscriptionCommand;
|
|
7
|
+
(function (FindSubscriptionCommand) {
|
|
8
|
+
FindSubscriptionCommand.RequestSchema = models_1.SubscriptionSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
FindSubscriptionCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: zod_1.z.array(models_1.SubscriptionSchema),
|
|
13
|
+
});
|
|
14
|
+
FindSubscriptionCommand.ResponseByUUIDSchema = zod_1.z.object({
|
|
15
|
+
data: models_1.SubscriptionSchema,
|
|
16
|
+
});
|
|
17
|
+
})(FindSubscriptionCommand || (exports.FindSubscriptionCommand = FindSubscriptionCommand = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./update-subscription.command"), exports);
|
|
18
|
+
__exportStar(require("./delete-subscription.command"), exports);
|
|
19
|
+
__exportStar(require("./create-subscription.command"), exports);
|
|
20
|
+
__exportStar(require("./find-subscription.command"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateSubscriptionCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var UpdateSubscriptionCommand;
|
|
7
|
+
(function (UpdateSubscriptionCommand) {
|
|
8
|
+
UpdateSubscriptionCommand.RequestSchema = models_1.SubscriptionSchema.omit({
|
|
9
|
+
createdAt: true,
|
|
10
|
+
updatedAt: true,
|
|
11
|
+
uuid: true,
|
|
12
|
+
}).partial();
|
|
13
|
+
UpdateSubscriptionCommand.RequestParamSchema = zod_1.z.object({
|
|
14
|
+
uuid: zod_1.z.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
UpdateSubscriptionCommand.ResponseSchema = zod_1.z.object({
|
|
17
|
+
data: models_1.SubscriptionSchema,
|
|
18
|
+
});
|
|
19
|
+
})(UpdateSubscriptionCommand || (exports.UpdateSubscriptionCommand = UpdateSubscriptionCommand = {}));
|
|
@@ -192,4 +192,72 @@ exports.ERRORS = {
|
|
|
192
192
|
message: 'Страница alias не найдена',
|
|
193
193
|
httpCode: 404,
|
|
194
194
|
},
|
|
195
|
+
PRODUCT_NOT_FOUND_BY_UUID: {
|
|
196
|
+
code: 'A044',
|
|
197
|
+
message: 'Продукт с таким uuid не найден',
|
|
198
|
+
httpCode: 404,
|
|
199
|
+
},
|
|
200
|
+
PRODUCT_DELETE_ERROR: { code: 'A045', message: 'Продукт не был удалён', httpCode: 500 },
|
|
201
|
+
PRODUCT_CREATE_ERROR: { code: 'A046', message: 'Продукт не был создан', httpCode: 500 },
|
|
202
|
+
PRODUCT_FIND_ERROR: { code: 'A047', message: 'Продукт не найден', httpCode: 404 },
|
|
203
|
+
PRODUCTS_FIND_ERROR: {
|
|
204
|
+
code: 'A048',
|
|
205
|
+
message: 'Продукты не найдены',
|
|
206
|
+
httpCode: 404,
|
|
207
|
+
},
|
|
208
|
+
PRODUCT_UPDATE_ERROR: { code: 'A049', message: 'Продукт не был обновлен', httpCode: 500 },
|
|
209
|
+
SUBSCRIPTION_NOT_FOUND_BY_UUID: {
|
|
210
|
+
code: 'A050',
|
|
211
|
+
message: 'Подписка с таким uuid не найден',
|
|
212
|
+
httpCode: 404,
|
|
213
|
+
},
|
|
214
|
+
SUBSCRIPTION_DELETE_ERROR: { code: 'A051', message: 'Подписка не была удалена', httpCode: 500 },
|
|
215
|
+
SUBSCRIPTION_CREATE_ERROR: { code: 'A052', message: 'Подписка не была создана', httpCode: 500 },
|
|
216
|
+
SUBSCRIPTION_FIND_ERROR: { code: 'A053', message: 'Подписка не найдена', httpCode: 404 },
|
|
217
|
+
SUBSCRIPTIONS_FIND_ERROR: {
|
|
218
|
+
code: 'A054',
|
|
219
|
+
message: 'Подписки не найдены',
|
|
220
|
+
httpCode: 404,
|
|
221
|
+
},
|
|
222
|
+
SUBSCRIPTION_UPDATE_ERROR: {
|
|
223
|
+
code: 'A055',
|
|
224
|
+
message: 'Подписка не была обновлена',
|
|
225
|
+
httpCode: 500,
|
|
226
|
+
},
|
|
227
|
+
ORDER_NOT_FOUND_BY_UUID: {
|
|
228
|
+
code: 'A056',
|
|
229
|
+
message: 'Заказ с таким uuid не найден',
|
|
230
|
+
httpCode: 404,
|
|
231
|
+
},
|
|
232
|
+
ORDER_DELETE_ERROR: { code: 'A057', message: 'Заказ не был удален', httpCode: 500 },
|
|
233
|
+
ORDER_CREATE_ERROR: { code: 'A058', message: 'Заказ не был создан', httpCode: 500 },
|
|
234
|
+
ORDER_FIND_ERROR: { code: 'A059', message: 'Заказ не найден', httpCode: 404 },
|
|
235
|
+
ORDERS_FIND_ERROR: {
|
|
236
|
+
code: 'A060',
|
|
237
|
+
message: 'Заказы не найдены',
|
|
238
|
+
httpCode: 404,
|
|
239
|
+
},
|
|
240
|
+
ORDER_UPDATE_ERROR: {
|
|
241
|
+
code: 'A061',
|
|
242
|
+
message: 'Заказ не был обновлен',
|
|
243
|
+
httpCode: 500,
|
|
244
|
+
},
|
|
245
|
+
PAYMENT_NOT_FOUND_BY_UUID: {
|
|
246
|
+
code: 'A062',
|
|
247
|
+
message: 'Платеж с таким uuid не найден',
|
|
248
|
+
httpCode: 404,
|
|
249
|
+
},
|
|
250
|
+
PAYMENT_DELETE_ERROR: { code: 'A063', message: 'Платеж не был удалён', httpCode: 500 },
|
|
251
|
+
PAYMENT_CREATE_ERROR: { code: 'A064', message: 'Платеж не был создан', httpCode: 500 },
|
|
252
|
+
PAYMENT_FIND_ERROR: { code: 'A065', message: 'Платеж не найден', httpCode: 404 },
|
|
253
|
+
PAYMENTS_FIND_ERROR: {
|
|
254
|
+
code: 'A066',
|
|
255
|
+
message: 'Платежи не найдены',
|
|
256
|
+
httpCode: 404,
|
|
257
|
+
},
|
|
258
|
+
PAYMENT_UPDATE_ERROR: {
|
|
259
|
+
code: 'A067',
|
|
260
|
+
message: 'Платеж не был обновлен',
|
|
261
|
+
httpCode: 500,
|
|
262
|
+
},
|
|
195
263
|
};
|
package/build/constants/index.js
CHANGED
|
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./errors"), exports);
|
|
18
18
|
__exportStar(require("./roles"), exports);
|
|
19
|
+
__exportStar(require("./payment"), exports);
|
|
20
|
+
__exportStar(require("./order"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./order-status.enum"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ORDER_STATUS = void 0;
|
|
4
|
+
var ORDER_STATUS;
|
|
5
|
+
(function (ORDER_STATUS) {
|
|
6
|
+
ORDER_STATUS["new"] = "new";
|
|
7
|
+
ORDER_STATUS["waiting_for_payment"] = "waiting_for_payment";
|
|
8
|
+
ORDER_STATUS["success"] = "success";
|
|
9
|
+
ORDER_STATUS["cancelled"] = "cancelled";
|
|
10
|
+
ORDER_STATUS["sub_processing"] = "sub_processing";
|
|
11
|
+
ORDER_STATUS["sub_error"] = "sub_error";
|
|
12
|
+
ORDER_STATUS["sub_cancelled"] = "sub_cancelled";
|
|
13
|
+
ORDER_STATUS["fraud"] = "fraud";
|
|
14
|
+
ORDER_STATUS["refund"] = "refund";
|
|
15
|
+
ORDER_STATUS["error"] = "error";
|
|
16
|
+
})(ORDER_STATUS || (exports.ORDER_STATUS = ORDER_STATUS = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./payment-status.enum"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PAYMENT_STATUS = void 0;
|
|
4
|
+
var PAYMENT_STATUS;
|
|
5
|
+
(function (PAYMENT_STATUS) {
|
|
6
|
+
PAYMENT_STATUS["new"] = "new";
|
|
7
|
+
PAYMENT_STATUS["success"] = "success";
|
|
8
|
+
PAYMENT_STATUS["cancelled"] = "cancelled";
|
|
9
|
+
})(PAYMENT_STATUS || (exports.PAYMENT_STATUS = PAYMENT_STATUS = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
package/build/models/index.js
CHANGED
|
@@ -22,3 +22,6 @@ __exportStar(require("./unregistered-user.schema"), exports);
|
|
|
22
22
|
__exportStar(require("./chat.schema"), exports);
|
|
23
23
|
__exportStar(require("./message.schema"), exports);
|
|
24
24
|
__exportStar(require("./ai-model.schema"), exports);
|
|
25
|
+
__exportStar(require("./product.schema"), exports);
|
|
26
|
+
__exportStar(require("./subscription.schema"), exports);
|
|
27
|
+
__exportStar(require("./order.schema"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.OrderSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
userId: zod_1.z.string().uuid(),
|
|
8
|
+
status: zod_1.z.boolean(),
|
|
9
|
+
productId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
10
|
+
subscriptionId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.PaymentSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
link: zod_1.z.nullable(zod_1.z.string()),
|
|
8
|
+
status: zod_1.z.boolean(),
|
|
9
|
+
sum: zod_1.z.number(),
|
|
10
|
+
orderId: zod_1.z.string().uuid(),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.ProductSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
name: zod_1.z.string().min(3).max(16384),
|
|
8
|
+
requests: zod_1.z.number(),
|
|
9
|
+
price: zod_1.z.number(),
|
|
10
|
+
features: zod_1.z.array(zod_1.z.string()),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.SubscriptionSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
name: zod_1.z.string().min(3).max(16384),
|
|
8
|
+
requests: zod_1.z.number(),
|
|
9
|
+
price: zod_1.z.number(),
|
|
10
|
+
features: zod_1.z.array(zod_1.z.string()),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace CreateProductCommand {
|
|
5
|
+
export const RequestSchema = ProductSchema.omit({
|
|
6
|
+
uuid: true,
|
|
7
|
+
createdAt: true,
|
|
8
|
+
updatedAt: true,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: ProductSchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteProductCommand {
|
|
5
|
+
export const RequestSchema = ProductSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
isDeleted: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindProductCommand {
|
|
5
|
+
export const RequestSchema = ProductSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(ProductSchema),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseByUUIDSchema = z.object({
|
|
18
|
+
data: ProductSchema,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type ResponseByUUID = z.infer<typeof ResponseByUUIDSchema>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateProductCommand {
|
|
5
|
+
export const RequestSchema = ProductSchema.omit({
|
|
6
|
+
createdAt: true,
|
|
7
|
+
updatedAt: true,
|
|
8
|
+
uuid: true,
|
|
9
|
+
}).partial();
|
|
10
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const RequestParamSchema = z.object({
|
|
14
|
+
uuid: z.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: ProductSchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace CreateSubscriptionCommand {
|
|
5
|
+
export const RequestSchema = SubscriptionSchema.omit({
|
|
6
|
+
uuid: true,
|
|
7
|
+
createdAt: true,
|
|
8
|
+
updatedAt: true,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: SubscriptionSchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteSubscriptionCommand {
|
|
5
|
+
export const RequestSchema = SubscriptionSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
isDeleted: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindSubscriptionCommand {
|
|
5
|
+
export const RequestSchema = SubscriptionSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(SubscriptionSchema),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseByUUIDSchema = z.object({
|
|
18
|
+
data: SubscriptionSchema,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type ResponseByUUID = z.infer<typeof ResponseByUUIDSchema>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateSubscriptionCommand {
|
|
5
|
+
export const RequestSchema = SubscriptionSchema.omit({
|
|
6
|
+
createdAt: true,
|
|
7
|
+
updatedAt: true,
|
|
8
|
+
uuid: true,
|
|
9
|
+
}).partial();
|
|
10
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const RequestParamSchema = z.object({
|
|
14
|
+
uuid: z.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: SubscriptionSchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -191,4 +191,72 @@ export const ERRORS = {
|
|
|
191
191
|
message: 'Страница alias не найдена',
|
|
192
192
|
httpCode: 404,
|
|
193
193
|
},
|
|
194
|
+
PRODUCT_NOT_FOUND_BY_UUID: {
|
|
195
|
+
code: 'A044',
|
|
196
|
+
message: 'Продукт с таким uuid не найден',
|
|
197
|
+
httpCode: 404,
|
|
198
|
+
},
|
|
199
|
+
PRODUCT_DELETE_ERROR: { code: 'A045', message: 'Продукт не был удалён', httpCode: 500 },
|
|
200
|
+
PRODUCT_CREATE_ERROR: { code: 'A046', message: 'Продукт не был создан', httpCode: 500 },
|
|
201
|
+
PRODUCT_FIND_ERROR: { code: 'A047', message: 'Продукт не найден', httpCode: 404 },
|
|
202
|
+
PRODUCTS_FIND_ERROR: {
|
|
203
|
+
code: 'A048',
|
|
204
|
+
message: 'Продукты не найдены',
|
|
205
|
+
httpCode: 404,
|
|
206
|
+
},
|
|
207
|
+
PRODUCT_UPDATE_ERROR: { code: 'A049', message: 'Продукт не был обновлен', httpCode: 500 },
|
|
208
|
+
SUBSCRIPTION_NOT_FOUND_BY_UUID: {
|
|
209
|
+
code: 'A050',
|
|
210
|
+
message: 'Подписка с таким uuid не найден',
|
|
211
|
+
httpCode: 404,
|
|
212
|
+
},
|
|
213
|
+
SUBSCRIPTION_DELETE_ERROR: { code: 'A051', message: 'Подписка не была удалена', httpCode: 500 },
|
|
214
|
+
SUBSCRIPTION_CREATE_ERROR: { code: 'A052', message: 'Подписка не была создана', httpCode: 500 },
|
|
215
|
+
SUBSCRIPTION_FIND_ERROR: { code: 'A053', message: 'Подписка не найдена', httpCode: 404 },
|
|
216
|
+
SUBSCRIPTIONS_FIND_ERROR: {
|
|
217
|
+
code: 'A054',
|
|
218
|
+
message: 'Подписки не найдены',
|
|
219
|
+
httpCode: 404,
|
|
220
|
+
},
|
|
221
|
+
SUBSCRIPTION_UPDATE_ERROR: {
|
|
222
|
+
code: 'A055',
|
|
223
|
+
message: 'Подписка не была обновлена',
|
|
224
|
+
httpCode: 500,
|
|
225
|
+
},
|
|
226
|
+
ORDER_NOT_FOUND_BY_UUID: {
|
|
227
|
+
code: 'A056',
|
|
228
|
+
message: 'Заказ с таким uuid не найден',
|
|
229
|
+
httpCode: 404,
|
|
230
|
+
},
|
|
231
|
+
ORDER_DELETE_ERROR: { code: 'A057', message: 'Заказ не был удален', httpCode: 500 },
|
|
232
|
+
ORDER_CREATE_ERROR: { code: 'A058', message: 'Заказ не был создан', httpCode: 500 },
|
|
233
|
+
ORDER_FIND_ERROR: { code: 'A059', message: 'Заказ не найден', httpCode: 404 },
|
|
234
|
+
ORDERS_FIND_ERROR: {
|
|
235
|
+
code: 'A060',
|
|
236
|
+
message: 'Заказы не найдены',
|
|
237
|
+
httpCode: 404,
|
|
238
|
+
},
|
|
239
|
+
ORDER_UPDATE_ERROR: {
|
|
240
|
+
code: 'A061',
|
|
241
|
+
message: 'Заказ не был обновлен',
|
|
242
|
+
httpCode: 500,
|
|
243
|
+
},
|
|
244
|
+
PAYMENT_NOT_FOUND_BY_UUID: {
|
|
245
|
+
code: 'A062',
|
|
246
|
+
message: 'Платеж с таким uuid не найден',
|
|
247
|
+
httpCode: 404,
|
|
248
|
+
},
|
|
249
|
+
PAYMENT_DELETE_ERROR: { code: 'A063', message: 'Платеж не был удалён', httpCode: 500 },
|
|
250
|
+
PAYMENT_CREATE_ERROR: { code: 'A064', message: 'Платеж не был создан', httpCode: 500 },
|
|
251
|
+
PAYMENT_FIND_ERROR: { code: 'A065', message: 'Платеж не найден', httpCode: 404 },
|
|
252
|
+
PAYMENTS_FIND_ERROR: {
|
|
253
|
+
code: 'A066',
|
|
254
|
+
message: 'Платежи не найдены',
|
|
255
|
+
httpCode: 404,
|
|
256
|
+
},
|
|
257
|
+
PAYMENT_UPDATE_ERROR: {
|
|
258
|
+
code: 'A067',
|
|
259
|
+
message: 'Платеж не был обновлен',
|
|
260
|
+
httpCode: 500,
|
|
261
|
+
},
|
|
194
262
|
};
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './order-status.enum';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export enum ORDER_STATUS {
|
|
2
|
+
new = 'new',
|
|
3
|
+
waiting_for_payment = 'waiting_for_payment',
|
|
4
|
+
success = 'success',
|
|
5
|
+
cancelled = 'cancelled',
|
|
6
|
+
sub_processing = 'sub_processing',
|
|
7
|
+
sub_error = 'sub_error',
|
|
8
|
+
sub_cancelled = 'sub_cancelled',
|
|
9
|
+
fraud = 'fraud',
|
|
10
|
+
refund = 'refund',
|
|
11
|
+
error = 'error',
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './payment-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
package/models/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const OrderSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
userId: z.string().uuid(),
|
|
6
|
+
status: z.boolean(),
|
|
7
|
+
productId: z.nullable(z.string().uuid()),
|
|
8
|
+
subscriptionId: z.nullable(z.string().uuid()),
|
|
9
|
+
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ProductSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
name: z.string().min(3).max(16384),
|
|
6
|
+
requests: z.number(),
|
|
7
|
+
price: z.number(),
|
|
8
|
+
features: z.array(z.string()),
|
|
9
|
+
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const SubscriptionSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
name: z.string().min(3).max(16384),
|
|
6
|
+
requests: z.number(),
|
|
7
|
+
price: z.number(),
|
|
8
|
+
features: z.array(z.string()),
|
|
9
|
+
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|