@purpleschool/gptbot 0.5.21 → 0.5.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.
@@ -0,0 +1,2 @@
1
+ export const FEEDBACK_CONTROLLER_PRIVATE = 'private/feedback' as const;
2
+ export const FEEDBACK_CONTROLLER_PUBLIC = 'public/feedback' as const;
@@ -6,6 +6,7 @@ export * from './chat-private';
6
6
  export * from './chat-public';
7
7
  export * from './cloud-payments';
8
8
  export * from './course';
9
+ export * from './feedback';
9
10
  export * from './files';
10
11
  export * from './referral';
11
12
  export * from './message';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FEEDBACK_CONTROLLER_PUBLIC = exports.FEEDBACK_CONTROLLER_PRIVATE = void 0;
4
+ exports.FEEDBACK_CONTROLLER_PRIVATE = 'private/feedback';
5
+ exports.FEEDBACK_CONTROLLER_PUBLIC = 'public/feedback';
@@ -22,6 +22,7 @@ __exportStar(require("./chat-private"), exports);
22
22
  __exportStar(require("./chat-public"), exports);
23
23
  __exportStar(require("./cloud-payments"), exports);
24
24
  __exportStar(require("./course"), exports);
25
+ __exportStar(require("./feedback"), exports);
25
26
  __exportStar(require("./files"), exports);
26
27
  __exportStar(require("./referral"), exports);
