@purpleschool/gptbot 0.5.93 → 0.5.95

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 (45) hide show
  1. package/api/controllers/http/form-submission.ts +6 -0
  2. package/api/controllers/http/index.ts +2 -0
  3. package/api/controllers/http/key-value.ts +10 -0
  4. package/build/api/controllers/http/form-submission.js +8 -0
  5. package/build/api/controllers/http/index.js +2 -0
  6. package/build/api/controllers/http/key-value.js +12 -0
  7. package/build/commands/form-submission/create-form-submission.command.js +18 -0
  8. package/build/commands/form-submission/index.js +17 -0
  9. package/build/commands/index.js +2 -0
  10. package/build/commands/key-value/create-key-value.command.js +20 -0
  11. package/build/commands/key-value/delete-key-value-by-key.command.js +13 -0
  12. package/build/commands/key-value/find-all-key-values.command.js +11 -0
  13. package/build/commands/key-value/find-all-namespace-key-values.command.js +14 -0
  14. package/build/commands/key-value/find-key-value-by-key.command.js +15 -0
  15. package/build/commands/key-value/index.js +22 -0
  16. package/build/commands/key-value/update-key-value-by-key.command.js +20 -0
  17. package/build/constants/category/enums/category-mark.enum.js +1 -0
  18. package/build/constants/errors/errors.js +52 -2
  19. package/build/constants/form-submission/enums/form-type.enum.js +7 -0
  20. package/build/constants/form-submission/enums/index.js +17 -0
  21. package/build/constants/form-submission/index.js +17 -0
  22. package/build/constants/index.js +2 -0
  23. package/build/models/form-submission.schema.js +14 -0
  24. package/build/models/index.js +2 -0
  25. package/build/models/key-value.schema.js +14 -0
  26. package/commands/form-submission/create-form-submission.command.ts +18 -0
  27. package/commands/form-submission/index.ts +1 -0
  28. package/commands/index.ts +2 -0
  29. package/commands/key-value/create-key-value.command.ts +22 -0
  30. package/commands/key-value/delete-key-value-by-key.command.ts +13 -0
  31. package/commands/key-value/find-all-key-values.command.ts +9 -0
  32. package/commands/key-value/find-all-namespace-key-values.command.ts +14 -0
  33. package/commands/key-value/find-key-value-by-key.command.ts +15 -0
  34. package/commands/key-value/index.ts +6 -0
  35. package/commands/key-value/update-key-value-by-key.command.ts +22 -0
  36. package/constants/category/enums/category-mark.enum.ts +1 -0
  37. package/constants/errors/errors.ts +52 -2
  38. package/constants/form-submission/enums/form-type.enum.ts +3 -0
  39. package/constants/form-submission/enums/index.ts +1 -0
  40. package/constants/form-submission/index.ts +1 -0
  41. package/constants/index.ts +2 -0
  42. package/models/form-submission.schema.ts +12 -0
  43. package/models/index.ts +2 -0
  44. package/models/key-value.schema.ts +14 -0
  45. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ export const FORM_SUBMISSION_PRIVATE_CONTROLLER = 'private/form-submission';
2
+ export const FORM_SUBMISSION_PUBLIC_CONTROLLER = 'public/form-submission';
3
+
4
+ export const FORM_SUBMISSION_ROUTES = {
5
+ CREATE: '',
6
+ } as const;
@@ -10,6 +10,8 @@ export * from './cloud-payments';
10
10
  export * from './course';
11
11
  export * from './feedback';
12
12
  export * from './files';
13
+ export * from './form-submission';
14
+ export * from './key-value';
13
15
  export * from './referral';
14
16
  export * from './message';
15
17
  export * from './midjourney';
@@ -0,0 +1,10 @@
1
+ export const KEY_VALUE_NAMESPACE_CONTROLLER = 'namespaces' as const;
2
+
3
+ export const KEY_VALUE_NAMESPACE_ROUTES = {
4
+ FIND_ALL: '',
5
+ FIND_ALL_IN_NAMESPACE: (namespace: string) => `${namespace}/keys`,
6
+ FIND_BY_KEY: (namespace: string, key: string) => `${namespace}/keys/${key}`,
7
+ UPDATE: (namespace: string, key: string) => `${namespace}/keys/${key}`,
8
+ CREATE: (namespace: string) => `${namespace}/keys`,
9
+ DELETE_BY_KEY: (namespace: string, key: string) => `${namespace}/keys/${key}`,
10
+ } as const;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FORM_SUBMISSION_ROUTES = exports.FORM_SUBMISSION_PUBLIC_CONTROLLER = exports.FORM_SUBMISSION_PRIVATE_CONTROLLER = void 0;
4
+ exports.FORM_SUBMISSION_PRIVATE_CONTROLLER = 'private/form-submission';
5
+ exports.FORM_SUBMISSION_PUBLIC_CONTROLLER = 'public/form-submission';
6
+ exports.FORM_SUBMISSION_ROUTES = {
7
+ CREATE: '',
8
+ };
@@ -26,6 +26,8 @@ __exportStar(require("./cloud-payments"), exports);
26
26
  __exportStar(require("./course"), exports);
