@purpleschool/gptbot 0.6.18 → 0.6.20

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.
@@ -40,3 +40,5 @@ export * from './prompt-category';
40
40
  export * from './prompt-topic';
41
41
  export * from './prompt';
42
42
  export * from './folder';
43
+ export * from './user-to-product';
44
+ export * from './user-to-subscription';
@@ -0,0 +1,6 @@
1
+ export const USER_TO_PRODUCT_CONTROLLER = 'user-to-product' as const;
2
+
3
+ export const USER_TO_PRODUCT_ROUTES = {
4
+ FIND_BY_UUID: (uuid: string) => `${uuid}`,
5
+ UPDATE: (uuid: string) => `${uuid}`,
6
+ } as const;
@@ -0,0 +1,6 @@
1
+ export const USER_TO_SUBSCRIPTION_CONTROLLER = 'user-to-subscription' as const;
2
+
3
+ export const USER_TO_SUBSCRIPTION_ROUTES = {
4
+ FIND_BY_UUID: (uuid: string) => `${uuid}`,
5
+ UPDATE: (uuid: string) => `${uuid}`,
6
+ } as const;
package/api/routes.ts CHANGED
@@ -260,4 +260,16 @@ export const REST_API = {
260
260
  DELETE: (uuid: string) =>
261
261
  `${ROOT}/${CONTROLLERS.FOLDER_PRIVATE_CONTROLLER}/${CONTROLLERS.FOLDER_ROUTES.DELETE(uuid)}`,
262
262
  },
263
+ USER_TO_PRODUCT: {
264
+ FIND_BY_UUID: (uuid: string) =>
265
+ `${ROOT}/${CONTROLLERS.USER_TO_PRODUCT_CONTROLLER}/${CONTROLLERS.USER_TO_PRODUCT_ROUTES.FIND_BY_UUID(uuid)}`,
266
+ UPDATE: (uuid: string) =>
267
+ `${ROOT}/${CONTROLLERS.USER_TO_PRODUCT_CONTROLLER}/${CONTROLLERS.USER_TO_PRODUCT_ROUTES.UPDATE(uuid)}`,
268
+ },
269
+ USER_TO_SUBSCRIPTION: {
270
+ FIND_BY_UUID: (uuid: string) =>
271
+ `${ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.FIND_BY_UUID(uuid)}`,
272
+ UPDATE: (uuid: string) =>
273
+ `${ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.UPDATE(uuid)}`,
274
+ },
263
275
  } as const;
@@ -56,3 +56,5 @@ __exportStar(require("./prompt-category"), exports);
56
56
  __exportStar(require("./prompt-topic"), exports);
57
57
  __exportStar(require("./prompt"), exports);
58
58
  __exportStar(require("./folder"), exports);
59
+ __exportStar(require("./user-to-product"), exports);
60
+ __exportStar(require("./user-to-subscription"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_TO_PRODUCT_ROUTES = exports.USER_TO_PRODUCT_CONTROLLER = void 0;
4
+ exports.USER_TO_PRODUCT_CONTROLLER = 'user-to-product';
5
+ exports.USER_TO_PRODUCT_ROUTES = {
6
+ FIND_BY_UUID: (uuid) => `${uuid}`,
7
+ UPDATE: (uuid) => `${uuid}`,
8
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_TO_SUBSCRIPTION_ROUTES = exports.USER_TO_SUBSCRIPTION_CONTROLLER = void 0;
4
+ exports.USER_TO_SUBSCRIPTION_CONTROLLER = 'user-to-subscription';
5
+ exports.USER_TO_SUBSCRIPTION_ROUTES = {
6
+ FIND_BY_UUID: (uuid) => `${uuid}`,
7
+ UPDATE: (uuid) => `${uuid}`,
8
+ };
@@ -238,4 +238,12 @@ exports.REST_API = {
238
238
  UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.FOLDER_PRIVATE_CONTROLLER}/${CONTROLLERS.FOLDER_ROUTES.UPDATE(uuid)}`,
239
239
  DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.FOLDER_PRIVATE_CONTROLLER}/${CONTROLLERS.FOLDER_ROUTES.DELETE(uuid)}`,
240
240
  },
241
+ USER_TO_PRODUCT: {
242
+ FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_PRODUCT_CONTROLLER}/${CONTROLLERS.USER_TO_PRODUCT_ROUTES.FIND_BY_UUID(uuid)}`,
243
+ UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_PRODUCT_CONTROLLER}/${CONTROLLERS.USER_TO_PRODUCT_ROUTES.UPDATE(uuid)}`,
244
+ },
245
+ USER_TO_SUBSCRIPTION: {
246
+ FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.FIND_BY_UUID(uuid)}`,
247
+ UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.USER_TO_SUBSCRIPTION_ROUTES.UPDATE(uuid)}`,
248
+ },
241
249
  };