27
28
  __exportStar(require("./message"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateFeedbackCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CreateFeedbackCommand;
7
+ (function (CreateFeedbackCommand) {
8
+ CreateFeedbackCommand.RequestSchema = models_1.FeedbackSchema.omit({
9
+ uuid: true,
10
+ createdAt: true,
11
+ updatedAt: true,
12
+ userId: true,
13
+ unregisteredUserId: true,
14
+ });
15
+ CreateFeedbackCommand.ResponseSchema = zod_1.z.object({
16
+ data: models_1.FeedbackSchema,
17
+ });
18
+ })(CreateFeedbackCommand || (exports.CreateFeedbackCommand = CreateFeedbackCommand = {}));
@@ -0,0 +1,18 @@
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("./create-feedback.command"), exports);
18
+ __exportStar(require("./udpate-feedback.command"), exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateFeedbackCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var UpdateFeedbackCommand;
7
+ (function (UpdateFeedbackCommand) {
8
+ UpdateFeedbackCommand.RequestSchema = models_1.FeedbackSchema.omit({
9
+ createdAt: true,
10
+ updatedAt: true,
11
+ uuid: true,
12
+ userId: true,
13
+ unregisteredUserId: true,
14
+ }).partial();
15
+ UpdateFeedbackCommand.RequestParamSchema = zod_1.z.object({
16
+ uuid: zod_1.z.string().uuid(),
17
+ });
18
+ UpdateFeedbackCommand.ResponseSchema = zod_1.z.object({
19
+ data: models_1.FeedbackSchema,
20
+ });
21
+ })(UpdateFeedbackCommand || (exports.UpdateFeedbackCommand = UpdateFeedbackCommand = {}));
@@ -20,6 +20,7 @@ __exportStar(require("./blog"), exports);
20
20
  __exportStar(require("./category"), exports);
21
21
  __exportStar(require("./chat"), exports);
22
22
  __exportStar(require("./course"), exports);
23
+ __exportStar(require("./feedback"), exports);
23
24
  __exportStar(require("./message"), exports);
24
25
  __exportStar(require("./page"), exports);
25
26
  __exportStar(require("./payment"), exports);
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var CheckCommand;
6
+ (function (CheckCommand) {
7
+ CheckCommand.RequestSchema = zod_1.z
8
+ .object({
9
+ TransactionId: zod_1.z.string().transform((transactionId) => parseInt(transactionId, 10)),
10
+ Amount: zod_1.z.string().transform((amount) => parseInt(amount, 10)),
11
+ Currency: zod_1.z.string(),
12
+ PaymentAmount: zod_1.z.string(),
13
+ PaymentCurrency: zod_1.z.string(),
14
+ DateTime: zod_1.z.string(),
15
+ CardFirstSix: zod_1.z.string(),
16
+ CardLastFour: zod_1.z.string(),
17
+ SubscriptionId: zod_1.z.string().optional(),
18
+ CardType: zod_1.z.string(),
19
+ CardExpDate: zod_1.z.string(),
20
+ TestMode: zod_1.z.string().transform((testMode) => parseInt(testMode, 10)),
21
+ Status: zod_1.z.string(),
22
+ OperationType: zod_1.z.string(),
23
+ InvoiceId: zod_1.z.string().optional(),
24
+ AccountId: zod_1.z.string(),
25
+ // Data: CloudPaymentsDataSchema,
26
+ Data: zod_1.z.string(),
27
+ })
28
+ .transform((data) => ({
29
+ transactionId: data.TransactionId,
30
+ amount: data.Amount,
31
+ currency: data.Currency,
32
+ status: data.Status,
33
+ paymentAmount: data.PaymentAmount,
34
+ paymentCurrency: data.PaymentCurrency,
35
+ dateTime: data.DateTime,
36
+ cardFirstSix: data.CardFirstSix,
37
+ cardLastFour: data.CardLastFour,
38
+ subscriptionId: data.SubscriptionId,
39
+ cardType: data.CardType,
40
+ cardExpDate: data.CardExpDate,
41
+ testMode: data.TestMode,
42
+ operationType: data.OperationType,
43
+ invoiceId: data.InvoiceId,
44
+ accountId: data.AccountId,
45
+ data: data.Data,
46
+ }));
47
+ CheckCommand.ResponseSchema = zod_1.z.object({
48
+ code: zod_1.z.number(),
49
+ });
50
+ })(CheckCommand || (exports.CheckCommand = CheckCommand = {}));
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./get-payment-history.command"), exports);
18
18
  __exportStar(require("./pay.command"), exports);
19
+ __exportStar(require("./check.command"), exports);
@@ -625,4 +625,29 @@ exports.ERRORS = {
625
625
  message: 'Подписка не поддерживает автопродление',
626
626
  httpCode: 400,
627
627
  },
628
+ FEEDBACK_CREATE_ERROR: {
629
+ code: 'A139',
630
+ message: 'Не удалось создать отзыв',
631
+ httpCode: 500,
632
+ },
633
+ FEEDBACK_NOT_FOUND: {
634
+ code: 'A140',
635
+ message: 'Отзыв не найден',
636
+ httpCode: 404,
637
+ },
638
+ FEEDBACK_UPDATE_ERROR: {
639
+ code: 'A141',
640
+ message: 'Не удалось обновить отзыв',
641
+ httpCode: 500,
642
+ },
643
+ FEEDBACK_DELETE_ERROR: {
644
+ code: 'A142',
645
+ message: 'Не удалось удалить отзыв',
646
+ httpCode: 500,
647
+ },
648
+ FEEDBACK_OWNERSHIP_ERROR: {
649
+ code: 'A143',
650
+ message: 'Пользователь не является владельцем отзыва',
651
+ httpCode: 400,
652
+ },
628
653
  };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudPaymentsDataSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.CloudPaymentsDataSchema = zod_1.z.object({
6
+ CloudPayments: zod_1.z.object({
7
+ CustomerReceipt: zod_1.z.object({
8
+ items: zod_1.z.array(zod_1.z.object({
9
+ label: zod_1.z.string(),
10
+ price: zod_1.z.number(),
11
+ quantity: zod_1.z.number(),
12
+ amount: zod_1.z.number(),
13
+ vat: zod_1.z.number(),
14
+ })),
15
+ email: zod_1.z.string(),
16
+ isBso: zod_1.z.boolean(),
17
+ amounts: zod_1.z.object({
18
+ electronic: zod_1.z.number(),
19
+ }),
20
+ }),
21
+ recurrent: zod_1.z
22
+ .object({
23
+ period: zod_1.z.number(),
24
+ interval: zod_1.z.string(),
25
+ customerReceipt: zod_1.z.object({
26
+ items: zod_1.z.array(zod_1.z.object({
27
+ label: zod_1.z.string(),
28
+ price: zod_1.z.number(),
29
+ quantity: zod_1.z.number(),
30
+ amount: zod_1.z.number(),
31
+ vat: zod_1.z.number(),
32
+ })),
33
+ email: zod_1.z.string(),
34
+ isBso: zod_1.z.boolean(),
35
+ amounts: zod_1.z.object({
36
+ electronic: zod_1.z.number(),
37
+ }),
38
+ }),
39
+ amount: zod_1.z.number(),
40
+ })
41
+ .optional(),
42
+ }),
43
+ });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FeedbackSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.FeedbackSchema = zod_1.z.object({
6
+ uuid: zod_1.z.string().uuid(),
7
+ userId: zod_1.z.string().uuid().nullable().optional(),
8
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
9
+ rating: zod_1.z.number().min(1).max(5),
10
+ comment: zod_1.z.string().nullable().optional(),
11
+ createdAt: zod_1.z.date(),
12
+ updatedAt: zod_1.z.date(),
13
+ });
@@ -18,8 +18,10 @@ __exportStar(require("./ai-model-formatted.schema"), exports);
18
18
  __exportStar(require("./ai-model.schema"), exports);
19
19
  __exportStar(require("./category.schema"), exports);
20
20
  __exportStar(require("./chat.schema"), exports);
21
+ __exportStar(require("./cloud-payments-data.schema"), exports);
21
22
  __exportStar(require("./course-author.schema"), exports);
22
23
  __exportStar(require("./course.schema"), exports);
24
+ __exportStar(require("./feedback.schema"), exports);
23
25
  __exportStar(require("./lesson.schema"), exports);
24
26
  __exportStar(require("./message.schema"), exports);
25
27
  __exportStar(require("./order.schema"), exports);
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { FeedbackSchema } from '../../models';
3
+
4
+ export namespace CreateFeedbackCommand {
5
+ export const RequestSchema = FeedbackSchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ userId: true,
10
+ unregisteredUserId: true,
11
+ });
12
+
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: FeedbackSchema,
17
+ });
18
+
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,2 @@
1
+ export * from './create-feedback.command';
2
+ export * from './udpate-feedback.command';
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { FeedbackSchema } from '../../models';
3
+
4
+ export namespace UpdateFeedbackCommand {
5
+ export const RequestSchema = FeedbackSchema.omit({
6
+ createdAt: true,
7
+ updatedAt: true,
8
+ uuid: true,
9
+ userId: true,
10
+ unregisteredUserId: true,
11
+ }).partial();
12
+
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const RequestParamSchema = z.object({
16
+ uuid: z.string().uuid(),
17
+ });
18
+
19
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
20
+
21
+ export const ResponseSchema = z.object({
22
+ data: FeedbackSchema,
23
+ });
24
+
25
+ export type Response = z.infer<typeof ResponseSchema>;
26
+ }
package/commands/index.ts CHANGED
@@ -4,6 +4,7 @@ export * from './blog';
4
4
  export * from './category';