27
27
  __exportStar(require("./feedback"), exports);
28
28
  __exportStar(require("./files"), exports);
29
+ __exportStar(require("./form-submission"), exports);
30
+ __exportStar(require("./key-value"), exports);
29
31
  __exportStar(require("./referral"), exports);
30
32
  __exportStar(require("./message"), exports);
31
33
  __exportStar(require("./midjourney"), exports);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KEY_VALUE_NAMESPACE_ROUTES = exports.KEY_VALUE_NAMESPACE_CONTROLLER = void 0;
4
+ exports.KEY_VALUE_NAMESPACE_CONTROLLER = 'namespaces';
5
+ exports.KEY_VALUE_NAMESPACE_ROUTES = {
6
+ FIND_ALL: '',
7
+ FIND_ALL_IN_NAMESPACE: (namespace) => `${namespace}/keys`,
8
+ FIND_BY_KEY: (namespace, key) => `${namespace}/keys/${key}`,
9
+ UPDATE: (namespace, key) => `${namespace}/keys/${key}`,
10
+ CREATE: (namespace) => `${namespace}/keys`,
11
+ DELETE_BY_KEY: (namespace, key) => `${namespace}/keys/${key}`,
12
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateFormSubmissionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CreateFormSubmissionCommand;
7
+ (function (CreateFormSubmissionCommand) {
8
+ CreateFormSubmissionCommand.RequestSchema = models_1.FormSubmissionSchema.omit({
9
+ uuid: true,
10
+ userId: true,
11
+ unregisteredUserId: true,
12
+ createdAt: true,
13
+ updatedAt: true,
14
+ });
15
+ CreateFormSubmissionCommand.ResponseSchema = zod_1.z.object({
16
+ data: models_1.FormSubmissionSchema,
17
+ });
18
+ })(CreateFormSubmissionCommand || (exports.CreateFormSubmissionCommand = CreateFormSubmissionCommand = {}));
@@ -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("./create-form-submission.command"), exports);
@@ -24,6 +24,8 @@ __exportStar(require("./chat"), exports);
24
24
  __exportStar(require("./course"), exports);
25
25
  __exportStar(require("./feedback"), exports);
26
26
  __exportStar(require("./file"), exports);
27
+ __exportStar(require("./form-submission"), exports);
28
+ __exportStar(require("./key-value"), exports);
27
29
  __exportStar(require("./message"), exports);
28
30
  __exportStar(require("./midjourney"), exports);
29
31
  __exportStar(require("./page"), exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateKeyValueCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CreateKeyValueCommand;
7
+ (function (CreateKeyValueCommand) {
8
+ CreateKeyValueCommand.RequestParamsSchema = zod_1.z.object({
9
+ namespace: zod_1.z.string(),
10
+ });
11
+ CreateKeyValueCommand.RequestSchema = models_1.KeyValueSchema.omit({
12
+ uuid: true,
13
+ namespace: true,
14
+ createdAt: true,
15
+ updatedAt: true,
16
+ });
17
+ CreateKeyValueCommand.ResponseSchema = zod_1.z.object({
18
+ data: models_1.KeyValueSchema,
19
+ });
20
+ })(CreateKeyValueCommand || (exports.CreateKeyValueCommand = CreateKeyValueCommand = {}));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteKeyValueByKeyCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var DeleteKeyValueByKeyCommand;
7
+ (function (DeleteKeyValueByKeyCommand) {
8
+ DeleteKeyValueByKeyCommand.RequestParamsSchema = models_1.KeyValueSchema.pick({
9
+ namespace: true,
10
+ key: true,
11
+ });
12
+ DeleteKeyValueByKeyCommand.ResponseSchema = zod_1.z.void();
13
+ })(DeleteKeyValueByKeyCommand || (exports.DeleteKeyValueByKeyCommand = DeleteKeyValueByKeyCommand = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindAllKeyValuesCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var FindAllKeyValuesCommand;
7
+ (function (FindAllKeyValuesCommand) {
8
+ FindAllKeyValuesCommand.ResponseSchema = zod_1.z.object({
9
+ data: zod_1.z.array(models_1.KeyValueSchema),
10
+ });
11
+ })(FindAllKeyValuesCommand || (exports.FindAllKeyValuesCommand = FindAllKeyValuesCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindAllNamespaceKeyValuesCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var FindAllNamespaceKeyValuesCommand;
7
+ (function (FindAllNamespaceKeyValuesCommand) {
8
+ FindAllNamespaceKeyValuesCommand.RequestParamsSchema = zod_1.z.object({
9
+ namespace: zod_1.z.string(),
10
+ });
11
+ FindAllNamespaceKeyValuesCommand.ResponseSchema = zod_1.z.object({
12
+ data: zod_1.z.array(models_1.KeyValueSchema),
13
+ });
14
+ })(FindAllNamespaceKeyValuesCommand || (exports.FindAllNamespaceKeyValuesCommand = FindAllNamespaceKeyValuesCommand = {}));
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindKeyValueByKeyCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var FindKeyValueByKeyCommand;
7
+ (function (FindKeyValueByKeyCommand) {
8
+ FindKeyValueByKeyCommand.RequestParamsSchema = zod_1.z.object({
9
+ namespace: zod_1.z.string(),
10
+ key: zod_1.z.string(),
11
+ });
12
+ FindKeyValueByKeyCommand.ResponseSchema = zod_1.z.object({
13
+ data: models_1.KeyValueSchema,
14
+ });
15
+ })(FindKeyValueByKeyCommand || (exports.FindKeyValueByKeyCommand = FindKeyValueByKeyCommand = {}));
@@ -0,0 +1,22 @@
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-key-value.command"), exports);
18
+ __exportStar(require("./delete-key-value-by-key.command"), exports);
19
+ __exportStar(require("./find-all-key-values.command"), exports);
20
+ __exportStar(require("./find-all-namespace-key-values.command"), exports);
21
+ __exportStar(require("./find-key-value-by-key.command"), exports);
22
+ __exportStar(require("./update-key-value-by-key.command"), exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateKeyValueByKeyCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var UpdateKeyValueByKeyCommand;
7
+ (function (UpdateKeyValueByKeyCommand) {
8
+ UpdateKeyValueByKeyCommand.RequestParamsSchema = zod_1.z.object({
9
+ namespace: zod_1.z.string(),
10
+ key: zod_1.z.string(),
11
+ });
12
+ UpdateKeyValueByKeyCommand.RequestSchema = models_1.KeyValueSchema.omit({
13
+ uuid: true,
14
+ createdAt: true,
15
+ updatedAt: true,
16
+ }).partial();
17
+ UpdateKeyValueByKeyCommand.ResponseSchema = zod_1.z.object({
18
+ data: models_1.KeyValueSchema,
19
+ });
20
+ })(UpdateKeyValueByKeyCommand || (exports.UpdateKeyValueByKeyCommand = UpdateKeyValueByKeyCommand = {}));
@@ -4,4 +4,5 @@ exports.CATEGORY_MARK = void 0;
4
4
  var CATEGORY_MARK;
5
5
  (function (CATEGORY_MARK) {
6
6
  CATEGORY_MARK["HIDDEN"] = "hidden";
7
+ CATEGORY_MARK["REVEAL_ON_CLICK"] = "reveal_on_click";
7
8
  })(CATEGORY_MARK || (exports.CATEGORY_MARK = CATEGORY_MARK = {}));
@@ -1249,13 +1249,63 @@ exports.ERRORS = {
1249
1249
  httpCode: 500,
1250
1250
  },
1251
1251
  CHAT_IMAGE_ATTACHMENT_FEATURE_MISSING: {
1252
- code: 'A253',
1252
+ code: 'A275',
1253
1253
  message: 'Функция вложения изображений не указана в запросе',
1254
1254
  httpCode: 400,
1255
1255
  },
1256
1256
  CHAT_IMAGE_ATTACHMENT_AND_WEB_SEARCH_CONFLICT: {
1257
- code: 'A254',
1257
+ code: 'A276',
1258
1258
  message: 'Вложения изображений и веб-поиск нельзя использовать вместе',
1259
1259
  httpCode: 400,
1260
1260
  },
1261
+ KEY_VALUE_SAVE_ERROR: {
1262
+ code: 'A277',
1263
+ message: 'Произошла ошибка при сохранении key value',
1264
+ httpCode: 500,
1265
+ },
1266
+ KEY_VALUE_DELETE_ERROR: {
1267
+ code: 'A278',
1268
+ message: 'Произошла ошибка при удалении key value',
1269
+ httpCode: 500,
1270
+ },
1271
+ KEY_VALUE_NOT_FOUND: {
1272
+ code: 'A279',
1273
+ message: 'Key value не найден',
1274
+ httpCode: 404,
1275
+ },
1276
+ KEY_VALUE_NOT_FOUND_INTERNAL: {
1277
+ code: 'A280',
1278
+ message: 'Произошла ошибка при поиске key value',
1279
+ httpCode: 500,
1280
+ },
1281
+ KEY_VALUE_UPDATE_ERROR: {
1282
+ code: 'A281',
1283
+ message: 'Произошла ошибка при обновлении key value',
1284
+ httpCode: 500,
1285
+ },
1286
+ KEY_VALUE_CREATE_ERROR: {
1287
+ code: 'A282',
1288
+ message: 'Произошла ошибка при создании key value',
1289
+ httpCode: 500,
1290
+ },
1291
+ KEY_VALUE_ALREADY_EXISTS: {
1292
+ code: 'A283',
1293
+ message: 'Key value уже существует',
1294
+ httpCode: 409,
1295
+ },
1296
+ FORM_SUBMISSION_CREATE_ERROR: {
1297
+ code: 'A284',
1298
+ message: 'Произошла ошибка при сохранении отправленной формы',
1299
+ httpCode: 500,
1300
+ },
1301
+ FORM_SUBMISSION_NOT_FOUND: {
1302
+ code: 'A285',
1303
+ message: 'Форма не найдена',
1304
+ httpCode: 404,
1305
+ },
1306
+ FORM_SUBMISSION_FIND_ERROR: {
1307
+ code: 'A286',
1308
+ message: 'Произошла ошибка при поиске формы',
1309
+ httpCode: 500,
1310
+ },
1261
1311
  };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FORM_TYPE = void 0;
4
+ var FORM_TYPE;
5
+ (function (FORM_TYPE) {
6
+ FORM_TYPE["PARTNERSHIP"] = "partnership";
7
+ })(FORM_TYPE || (exports.FORM_TYPE = FORM_TYPE = {}));
@@ -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("./form-type.enum"), 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("./enums"), exports);
@@ -24,6 +24,8 @@ __exportStar(require("./domains"), exports);
24
24
  __exportStar(require("./email"), exports);
25
25
  __exportStar(require("./errors"), exports);
26
26
  __exportStar(require("./file"), exports);
27
+ __exportStar(require("./form-submission"), exports);
28
+ __exportStar(require("./form-submission"), exports);
27
29
  __exportStar(require("./message"), exports);
28
30
  __exportStar(require("./midjourney"), exports);
29
31
  __exportStar(require("./order"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormSubmissionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const form_submission_1 = require("../constants/form-submission");
6
+ exports.FormSubmissionSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string(),
8
+ userId: zod_1.z.string().nullable(),
9
+ unregisteredUserId: zod_1.z.string().nullable(),
10
+ form: zod_1.z.nativeEnum(form_submission_1.FORM_TYPE),
11
+ content: zod_1.z.object({}).passthrough(),
12
+ createdAt: zod_1.z.date(),
13
+ updatedAt: zod_1.z.date(),
14
+ });
@@ -27,6 +27,8 @@ __exportStar(require("./course.schema"), exports);
27
27
  __exportStar(require("./date.schema"), exports);
28
28
  __exportStar(require("./feedback.schema"), exports);
29
29
  __exportStar(require("./file.schema"), exports);
30
+ __exportStar(require("./key-value.schema"), exports);
31
+ __exportStar(require("./form-submission.schema"), exports);
30
32
  __exportStar(require("./icon-variants.schema"), exports);
31
33
  __exportStar(require("./lesson.schema"), exports);
32
34
  __exportStar(require("./message.schema"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyValueSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const date_schema_1 = require("./date.schema");
6
+ exports.KeyValueSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string().uuid(),
8
+ key: zod_1.z.string(),
9
+ value: zod_1.z.string(),
10
+ namespace: zod_1.z.string(),
11
+ description: zod_1.z.string().optional().nullable(),
12
+ createdAt: date_schema_1.DateSchema,
13
+ updatedAt: date_schema_1.DateSchema,
14
+ });
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { FormSubmissionSchema } from '../../models';
3
+
4
+ export namespace CreateFormSubmissionCommand {
5
+ export const RequestSchema = FormSubmissionSchema.omit({
6
+ uuid: true,
7
+ userId: true,
8
+ unregisteredUserId: true,
9
+ createdAt: true,
10
+ updatedAt: true,
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: FormSubmissionSchema,
16
+ });
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1 @@
1
+ export * from './create-form-submission.command';
package/commands/index.ts CHANGED
@@ -8,6 +8,8 @@ export * from './chat';
8
8
  export * from './course';
9
9
  export * from './feedback';
10
10
  export * from './file';
11
+ export * from './form-submission';
12
+ export * from './key-value';
11
13
  export * from './message';
12
14
  export * from './midjourney';
13
15
  export * from './page';
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { KeyValueSchema } from '../../models';
3
+
4
+ export namespace CreateKeyValueCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ namespace: z.string(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const RequestSchema = KeyValueSchema.omit({
11
+ uuid: true,
12
+ namespace: true,
13
+ createdAt: true,
14
+ updatedAt: true,
15
+ });
16
+ export type Request = z.infer<typeof RequestSchema>;
17
+
18
+ export const ResponseSchema = z.object({
19
+ data: KeyValueSchema,
20
+ });
21
+ export type Response = z.infer<typeof ResponseSchema>;
22
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { KeyValueSchema } from '../../models';
3
+
4
+ export namespace DeleteKeyValueByKeyCommand {
5
+ export const RequestParamsSchema = KeyValueSchema.pick({
6
+ namespace: true,
7
+ key: true,
8
+ });
9
+ export type Request = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.void();
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,9 @@
1
+ import { KeyValueSchema } from '../../models';
2
+ import { z } from 'zod';
3
+
4
+ export namespace FindAllKeyValuesCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: z.array(KeyValueSchema),
7
+ });
8
+ export type Response = z.infer<typeof ResponseSchema>;
9
+ }
@@ -0,0 +1,14 @@
1
+ import { KeyValueSchema } from '../../models';
2
+ import { z } from 'zod';
3
+
4
+ export namespace FindAllNamespaceKeyValuesCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ namespace: z.string(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.array(KeyValueSchema),
12
+ });
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,15 @@
1
+ import { KeyValueSchema } from '../../models';
2
+ import { z } from 'zod';
3
+
4
+ export namespace FindKeyValueByKeyCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ namespace: z.string(),
7
+ key: z.string(),
8
+ });
9
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: KeyValueSchema,
13
+ });
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -0,0 +1,6 @@
1
+ export * from './create-key-value.command';
2
+ export * from './delete-key-value-by-key.command';
3
+ export * from './find-all-key-values.command';
4
+ export * from './find-all-namespace-key-values.command';
5
+ export * from './find-key-value-by-key.command';
6
+ export * from './update-key-value-by-key.command';
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { KeyValueSchema } from '../../models';
3
+
4
+ export namespace UpdateKeyValueByKeyCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ namespace: z.string(),
7
+ key: z.string(),
8
+ });
9
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const RequestSchema = KeyValueSchema.omit({
12
+ uuid: true,
13
+ createdAt: true,
14
+ updatedAt: true,
15
+ }).partial();
16
+ export type Request = z.infer<typeof RequestSchema>;
17
+
18
+ export const ResponseSchema = z.object({
19
+ data: KeyValueSchema,
20
+ });
21
+ export type Response = z.infer<typeof ResponseSchema>;
22
+ }
@@ -1,3 +1,4 @@
1
1
  export enum CATEGORY_MARK {
2
2
  HIDDEN = 'hidden',
3
+ REVEAL_ON_CLICK = 'reveal_on_click',
3
4
  }
@@ -1255,13 +1255,63 @@ export const ERRORS = {
1255
1255
  httpCode: 500,
1256
1256
  },
1257
1257
  CHAT_IMAGE_ATTACHMENT_FEATURE_MISSING: {
1258
- code: 'A253',
1258
+ code: 'A275',
1259
1259
  message: 'Функция вложения изображений не указана в запросе',
1260
1260
  httpCode: 400,
1261
1261
  },
1262
1262
  CHAT_IMAGE_ATTACHMENT_AND_WEB_SEARCH_CONFLICT: {
1263
- code: 'A254',
1263
+ code: 'A276',
1264
1264
  message: 'Вложения изображений и веб-поиск нельзя использовать вместе',
1265
1265
  httpCode: 400,
1266
1266
  },
1267
+ KEY_VALUE_SAVE_ERROR: {
1268
+ code: 'A277',
1269
+ message: 'Произошла ошибка при сохранении key value',
1270
+ httpCode: 500,
1271
+ },
1272
+ KEY_VALUE_DELETE_ERROR: {
1273
+ code: 'A278',
1274
+ message: 'Произошла ошибка при удалении key value',
1275
+ httpCode: 500,
1276
+ },
1277
+ KEY_VALUE_NOT_FOUND: {
1278
+ code: 'A279',
1279
+ message: 'Key value не найден',
1280
+ httpCode: 404,
1281
+ },
1282
+ KEY_VALUE_NOT_FOUND_INTERNAL: {
1283
+ code: 'A280',
1284
+ message: 'Произошла ошибка при поиске key value',
1285
+ httpCode: 500,
1286
+ },
1287
+ KEY_VALUE_UPDATE_ERROR: {
1288
+ code: 'A281',
1289
+ message: 'Произошла ошибка при обновлении key value',
1290
+ httpCode: 500,
1291
+ },
1292
+ KEY_VALUE_CREATE_ERROR: {
1293
+ code: 'A282',
1294
+ message: 'Произошла ошибка при создании key value',
1295
+ httpCode: 500,
1296
+ },
1297
+ KEY_VALUE_ALREADY_EXISTS: {
1298
+ code: 'A283',
1299
+ message: 'Key value уже существует',
1300
+ httpCode: 409,
1301
+ },
1302
+ FORM_SUBMISSION_CREATE_ERROR: {
1303
+ code: 'A284',
1304
+ message: 'Произошла ошибка при сохранении отправленной формы',
1305
+ httpCode: 500,
1306
+ },
1307
+ FORM_SUBMISSION_NOT_FOUND: {
1308
+ code: 'A285',
1309
+ message: 'Форма не найдена',
1310
+ httpCode: 404,
1311
+ },
1312
+ FORM_SUBMISSION_FIND_ERROR: {
1313
+ code: 'A286',
1314
+ message: 'Произошла ошибка при поиске формы',
1315
+ httpCode: 500,
1316
+ },
1267
1317
  };