@@ -0,0 +1,17 @@
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.GetUserToProductByUuidCommand = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const models_1 = require("../../models");
9
+ var GetUserToProductByUuidCommand;
10
+ (function (GetUserToProductByUuidCommand) {
11
+ GetUserToProductByUuidCommand.RequestSchema = models_1.UserToProductSchema.pick({
12
+ uuid: true,
13
+ });
14
+ GetUserToProductByUuidCommand.ResponseSchema = zod_1.default.object({
15
+ data: models_1.UserToProductSchema,
16
+ });
17
+ })(GetUserToProductByUuidCommand || (exports.GetUserToProductByUuidCommand = GetUserToProductByUuidCommand = {}));
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./update-user-to-product.command"), exports);
18
+ __exportStar(require("./get-user-to-product-by-uuid.command"), exports);
@@ -14,6 +14,6 @@ var UpdateUserToProductCommand;
14
14
  status: true,
15
15
  }).partial();
16
16
  UpdateUserToProductCommand.ResponseSchema = zod_1.z.object({
17
- data: UpdateUserToProductCommand.RequestParamSchema,
17
+ data: models_1.UserToProductSchema,
18
18
  });
19
19
  })(UpdateUserToProductCommand || (exports.UpdateUserToProductCommand = UpdateUserToProductCommand = {}));
@@ -0,0 +1,17 @@
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.GetUserToSubscriptionByUuidCommand = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const models_1 = require("../../models");
9
+ var GetUserToSubscriptionByUuidCommand;
10
+ (function (GetUserToSubscriptionByUuidCommand) {
11
+ GetUserToSubscriptionByUuidCommand.RequestSchema = models_1.UserToSubscriptionSchema.pick({
12
+ uuid: true,
13
+ });
14
+ GetUserToSubscriptionByUuidCommand.ResponseSchema = zod_1.default.object({
15
+ data: models_1.UserToSubscriptionSchema,
16
+ });
17
+ })(GetUserToSubscriptionByUuidCommand || (exports.GetUserToSubscriptionByUuidCommand = GetUserToSubscriptionByUuidCommand = {}));
@@ -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-user-to-subscriptions.command"), exports);
18
18
  __exportStar(require("./update-user-to-subscription.command"), exports);
19
+ __exportStar(require("./get-user-to-subscription-by-uuid.command"), exports);
@@ -1498,4 +1498,9 @@ exports.ERRORS = {
1498
1498
  message: 'Подписка не требует повторной оплаты',
1499
1499
  httpCode: 400,
1500
1500
  },
1501
+ USER_TO_PRODUCT_NOT_FOUND: {
1502
+ code: 'A321',
1503
+ message: 'Не удалось найти продукт у пользователя',
1504
+ httpCode: 404,
1505
+ },
1501
1506
  };
@@ -0,0 +1,16 @@
1
+ import z from 'zod';
2
+ import { UserToProductSchema } from '../../models';
3
+
4
+ export namespace GetUserToProductByUuidCommand {
5
+ export const RequestSchema = UserToProductSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: UserToProductSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -1 +1,2 @@
1
1
  export * from './update-user-to-product.command';
2
+ export * from './get-user-to-product-by-uuid.command';
@@ -14,8 +14,10 @@ export namespace UpdateUserToProductCommand {
14
14
  status: true,
15
15
  }).partial();
16
16
 
17
+ export type Request = z.infer<typeof RequestSchema>;
18
+
17
19
  export const ResponseSchema = z.object({
18
- data: RequestParamSchema,
20
+ data: UserToProductSchema,
19
21
  });
20
22
 
21
23
  export type Response = z.infer<typeof ResponseSchema>;
@@ -0,0 +1,16 @@
1
+ import z from 'zod';
2
+ import { UserToSubscriptionSchema } from '../../models';
3
+
4
+ export namespace GetUserToSubscriptionByUuidCommand {
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: UserToSubscriptionSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './get-user-to-subscriptions.command';
2
2
  export * from './update-user-to-subscription.command';
3
+ export * from './get-user-to-subscription-by-uuid.command';
@@ -22,6 +22,8 @@ export namespace UpdateUserToSubscriptionCommand {
22
22
  })
23
23
  .partial();
24
24
 
25
+ export type Request = z.infer<typeof RequestSchema>;
26
+
25
27
  export const ResponseSchema = z.object({
26
28
  data: UserToSubscriptionSchema,
27
29
  });
@@ -1505,4 +1505,9 @@ export const ERRORS = {
1505
1505
  message: 'Подписка не требует повторной оплаты',
1506
1506
  httpCode: 400,
1507
1507
  },
1508
+ USER_TO_PRODUCT_NOT_FOUND: {
1509
+ code: 'A321',
1510
+ message: 'Не удалось найти продукт у пользователя',
1511
+ httpCode: 404,
1512
+ },
1508
1513
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.6.18",
3
+ "version": "0.6.20",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",