5
5
  export * from './chat';
6
6
  export * from './course';
7
+ export * from './feedback';
7
8
  export * from './message';
8
9
  export * from './page';
9
10
  export * from './payment';
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CheckCommand {
4
+ export const RequestSchema = z
5
+ .object({
6
+ TransactionId: z.string().transform((transactionId) => parseInt(transactionId, 10)),
7
+ Amount: z.string().transform((amount) => parseInt(amount, 10)),
8
+ Currency: z.string(),
9
+ PaymentAmount: z.string(),
10
+ PaymentCurrency: z.string(),
11
+ DateTime: z.string(),
12
+ CardFirstSix: z.string(),
13
+ CardLastFour: z.string(),
14
+ SubscriptionId: z.string().optional(),
15
+ CardType: z.string(),
16
+ CardExpDate: z.string(),
17
+ TestMode: z.string().transform((testMode) => parseInt(testMode, 10)),
18
+ Status: z.string(),
19
+ OperationType: z.string(),
20
+ InvoiceId: z.string().optional(),
21
+ AccountId: z.string(),
22
+ // Data: CloudPaymentsDataSchema,
23
+ Data: z.string(),
24
+ })
25
+ .transform((data) => ({
26
+ transactionId: data.TransactionId,
27
+ amount: data.Amount,
28
+ currency: data.Currency,
29
+ status: data.Status,
30
+ paymentAmount: data.PaymentAmount,
31
+ paymentCurrency: data.PaymentCurrency,
32
+ dateTime: data.DateTime,
33
+ cardFirstSix: data.CardFirstSix,
34
+ cardLastFour: data.CardLastFour,
35
+ subscriptionId: data.SubscriptionId,
36
+ cardType: data.CardType,
37
+ cardExpDate: data.CardExpDate,
38
+ testMode: data.TestMode,
39
+ operationType: data.OperationType,
40
+ invoiceId: data.InvoiceId,
41
+ accountId: data.AccountId,
42
+ data: data.Data,
43
+ }));
44
+
45
+ export type Request = z.infer<typeof RequestSchema>;
46
+
47
+ export const ResponseSchema = z.object({
48
+ code: z.number(),
49
+ });
50
+
51
+ export type Response = z.infer<typeof ResponseSchema>;
52
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './get-payment-history.command';
2
2
  export * from './pay.command';
3
+ export * from './check.command';
@@ -625,4 +625,29 @@ export const ERRORS = {
625
625
  message: 'Подписка не поддерживает автопродление',
626
626
  httpCode: 400,
627
627
  },
628
+ FEEDBACK_CREATE_ERROR: {
629
+ code: 'A139',
630
+ message: 'Не удалось создать отзыв',
631
+ httpCode: 500,
632
+ },
633
+ FEEDBACK_NOT_FOUND: {
634
+ code: 'A140',
635
+ message: 'Отзыв не найден',
636
+ httpCode: 404,
637
+ },
638
+ FEEDBACK_UPDATE_ERROR: {
639
+ code: 'A141',
640
+ message: 'Не удалось обновить отзыв',
641
+ httpCode: 500,
642
+ },
643
+ FEEDBACK_DELETE_ERROR: {
644
+ code: 'A142',
645
+ message: 'Не удалось удалить отзыв',
646
+ httpCode: 500,
647
+ },
648
+ FEEDBACK_OWNERSHIP_ERROR: {
649
+ code: 'A143',
650
+ message: 'Пользователь не является владельцем отзыва',
651
+ httpCode: 400,
652
+ },
628
653
  };
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+
3
+ export const CloudPaymentsDataSchema = z.object({
4
+ CloudPayments: z.object({
5
+ CustomerReceipt: z.object({
6
+ items: z.array(
7
+ z.object({
8
+ label: z.string(),
9
+ price: z.number(),
10
+ quantity: z.number(),
11
+ amount: z.number(),
12
+ vat: z.number(),
13
+ }),
14
+ ),
15
+ email: z.string(),
16
+ isBso: z.boolean(),
17
+ amounts: z.object({
18
+ electronic: z.number(),
19
+ }),
20
+ }),
21
+ recurrent: z
22
+ .object({
23
+ period: z.number(),
24
+ interval: z.string(),
25
+ customerReceipt: z.object({
26
+ items: z.array(
27
+ z.object({
28
+ label: z.string(),
29
+ price: z.number(),
30
+ quantity: z.number(),
31
+ amount: z.number(),
32
+ vat: z.number(),
33
+ }),
34
+ ),
35
+ email: z.string(),
36
+ isBso: z.boolean(),
37
+ amounts: z.object({
38
+ electronic: z.number(),
39
+ }),
40
+ }),
41
+ amount: z.number(),
42
+ })
43
+ .optional(),
44
+ }),
45
+ });
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+
3
+ export const FeedbackSchema = z.object({
4
+ uuid: z.string().uuid(),
5
+ userId: z.string().uuid().nullable().optional(),
6
+ unregisteredUserId: z.string().uuid().nullable().optional(),
7
+ rating: z.number().min(1).max(5),
8
+ comment: z.string().nullable().optional(),
9
+ createdAt: z.date(),
10
+ updatedAt: z.date(),
11
+ });
package/models/index.ts CHANGED
@@ -2,8 +2,10 @@ export * from './ai-model-formatted.schema';
2
2
  export * from './ai-model.schema';
3
3
  export * from './category.schema';
4
4
  export * from './chat.schema';
5
+ export * from './cloud-payments-data.schema';
5
6
  export * from './course-author.schema';
6
7
  export * from './course.schema';
8
+ export * from './feedback.schema';
7
9
  export * from './lesson.schema';
8
10
  export * from './message.schema';
9
11
  export * from './order.schema';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {