@purpleschool/student-works 0.0.10 → 0.0.11

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,3 +12,4 @@ export * from './promocode';
12
12
  export * from './page';
13
13
  export * from './writer';
14
14
  export * from './files';
15
+ export * from './user-balance';
@@ -0,0 +1,6 @@
1
+ export const USER_BALANCE_CONTROLLER_PRIVATE = 'private/balance' as const;
2
+ export const USER_BALANCE_CONTROLLER_PUBLIC = 'public/balance' as const;
3
+
4
+ export const USER_BALANCE_ROUTES = {
5
+ BALANCE: '',
6
+ } as const;
@@ -6,7 +6,6 @@ export const USER_ROUTES = {
6
6
  CHECK_EMAIL: 'check-email',
7
7
  FIND_BY_CRITERIA: 'criteria',
8
8
  FIND_BY_UUID: (uuid: string) => `${uuid}`,
9
- GET_BALANCE: (uuid: string) => `balance/${uuid}`,
10
9
  GET_ORDERS: (uuid: string) => `orders/${uuid}`,
11
10
  GET_SUBSCRIPTIONS: (uuid: string) => `subscriptions/${uuid}`,
12
11
  GET_PRODUCTS: (uuid: string) => `products/${uuid}`,
@@ -0,0 +1,6 @@
1
+ export const USER_BALANCE_CONTROLLER_PRIVATE = 'private/balance' as const;
2
+ export const USER_BALANCE_CONTROLLER_PUBLIC = 'public/balance' as const;
3
+
4
+ export const USER_BALANCE_ROUTES = {
5
+ GET_BALANCE: '',
6
+ } as const;
package/api/routes.ts CHANGED
@@ -12,6 +12,12 @@ export const REST_API = {
12
12
  VERIFY_EMAIL_RETRY: `${ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.VERIFY_EMAIL_RETRY}`,
13
13
  },
14
14
  UNREGISTERED_USERS: {},
15
+ USER_BALANCE_PRIVATE: {
16
+ GET_BALANCE: `${ROOT}/${CONTROLLERS.USER_BALANCE_CONTROLLER_PRIVATE}/${CONTROLLERS.USER_BALANCE_ROUTES.BALANCE}`,
17
+ },
18
+ USER_BALANCE_PUBLIC: {
19
+ GET_BALANCE: `${ROOT}/${CONTROLLERS.USER_BALANCE_CONTROLLER_PUBLIC}/${CONTROLLERS.USER_BALANCE_ROUTES.BALANCE}`,
20
+ },
15
21
  USERS: {
16
22
  GET: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET}`,
17
23
  POST: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.POST}`,
@@ -19,8 +25,6 @@ export const REST_API = {
19
25
  FIND_BY_CRITERIA: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_CRITERIA}`,
20
26
  FIND_BY_UUID: (uuid: string) =>
21
27
  `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_UUID(uuid)}`,
22
- GET_BALANCE: (uuid: string) =>
23
- `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_BALANCE(uuid)}`,
24
28
  GET_ORDERS: (uuid: string) =>
25
29
  `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_ORDERS(uuid)}`,
26
30
  DELETE_ACCOUNT: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
@@ -28,3 +28,4 @@ __exportStar(require("./promocode"), exports);
28
28
  __exportStar(require("./page"), exports);
29
29
  __exportStar(require("./writer"), exports);
30
30
  __exportStar(require("./files"), exports);
31
+ __exportStar(require("./user-balance"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_BALANCE_ROUTES = exports.USER_BALANCE_CONTROLLER_PUBLIC = exports.USER_BALANCE_CONTROLLER_PRIVATE = void 0;
4
+ exports.USER_BALANCE_CONTROLLER_PRIVATE = 'private/balance';
5
+ exports.USER_BALANCE_CONTROLLER_PUBLIC = 'public/balance';
6
+ exports.USER_BALANCE_ROUTES = {
7
+ BALANCE: '',
8
+ };
@@ -8,7 +8,6 @@ exports.USER_ROUTES = {
8
8
  CHECK_EMAIL: 'check-email',
9
9
  FIND_BY_CRITERIA: 'criteria',
10
10
  FIND_BY_UUID: (uuid) => `${uuid}`,
11
- GET_BALANCE: (uuid) => `balance/${uuid}`,
12
11
  GET_ORDERS: (uuid) => `orders/${uuid}`,
13
12
  GET_SUBSCRIPTIONS: (uuid) => `subscriptions/${uuid}`,
14
13
  GET_PRODUCTS: (uuid) => `products/${uuid}`,
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_BALANCE_ROUTES = exports.USER_BALANCE_CONTROLLER_PUBLIC = exports.USER_BALANCE_CONTROLLER_PRIVATE = void 0;
4
+ exports.USER_BALANCE_CONTROLLER_PRIVATE = 'private/balance';
5
+ exports.USER_BALANCE_CONTROLLER_PUBLIC = 'public/balance';
6
+ exports.USER_BALANCE_ROUTES = {
7
+ GET_BALANCE: '',
8
+ };
@@ -47,13 +47,18 @@ exports.REST_API = {
47
47
  VERIFY_EMAIL_RETRY: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.VERIFY_EMAIL_RETRY}`,
