@purpleschool/gptbot 0.5.96 → 0.5.97

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.
@@ -35,3 +35,4 @@ export * from './user-to-task-public';
35
35
  export * from './user';
36
36
  export * from './promocode';
37
37
  export * from './ui-notification';
38
+ export * from './review';
@@ -0,0 +1,7 @@
1
+ export const REVIEW_PUBLIC_CONTROLLER = 'public/review' as const;
2
+ export const REVIEW_PRIVATE_CONTROLLER = 'private/review' as const;
3
+
4
+ export const REVIEW_ROUTES = {
5
+ CREATE: '',
6
+ FIND: 'find',
7
+ } as const;
package/api/routes.ts CHANGED
@@ -184,4 +184,11 @@ export const REST_API = {
184
184
  `${ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.STATUS(uuid)}`,
185
185
  REDEEM: `${ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.REDEEM}`,
186
186
  },
187
+ REVIEW_PUBLIC: {
188
+ CREATE: `${ROOT}/${CONTROLLERS.REVIEW_PUBLIC_CONTROLLER}/${CONTROLLERS.REVIEW_ROUTES.CREATE}`,
189
+ FIND: `${ROOT}/${CONTROLLERS.REVIEW_PUBLIC_CONTROLLER}/${CONTROLLERS.REVIEW_ROUTES.FIND}`,
190
+ },
191
+ REVIEW_PRIVATE: {
192
+ CREATE: `${ROOT}/${CONTROLLERS.REVIEW_PRIVATE_CONTROLLER}/${CONTROLLERS.REVIEW_ROUTES.CREATE}`,
193
+ },
187
194
  } as const;
@@ -51,3 +51,4 @@ __exportStar(require("./user-to-task-public"), exports);
51
51
  __exportStar(require("./user"), exports);
52
52
  __exportStar(require("./promocode"), exports);
53
53
  __exportStar(require("./ui-notification"), exports);
54
+ __exportStar(require("./review"), exports);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REVIEW_ROUTES = exports.REVIEW_PRIVATE_CONTROLLER = exports.REVIEW_PUBLIC_CONTROLLER = void 0;
4
+ exports.REVIEW_PUBLIC_CONTROLLER = 'public/review';
5
+ exports.REVIEW_PRIVATE_CONTROLLER = 'private/review';
6
+ exports.REVIEW_ROUTES = {
7
+ CREATE: '',
8
+ FIND: 'find',
9
+ };
@@ -185,4 +185,11 @@ exports.REST_API = {
185
185
  STATUS: (uuid) => `${exports.ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.STATUS(uuid)}`,
186
186
  REDEEM: `${exports.ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.REDEEM}`,
187
187
  },
188
+ REVIEW_PUBLIC: {
189
+ CREATE: `${exports.ROOT}/${CONTROLLERS.REVIEW_PUBLIC_CONTROLLER}/${CONTROLLERS.REVIEW_ROUTES.CREATE}`,
190
+ FIND: `${exports.ROOT}/${CONTROLLERS.REVIEW_PUBLIC_CONTROLLER}/${CONTROLLERS.REVIEW_ROUTES.FIND}`,
191
+ },
192
+ REVIEW_PRIVATE: {
193
+ CREATE: `${exports.ROOT}/${CONTROLLERS.REVIEW_PRIVATE_CONTROLLER}/${CONTROLLERS.REVIEW_ROUTES.CREATE}`,
194
+ },
188
195
  };
@@ -45,3 +45,4 @@ __exportStar(require("./user-to-subscription"), exports);
45
45
  __exportStar(require("./user-to-task"), exports);
46
46
  __exportStar(require("./promocode"), exports);
47
47
  __exportStar(require("./ui-notification"), exports);
