@wrcb/cb-common 1.0.371 → 1.0.373

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,13 +12,13 @@ const country_1 = require("../types/country");
12
12
  const tenant_1 = require("../types/tenant");
13
13
  function signUpReturnCookie(id, overrides) {
14
14
  // Build a JWT payload
15
- const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), tenant: tenant_1.Tenant.PoliticaBet, email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.Consumer, language: country_1.Language.Português, country: country_1.Country.Brasil, isKycDone: true, isEmailVerified: false, isWhatsappVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false }, overrides // sobrescreve os valores padrão
15
+ const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), tenant: tenant_1.Tenant.PoliticaBet, email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.Consumer, language: country_1.Language.Português, country: country_1.Country.Brasil, isKycDone: true, isEmailVerified: false, isWhatsappVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false, isBusinessDataProvided: false }, overrides // sobrescreve os valores padrão
16
16
  );
17
17
  return buildCookie(payload);
18
18
  }
19
19
  function signUpReturnCookieAdmin(id, overrides) {
20
20
  // Build a JWT payload
21
- const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), tenant: tenant_1.Tenant.PoliticaBet, email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.Admin, isKycDone: true, language: country_1.Language.Português, country: country_1.Country.Brasil, isEmailVerified: false, isWhatsappVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false }, overrides // sobrescreve os valores padrão
21
+ const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), tenant: tenant_1.Tenant.PoliticaBet, email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.Admin, isKycDone: true, language: country_1.Language.Português, country: country_1.Country.Brasil, isEmailVerified: false, isWhatsappVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false, isBusinessDataProvided: false }, overrides // sobrescreve os valores padrão
22
22
  );
23
23
  return buildCookie(payload);
24
24
  }
@@ -0,0 +1,2 @@
1
+ import { Request, Response, NextFunction } from 'express';
2
+ export declare const requireProvidedBusinessData: (req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requireProvidedBusinessData = void 0;
4
+ const badRequestError_1 = require("../errors/badRequestError");
5
+ const requireProvidedBusinessData = (req, res, next) => {
6
+ var _a;
7
+ if (!((_a = req.currentUser) === null || _a === void 0 ? void 0 : _a.isBusinessDataProvided)) {
8
+ throw new badRequestError_1.BadRequestError('RequireProvidedBusinessData');
9
+ }
10
+ next();
11
+ };
12
+ exports.requireProvidedBusinessData = requireProvidedBusinessData;
@@ -1,6 +1,6 @@
1
1
  import { CouponType } from '../types/couponType';
2
2
  import { Tenant } from '../types/tenant';
3
- import { UserCategory } from 'src/types/userCategory';
3
+ import { UserCategory } from '../types/userCategory';
4
4
  import { UserTags } from 'src/types/userTags';
5
5
  import { ProductTypes } from 'src/types/productTypes';
6
6
  export interface CategoryConfiguration {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TenantDataService = void 0;
4
4
  const couponType_1 = require("../types/couponType");
5
5
  const tenant_1 = require("../types/tenant");
6
- const userCategory_1 = require("src/types/userCategory");
6
+ const userCategory_1 = require("../types/userCategory");
7
7
  const userTags_1 = require("src/types/userTags");
8
8
  const productTypes_1 = require("src/types/productTypes");
9
9
  class TenantDataService {
@@ -10,6 +10,7 @@ export interface UserPayload {
10
10
  isWhatsappVerified: boolean;
11
11
  isPersonalDataProvided: boolean;
12
12
  isAddressDataProvided: boolean;
13
+ isBusinessDataProvided: boolean;
13
14
  language: Language;
14
15
  country: Country;
15
16
  role: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrcb/cb-common",
3
- "version": "1.0.371",
3
+ "version": "1.0.373",
4
4
  "description": "Common resources between services",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",