@purpleschool/gptbot 0.8.41 → 0.8.42
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/http/user-to-subscription.ts +1 -0
- package/api/routes.ts +2 -0
- package/build/api/controllers/http/user-to-subscription.js +1 -0
- package/build/api/routes.js +1 -0
- package/build/commands/review/create-review.command.js +1 -1
- package/build/commands/review/find-all-reviews.command.js +20 -0
- package/build/commands/review/find-reviews.command.js +1 -1
- package/build/commands/review/index.js +1 -0
- package/build/commands/user/get-user-products.command.js +1 -1
- package/build/commands/user/get-user-subscriptions.command.js +1 -1
- package/build/commands/user-to-subscription/delete-user-to-subscription.command.js +16 -0
- package/build/commands/user-to-subscription/index.js +1 -0
- package/build/constants/subscription/enums/subscription-status.enum.js +1 -0
- package/build/models/order.schema.js +1 -0
- package/build/models/review.schema.js +2 -0
- package/commands/review/create-review.command.ts +1 -1
- package/commands/review/find-all-reviews.command.ts +19 -0
- package/commands/review/find-reviews.command.ts +1 -1
- package/commands/review/index.ts +1 -0
- package/commands/user/get-user-products.command.ts +2 -2
- package/commands/user/get-user-subscriptions.command.ts +2 -2
- package/commands/user-to-subscription/delete-user-to-subscription.command.ts +18 -0
- package/commands/user-to-subscription/index.ts +1 -0
- package/constants/subscription/enums/subscription-status.enum.ts +1 -0
- package/models/order.schema.ts +1 -0
- package/models/review.schema.ts +2 -0
- package/package.json +1 -1
package/api/routes.ts
CHANGED
|
@@ -319,6 +319,8 @@ export const REST_API = {
|
|
|
319
319
|
`${ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.FIND_BY_UUID(uuid)}`,
|
|
320
320
|
UPDATE: (uuid: string) =>
|
|
321
321
|
`${ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.UPDATE(uuid)}`,
|
|
322
|
+
DELETE: (uuid: string) =>
|
|
323
|
+
`${ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.DELETE(uuid)}`,
|
|
322
324
|
},
|
|
323
325
|
FEEDBACK_PRIVATE: {
|
|
324
326
|
CREATE: `${ROOT}/${CONTROLLERS.FEEDBACK_CONTROLLER_PRIVATE}`,
|
package/build/api/routes.js
CHANGED
|
@@ -283,6 +283,7 @@ exports.REST_API = {
|
|
|
283
283
|
USER_TO_SUBSCRIPTION: {
|
|
284
284
|
FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.FIND_BY_UUID(uuid)}`,
|
|
285
285
|
UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.UPDATE(uuid)}`,
|
|
286
|
+
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.DELETE(uuid)}`,
|
|
286
287
|
},
|
|
287
288
|
FEEDBACK_PRIVATE: {
|
|
288
289
|
CREATE: `${exports.ROOT}/${CONTROLLERS.FEEDBACK_CONTROLLER_PRIVATE}`,
|
|
@@ -12,6 +12,6 @@ var CreateReviewCommand;
|
|
|
12
12
|
rating: true,
|
|
13
13
|
});
|
|
14
14
|
CreateReviewCommand.ResponseSchema = zod_1.z.object({
|
|
15
|
-
data: models_1.ReviewSchema,
|
|
15
|
+
data: models_1.ReviewSchema.omit({ status: true }),
|
|
16
16
|
});
|
|
17
17
|
})(CreateReviewCommand || (exports.CreateReviewCommand = CreateReviewCommand = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FindAllReviewsCommand = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const models_1 = require("../../models");
|
|
9
|
+
var FindAllReviewsCommand;
|
|
10
|
+
(function (FindAllReviewsCommand) {
|
|
11
|
+
FindAllReviewsCommand.RequestSchema = zod_1.default.object({
|
|
12
|
+
limit: zod_1.default.string().transform((val) => parseInt(val, 10)),
|
|
13
|
+
offset: zod_1.default.string().transform((val) => parseInt(val, 10)),
|
|
14
|
+
});
|
|
15
|
+
FindAllReviewsCommand.ResponseSchema = zod_1.default.object({
|
|
16
|
+
data: zod_1.default.array(models_1.ReviewSchema),
|
|
17
|
+
totalPages: zod_1.default.number(),
|
|
18
|
+
page: zod_1.default.number(),
|
|
19
|
+
});
|
|
20
|
+
})(FindAllReviewsCommand || (exports.FindAllReviewsCommand = FindAllReviewsCommand = {}));
|
|
@@ -13,7 +13,7 @@ var FindReviewsCommand;
|
|
|
13
13
|
offset: zod_1.default.string().transform((val) => parseInt(val, 10)),
|
|
14
14
|
});
|
|
15
15
|
FindReviewsCommand.ResponseSchema = zod_1.default.object({
|
|
16
|
-
data: zod_1.default.array(models_1.ReviewSchema),
|
|
16
|
+
data: zod_1.default.array(models_1.ReviewSchema.omit({ status: true })),
|
|
17
17
|
totalPages: zod_1.default.number(),
|
|
18
18
|
page: zod_1.default.number(),
|
|
19
19
|
});
|
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./create-review.command"), exports);
|
|
18
18
|
__exportStar(require("./find-reviews.command"), exports);
|
|
19
19
|
__exportStar(require("./get-review-count.command"), exports);
|
|
20
|
+
__exportStar(require("./find-all-reviews.command"), exports);
|
|
@@ -20,6 +20,6 @@ var GetUserProductsCommand;
|
|
|
20
20
|
})
|
|
21
21
|
.partial();
|
|
22
22
|
GetUserProductsCommand.ResponseSchema = zod_1.default.object({
|
|
23
|
-
data: zod_1.default.array(models_1.
|
|
23
|
+
data: zod_1.default.array(models_1.UserToProductWithProductSchema),
|
|
24
24
|
});
|
|
25
25
|
})(GetUserProductsCommand || (exports.GetUserProductsCommand = GetUserProductsCommand = {}));
|
|
@@ -20,6 +20,6 @@ var GetUserSubscriptionsCommand;
|
|
|
20
20
|
})
|
|
21
21
|
.partial();
|
|
22
22
|
GetUserSubscriptionsCommand.ResponseSchema = zod_1.default.object({
|
|
23
|
-
data: zod_1.default.array(models_1.
|
|
23
|
+
data: zod_1.default.array(models_1.UserToSubscriptionWithSubscriptionSchema),
|
|
24
24
|
});
|
|
25
25
|
})(GetUserSubscriptionsCommand || (exports.GetUserSubscriptionsCommand = GetUserSubscriptionsCommand = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteUserToSubscriptionCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var DeleteUserToSubscriptionCommand;
|
|
7
|
+
(function (DeleteUserToSubscriptionCommand) {
|
|
8
|
+
DeleteUserToSubscriptionCommand.RequestSchema = models_1.UserToSubscriptionSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
DeleteUserToSubscriptionCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: zod_1.z.object({
|
|
13
|
+
isDeleted: zod_1.z.boolean(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
})(DeleteUserToSubscriptionCommand || (exports.DeleteUserToSubscriptionCommand = DeleteUserToSubscriptionCommand = {}));
|
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./get-user-to-subscriptions.command"), exports);
|
|
18
18
|
__exportStar(require("./update-user-to-subscription.command"), exports);
|
|
19
19
|
__exportStar(require("./get-user-to-subscription-by-uuid.command"), exports);
|
|
20
|
+
__exportStar(require("./delete-user-to-subscription.command"), exports);
|
|
@@ -13,4 +13,5 @@ var SUBSCRIPTION_STATUS;
|
|
|
13
13
|
SUBSCRIPTION_STATUS["awaiting_activation"] = "awaiting_activation";
|
|
14
14
|
SUBSCRIPTION_STATUS["awaiting_downgrade"] = "awaiting_downgrade";
|
|
15
15
|
SUBSCRIPTION_STATUS["downgrade_canceled"] = "downgrade_canceled";
|
|
16
|
+
SUBSCRIPTION_STATUS["deleted"] = "deleted";
|
|
16
17
|
})(SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = SUBSCRIPTION_STATUS = {}));
|
|
@@ -10,6 +10,7 @@ exports.OrderSchema = zod_1.z.object({
|
|
|
10
10
|
productId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
11
11
|
subscriptionId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
12
12
|
sum: zod_1.z.number(),
|
|
13
|
+
description: zod_1.z.string(),
|
|
13
14
|
createdAt: zod_1.z.date(),
|
|
14
15
|
updatedAt: zod_1.z.date(),
|
|
15
16
|
});
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReviewSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
5
6
|
exports.ReviewSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string().uuid(),
|
|
7
8
|
email: zod_1.z.string().email(),
|
|
8
9
|
name: zod_1.z.string(),
|
|
9
10
|
text: zod_1.z.string(),
|
|
10
11
|
rating: zod_1.z.number().int().step(1).min(0).max(5),
|
|
12
|
+
status: zod_1.z.nativeEnum(constants_1.REVIEW_STATUS),
|
|
11
13
|
createdAt: zod_1.z.date(),
|
|
12
14
|
updatedAt: zod_1.z.date(),
|
|
13
15
|
});
|
|
@@ -12,7 +12,7 @@ export namespace CreateReviewCommand {
|
|
|
12
12
|
export type Request = z.infer<typeof RequestSchema>;
|
|
13
13
|
|
|
14
14
|
export const ResponseSchema = z.object({
|
|
15
|
-
data: ReviewSchema,
|
|
15
|
+
data: ReviewSchema.omit({ status: true }),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { ReviewSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindAllReviewsCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
limit: z.string().transform((val) => parseInt(val, 10)),
|
|
7
|
+
offset: z.string().transform((val) => parseInt(val, 10)),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.array(ReviewSchema),
|
|
14
|
+
totalPages: z.number(),
|
|
15
|
+
page: z.number(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -10,7 +10,7 @@ export namespace FindReviewsCommand {
|
|
|
10
10
|
export type Request = z.infer<typeof RequestSchema>;
|
|
11
11
|
|
|
12
12
|
export const ResponseSchema = z.object({
|
|
13
|
-
data: z.array(ReviewSchema),
|
|
13
|
+
data: z.array(ReviewSchema.omit({ status: true })),
|
|
14
14
|
totalPages: z.number(),
|
|
15
15
|
page: z.number(),
|
|
16
16
|
});
|
package/commands/review/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { PRODUCT_SORT_BY, PRODUCT_STATUS, SORT_ORDER } from '../../constants';
|
|
3
|
-
import {
|
|
3
|
+
import { UserToProductWithProductSchema } from '../../models';
|
|
4
4
|
|
|
5
5
|
export namespace GetUserProductsCommand {
|
|
6
6
|
export const RequestParamSchema = z.object({
|
|
@@ -19,7 +19,7 @@ export namespace GetUserProductsCommand {
|
|
|
19
19
|
.partial();
|
|
20
20
|
|
|
21
21
|
export const ResponseSchema = z.object({
|
|
22
|
-
data: z.array(
|
|
22
|
+
data: z.array(UserToProductWithProductSchema),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { SORT_ORDER, SUBSCRIPTION_SORT_BY, SUBSCRIPTION_STATUS } from '../../constants';
|
|
3
|
-
import {
|
|
3
|
+
import { UserToSubscriptionWithSubscriptionSchema } from '../../models';
|
|
4
4
|
|
|
5
5
|
export namespace GetUserSubscriptionsCommand {
|
|
6
6
|
export const RequestParamSchema = z.object({
|
|
@@ -19,7 +19,7 @@ export namespace GetUserSubscriptionsCommand {
|
|
|
19
19
|
.partial();
|
|
20
20
|
|
|
21
21
|
export const ResponseSchema = z.object({
|
|
22
|
-
data: z.array(
|
|
22
|
+
data: z.array(UserToSubscriptionWithSubscriptionSchema),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserToSubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteUserToSubscriptionCommand {
|
|
5
|
+
export const RequestSchema = UserToSubscriptionSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
isDeleted: z.boolean(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
package/models/order.schema.ts
CHANGED
package/models/review.schema.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { REVIEW_STATUS } from '../constants';
|
|
2
3
|
|
|
3
4
|
export const ReviewSchema = z.object({
|
|
4
5
|
uuid: z.string().uuid(),
|
|
@@ -6,6 +7,7 @@ export const ReviewSchema = z.object({
|
|
|
6
7
|
name: z.string(),
|
|
7
8
|
text: z.string(),
|
|
8
9
|
rating: z.number().int().step(1).min(0).max(5),
|
|
10
|
+
status: z.nativeEnum(REVIEW_STATUS),
|
|
9
11
|
|
|
10
12
|
createdAt: z.date(),
|
|
11
13
|
updatedAt: z.date(),
|