Skip to content

Commit

Permalink
override decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Alloza committed Jan 11, 2024
1 parent 0f30baa commit 07fcf56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion eda/eda_api/lib/module/admin/users/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ const bcrypt = require('bcryptjs');
const SEED = require('../../../../config/seed').SEED;
const crypto = require('crypto');

function AASingleSingnOn(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const originalMethod = descriptor.value;

descriptor.value = async function (req: Request, res: Response, next: NextFunction) {
console.log('Nueva lógica de Single Sign On', req.body);
return res.status(200).json({ok: 'nuevo sign on'});
};
}

export class UserController {

Expand Down Expand Up @@ -139,7 +147,7 @@ export class UserController {
}
}


@AASingleSingnOn
static async singleSingnOn(req:Request, res:Response, next:NextFunction){

console.log('Single Sign On', req.body);
Expand Down
1 change: 1 addition & 0 deletions eda/eda_api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"outDir": "./dist",
"baseUrl": "./lib",
"resolveJsonModule": true,
"experimentalDecorators": true,
"typeRoots": ["lib/types", "node_modules/@types"]
},
"include": [
Expand Down

0 comments on commit 07fcf56

Please sign in to comment.