@@ -0,0 +1,3 @@
1
+ export enum FORM_TYPE {
2
+ PARTNERSHIP = 'partnership',
3
+ }
@@ -0,0 +1 @@
1
+ export * from './form-type.enum';
@@ -0,0 +1 @@
1
+ export * from './enums';
@@ -8,6 +8,8 @@ export * from './domains';
8
8
  export * from './email';
9
9
  export * from './errors';
10
10
  export * from './file';
11
+ export * from './form-submission';
12
+ export * from './form-submission';
11
13
  export * from './message';
12
14
  export * from './midjourney';
13
15
  export * from './order';
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { FORM_TYPE } from '../constants/form-submission';
3
+
4
+ export const FormSubmissionSchema = z.object({
5
+ uuid: z.string(),
6
+ userId: z.string().nullable(),
7
+ unregisteredUserId: z.string().nullable(),
8
+ form: z.nativeEnum(FORM_TYPE),
9
+ content: z.object({}).passthrough(),
10
+ createdAt: z.date(),
11
+ updatedAt: z.date(),
12
+ });
package/models/index.ts CHANGED
@@ -11,6 +11,8 @@ export * from './course.schema';
11
11
  export * from './date.schema';
12
12
  export * from './feedback.schema';
13
13
  export * from './file.schema';
14
+ export * from './key-value.schema';
15
+ export * from './form-submission.schema';
14
16
  export * from './icon-variants.schema';
15
17
  export * from './lesson.schema';
16
18
  export * from './message.schema';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { DateSchema } from './date.schema';
3
+
4
+ export const KeyValueSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ key: z.string(),
7
+ value: z.string(),
8
+ namespace: z.string(),
9
+ description: z.string().optional().nullable(),
10
+ createdAt: DateSchema,
11
+ updatedAt: DateSchema,
12
+ });
13
+
14
+ export type KeyValue = z.infer<typeof KeyValueSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.93",
3
+ "version": "0.5.95",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",