@purpleschool/gptbot 0.7.27 → 0.7.28

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.
@@ -12,4 +12,5 @@ export const USER_ROUTES = {
12
12
  GET_PRODUCTS: (uuid: string) => `products/${uuid}`,
13
13
  GET_COUNT_NOTIFICATION: 'broadcast/count',
14
14
  SEND_NOTIFICATION: 'broadcast',
15
+ DELETE_ACCOUNT: 'delete-account',
15
16
  } as const;
package/api/routes.ts CHANGED
@@ -29,6 +29,7 @@ export const REST_API = {
29
29
  `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
30
30
  GET_COUNT: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
31
31
  SEND_NOTIFICATION: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
32
+ DELETE_ACCOUNT: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
32
33
  },
33
34
  PAGE: {
34
35
  GET: `${ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
@@ -14,4 +14,5 @@ exports.USER_ROUTES = {
14
14
  GET_PRODUCTS: (uuid) => `products/${uuid}`,
15
15
  GET_COUNT_NOTIFICATION: 'broadcast/count',
16
16
  SEND_NOTIFICATION: 'broadcast',
17
+ DELETE_ACCOUNT: 'delete-account',
17
18
  };
@@ -58,6 +58,7 @@ exports.REST_API = {
58
58
  GET_PRODUCTS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
59
59
  GET_COUNT: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
60
60
  SEND_NOTIFICATION: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
61
+ DELETE_ACCOUNT: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
61
62
  },
62
63
  PAGE: {
63
64
  GET: `${exports.ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteAccountCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var DeleteAccountCommand;
6
+ (function (DeleteAccountCommand) {
7
+ DeleteAccountCommand.ResponseSchema = zod_1.z.object({
8
+ data: zod_1.z.object({
9
+ isDeleted: zod_1.z.boolean(),
10
+ }),
11
+ });
12
+ })(DeleteAccountCommand || (exports.DeleteAccountCommand = DeleteAccountCommand = {}));
@@ -41,6 +41,7 @@ var FindUsersByCriteriaCommand;
41
41
  telegramId: zod_1.default.coerce.number().optional(),
42
42
  createdAt: models_1.DateFilter.optional(),
43
43
  updatedAt: models_1.DateFilter.optional(),
44
+ deletedAt: models_1.DateFilter.optional(),
44
45
  tokenBonusBalance: models_1.NumberFilter.optional(),
45
46
  sortBy: zod_1.default.nativeEnum(constants_1.USER_SORT_BY).optional(),
46
47
  sortOrder: zod_1.default.nativeEnum(constants_1.SORT_ORDER).default(constants_1.SORT_ORDER.DESC).optional(),
@@ -23,3 +23,4 @@ __exportStar(require("./get-user-balance.command"), exports);
23
23
  __exportStar(require("./get-user-orders.command"), exports);
24
24
  __exportStar(require("./get-user-subscriptions.command"), exports);
25
25
  __exportStar(require("./get-user-products.command"), exports);
26
+ __exportStar(require("./delete-account.command"), exports);
@@ -1697,4 +1697,19 @@ exports.ERRORS = {
1697
1697
  message: 'Ошибка при обновлении ежедневного стрика',
1698
1698
  httpCode: 500,
1699
1699
  },
1700
+ ACCOUNT_DELETE_ERROR: {
1701
+ code: 'A360',
1702
+ message: 'Аккаунт не был удалён',
1703
+ httpCode: 500,
1704
+ },
1705
+ ACCOUNT_DELETED: {
1706
+ code: 'A361',
1707
+ message: 'Операция невозможна, аккаунт был удалён',
1708
+ httpCode: 400,
1709
+ },
1710
+ TELEGRAM_PROFILE_DELETE_ERROR: {
1711
+ code: 'A362',
1712
+ message: 'Произошла ошибка при удалении Telegram профиля',
1713
+ httpCode: 500,
1714
+ },
1700
1715
  };
@@ -7,4 +7,5 @@ var USER_STATUS;
7
7
  USER_STATUS["INACTIVE"] = "inactive";
8
8
  USER_STATUS["TG_AUTO_REGISTERED"] = "tg_auto_registered";
9
9
  USER_STATUS["MERGED"] = "merged";
10
+ USER_STATUS["DELETED"] = "deleted";
10
11
  })(USER_STATUS || (exports.USER_STATUS = USER_STATUS = {}));
@@ -17,6 +17,7 @@ exports.UserSchema = zod_1.z.object({
17
17
  role: zod_1.z.string(),
18
18
  createdAt: zod_1.z.date(),
19
19
  updatedAt: zod_1.z.date(),
20
+ deletedAt: zod_1.z.date().nullable(),
20
21
  });
21
22
  exports.UserAggregateSchema = zod_1.z.object({
22
23
  user: exports.UserSchema,
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteAccountCommand {
4
+ export type Request = void;
5
+
6
+ export const ResponseSchema = z.object({
7
+ data: z.object({
8
+ isDeleted: z.boolean(),
9
+ }),
10
+ });
11
+
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -41,6 +41,7 @@ export namespace FindUsersByCriteriaCommand {
41
41
 
42
42
  createdAt: DateFilter.optional(),
43
43
  updatedAt: DateFilter.optional(),
44
+ deletedAt: DateFilter.optional(),
44
45
  tokenBonusBalance: NumberFilter.optional(),
45
46
 
46
47
  sortBy: z.nativeEnum(USER_SORT_BY).optional(),
@@ -7,3 +7,4 @@ export * from './get-user-balance.command';
7
7
  export * from './get-user-orders.command';
8
8
  export * from './get-user-subscriptions.command';
9
9
  export * from './get-user-products.command';
10
+ export * from './delete-account.command';
@@ -1704,4 +1704,19 @@ export const ERRORS = {
1704
1704
  message: 'Ошибка при обновлении ежедневного стрика',
1705
1705
  httpCode: 500,
1706
1706
  },
1707
+ ACCOUNT_DELETE_ERROR: {
1708
+ code: 'A360',
1709
+ message: 'Аккаунт не был удалён',
1710
+ httpCode: 500,
1711
+ },
1712
+ ACCOUNT_DELETED: {
1713
+ code: 'A361',
1714
+ message: 'Операция невозможна, аккаунт был удалён',
1715
+ httpCode: 400,
1716
+ },
1717
+ TELEGRAM_PROFILE_DELETE_ERROR: {
1718
+ code: 'A362',
1719
+ message: 'Произошла ошибка при удалении Telegram профиля',
1720
+ httpCode: 500,
1721
+ },
1707
1722
  };
@@ -3,4 +3,5 @@ export enum USER_STATUS {
3
3
  INACTIVE = 'inactive',
4
4
  TG_AUTO_REGISTERED = 'tg_auto_registered',
5
5
  MERGED = 'merged',
6
+ DELETED = 'deleted',
6
7
  }
@@ -16,6 +16,7 @@ export const UserSchema = z.object({
16
16
 
17
17
  createdAt: z.date(),
18
18
  updatedAt: z.date(),
19
+ deletedAt: z.date().nullable(),
19
20
  });
20
21
 
21
22
  export const UserAggregateSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.27",
3
+ "version": "0.7.28",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",