48
+ __exportStar(require("./review"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateReviewCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CreateReviewCommand;
7
+ (function (CreateReviewCommand) {
8
+ CreateReviewCommand.RequestSchema = models_1.ReviewSchema.pick({
9
+ email: true,
10
+ name: true,
11
+ text: true,
12
+ rating: true,
13
+ });
14
+ CreateReviewCommand.ResponseSchema = zod_1.z.object({
15
+ data: models_1.ReviewSchema,
16
+ });
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.FindReviewsCommand = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const models_1 = require("../../models");
9
+ var FindReviewsCommand;
10
+ (function (FindReviewsCommand) {
11
+ FindReviewsCommand.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
+ FindReviewsCommand.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
+ })(FindReviewsCommand || (exports.FindReviewsCommand = FindReviewsCommand = {}));
@@ -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-review.command"), exports);
18
+ __exportStar(require("./find-reviews.command"), exports);
@@ -1318,4 +1318,24 @@ exports.ERRORS = {
1318
1318
  message: 'Произошла ошибка при повторном запросе STT',
1319
1319
  httpCode: 500,
1320
1320
  },
1321
+ REVIEW_CREATE_ERROR: {
1322
+ code: 'A287',
1323
+ message: 'Произошла ошибка при создании отзыва',
1324
+ httpCode: 500,
1325
+ },
1326
+ REVIEW_UPDATE_ERROR: {
1327
+ code: 'A288',
1328
+ message: 'Произошла ошибка при обновлении отзыва',
1329
+ httpCode: 500,
1330
+ },
1331
+ REVIEW_DELETE_ERROR: {
1332
+ code: 'A289',
1333
+ message: 'Произошла ошибка при удалении отзыва',
1334
+ httpCode: 500,
1335
+ },
1336
+ REVIEWS_FIND_ERROR: {
1337
+ code: 'A290',
1338
+ message: 'Отзывы не найдены',
1339
+ httpCode: 404,
1340
+ },
1321
1341
  };
@@ -44,3 +44,4 @@ __exportStar(require("./unregistered-user"), exports);
44
44
  __exportStar(require("./user"), exports);
45
45
  __exportStar(require("./promocode"), exports);
46
46
  __exportStar(require("./ui-notification"), exports);
47
+ __exportStar(require("./review"), 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("./review-status.enum"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REVIEW_STATUS = void 0;
4
+ var REVIEW_STATUS;
5
+ (function (REVIEW_STATUS) {
6
+ REVIEW_STATUS["NEW"] = "new";
7
+ REVIEW_STATUS["ON_MODERATION"] = "on_moderation";
8
+ REVIEW_STATUS["ACTIVE"] = "active";
9
+ REVIEW_STATUS["HIDDEN"] = "hidden";
10
+ })(REVIEW_STATUS || (exports.REVIEW_STATUS = REVIEW_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);
@@ -56,3 +56,4 @@ __exportStar(require("./user-to-subscription.schema"), exports);
56
56
  __exportStar(require("./user.schema"), exports);
57
57
  __exportStar(require("./utm.schema"), exports);
58
58
  __exportStar(require("./ui-notification.schema"), exports);
59
+ __exportStar(require("./review.schema"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReviewSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ReviewSchema = zod_1.z.object({
6
+ uuid: zod_1.z.string().uuid(),
7
+ email: zod_1.z.string().email(),
8
+ name: zod_1.z.string(),
9
+ text: zod_1.z.string(),
10
+ rating: zod_1.z.number().int().step(1).min(0).max(5),
11
+ createdAt: zod_1.z.date(),
12
+ updatedAt: zod_1.z.date(),
13
+ });
package/commands/index.ts CHANGED
@@ -29,3 +29,4 @@ export * from './user-to-subscription';
29
29
  export * from './user-to-task';
30
30
  export * from './promocode';
31
31
  export * from './ui-notification';
32
+ export * from './review';
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ReviewSchema } from '../../models';
3
+
4
+ export namespace CreateReviewCommand {
5
+ export const RequestSchema = ReviewSchema.pick({
6
+ email: true,
7
+ name: true,
8
+ text: true,
9
+ rating: true,
10
+ });
11
+
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: ReviewSchema,
16
+ });
17
+
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,19 @@
1
+ import z from 'zod';
2
+ import { ReviewSchema } from '../../models';
3
+
4
+ export namespace FindReviewsCommand {
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
+ }
@@ -0,0 +1,2 @@
1
+ export * from './create-review.command';
2
+ export * from './find-reviews.command';
@@ -1324,4 +1324,24 @@ export const ERRORS = {
1324
1324
  message: 'Произошла ошибка при повторном запросе STT',
1325
1325
  httpCode: 500,
1326
1326
  },
1327
+ REVIEW_CREATE_ERROR: {
1328
+ code: 'A287',
1329
+ message: 'Произошла ошибка при создании отзыва',
1330
+ httpCode: 500,
1331
+ },
1332
+ REVIEW_UPDATE_ERROR: {
1333
+ code: 'A288',
1334
+ message: 'Произошла ошибка при обновлении отзыва',
1335
+ httpCode: 500,
1336
+ },
1337
+ REVIEW_DELETE_ERROR: {
1338
+ code: 'A289',
1339
+ message: 'Произошла ошибка при удалении отзыва',
1340
+ httpCode: 500,
1341
+ },
1342
+ REVIEWS_FIND_ERROR: {
1343
+ code: 'A290',
1344
+ message: 'Отзывы не найдены',
1345
+ httpCode: 404,
1346
+ },
1327
1347
  };
@@ -28,3 +28,4 @@ export * from './unregistered-user';
28
28
  export * from './user';
29
29
  export * from './promocode';
30
30
  export * from './ui-notification';
31
+ export * from './review';
@@ -0,0 +1 @@
1
+ export * from './review-status.enum';
@@ -0,0 +1,6 @@
1
+ export enum REVIEW_STATUS {
2
+ NEW = 'new',
3
+ ON_MODERATION = 'on_moderation',
4
+ ACTIVE = 'active',
5
+ HIDDEN = 'hidden',
6
+ }
@@ -0,0 +1 @@
1
+ export * from './enums';
package/models/index.ts CHANGED
@@ -40,3 +40,4 @@ export * from './user-to-subscription.schema';
40
40
  export * from './user.schema';
41
41
  export * from './utm.schema';
42
42
  export * from './ui-notification.schema';
43
+ export * from './review.schema';
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+
3
+ export const ReviewSchema = z.object({
4
+ uuid: z.string().uuid(),
5
+ email: z.string().email(),
6
+ name: z.string(),
7
+ text: z.string(),
8
+ rating: z.number().int().step(1).min(0).max(5),
9
+
10
+ createdAt: z.date(),
11
+ updatedAt: z.date(),
12
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.96",
3
+ "version": "0.5.97",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",