@wrcb/cb-common 1.0.56 → 1.0.57

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.
@@ -1,9 +1,8 @@
1
1
  import { Request, Response, NextFunction } from 'express';
2
- interface UserPayload {
2
+ export interface UserPayload {
3
3
  id: string;
4
4
  email: string;
5
- cpf: string;
6
- role: string;
5
+ role?: string;
7
6
  }
8
7
  declare global {
9
8
  namespace Express {
@@ -13,4 +12,3 @@ declare global {
13
12
  }
14
13
  }
15
14
  export declare const currentUser: (req: Request, res: Response, next: NextFunction) => void;
16
- export {};
@@ -6,7 +6,7 @@ const userRole_1 = require("../events/types/userRole");
6
6
  const requireAdmin = (req, res, next) => {
7
7
  var _a;
8
8
  if (((_a = req.currentUser) === null || _a === void 0 ? void 0 : _a.role) !== userRole_1.UserRole.Admin) {
9
- throw new notAuthorizedError_1.NotAuthorizedError('Not Authorized - Just Admin role');
9
+ throw new notAuthorizedError_1.NotAuthorizedError('Não autorizado - apenas administrador');
10
10
  }
11
11
  next();
12
12
  };
@@ -4,7 +4,7 @@ exports.requireAuth = void 0;
4
4
  const notAuthorizedError_1 = require("../errors/notAuthorizedError");
5
5
  const requireAuth = (req, res, next) => {
6
6
  if (!req.currentUser) {
7
- throw new notAuthorizedError_1.NotAuthorizedError('Not Authorized');
7
+ throw new notAuthorizedError_1.NotAuthorizedError('Não autorizado');
8
8
  }
9
9
  next();
10
10
  };
@@ -1,9 +1,3 @@
1
- import { UserRole } from '../events/types/userRole';
2
- export interface UserJWTData {
3
- id: string;
4
- email: string;
5
- role?: UserRole;
6
- }
7
1
  export interface MarketFilter {
8
2
  status?: string;
9
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrcb/cb-common",
3
- "version": "1.0.56",
3
+ "version": "1.0.57",
4
4
  "description": "Common resources between services",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",