48
48
  },
49
49
  UNREGISTERED_USERS: {},
50
+ USER_BALANCE_PRIVATE: {
51
+ GET_BALANCE: `${exports.ROOT}/${CONTROLLERS.USER_BALANCE_CONTROLLER_PRIVATE}/${CONTROLLERS.USER_BALANCE_ROUTES.BALANCE}`,
52
+ },
53
+ USER_BALANCE_PUBLIC: {
54
+ GET_BALANCE: `${exports.ROOT}/${CONTROLLERS.USER_BALANCE_CONTROLLER_PUBLIC}/${CONTROLLERS.USER_BALANCE_ROUTES.BALANCE}`,
55
+ },
50
56
  USERS: {
51
57
  GET: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET}`,
52
58
  POST: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.POST}`,
53
59
  CHECK_EMAIL: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CHECK_EMAIL}`,
54
60
  FIND_BY_CRITERIA: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_CRITERIA}`,
55
61
  FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_UUID(uuid)}`,
56
- GET_BALANCE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_BALANCE(uuid)}`,
57
62
  GET_ORDERS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_ORDERS(uuid)}`,
58
63
  DELETE_ACCOUNT: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
59
64
  },
@@ -28,3 +28,4 @@ __exportStar(require("./page"), exports);
28
28
  __exportStar(require("./writer"), exports);
29
29
  __exportStar(require("./account-merge"), exports);
30
30
  __exportStar(require("./files"), exports);
31
+ __exportStar(require("./user-balance"), exports);
@@ -19,7 +19,6 @@ __exportStar(require("./find-user-by-uuid.command"), exports);
19
19
  __exportStar(require("./get-me.command"), exports);
20
20
  __exportStar(require("./up-token-bonus-balance.command"), exports);
21
21
  __exportStar(require("./find-users-by-criteria.command"), exports);
22
- __exportStar(require("./get-user-balance.command"), exports);
23
22
  __exportStar(require("./get-user-orders.command"), exports);
24
23
  __exportStar(require("./get-user-subscriptions.command"), exports);
25
24
  __exportStar(require("./get-user-products.command"), exports);
@@ -4,12 +4,14 @@ exports.GetUserBalanceCommand = void 0;
4
4
  const zod_1 = require("zod");
5
5
  var GetUserBalanceCommand;
6
6
  (function (GetUserBalanceCommand) {
7
- GetUserBalanceCommand.RequestSchema = zod_1.z.object({
8
- uuid: zod_1.z.string().uuid(),
9
- });
10
7
  GetUserBalanceCommand.ResponseSchema = zod_1.z.object({
11
8
  data: zod_1.z.object({
12
9
  totalTokenBalance: zod_1.z.number(),
10
+ tokenBonusBalance: zod_1.z.number(),
11
+ subscriptionBalance: zod_1.z.number(),
12
+ productBalance: zod_1.z.number(),
13
+ referralBonusBalance: zod_1.z.number(),
14
+ carriedOverBalance: zod_1.z.number(),
13
15
  }),
14
16
  });
15
17
  })(GetUserBalanceCommand || (exports.GetUserBalanceCommand = GetUserBalanceCommand = {}));
@@ -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("./get-user-balance.command"), exports);
package/commands/index.ts CHANGED
@@ -12,3 +12,4 @@ export * from './page';
12
12
  export * from './writer';
13
13
  export * from './account-merge';
14
14
  export * from './files';
15
+ export * from './user-balance';
@@ -3,7 +3,6 @@ export * from './find-user-by-uuid.command';
3
3
  export * from './get-me.command';
4
4
  export * from './up-token-bonus-balance.command';
5
5
  export * from './find-users-by-criteria.command';
6
- export * from './get-user-balance.command';
7
6
  export * from './get-user-orders.command';
8
7
  export * from './get-user-subscriptions.command';
9
8
  export * from './get-user-products.command';
@@ -1,17 +1,15 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  export namespace GetUserBalanceCommand {
4
- export const RequestSchema = z.object({
5
- uuid: z.string().uuid(),
6
- });
7
-
8
- export type Request = z.infer<typeof RequestSchema>;
9
-
10
4
  export const ResponseSchema = z.object({
11
5
  data: z.object({
12
6
  totalTokenBalance: z.number(),
7
+ tokenBonusBalance: z.number(),
8
+ subscriptionBalance: z.number(),
9
+ productBalance: z.number(),
10
+ referralBonusBalance: z.number(),
11
+ carriedOverBalance: z.number(),
13
12
  }),
14
13
  });
15
-
16
14
  export type Response = z.infer<typeof ResponseSchema>;
17
15
  }
@@ -0,0 +1 @@
1
+ export * from './get-user-balance.command';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/student-works",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",