Download src/modules/user/user.controller.ts from bardd/node-pt: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/bardd/node-pt/resolve/ca4fcfa020aaa53fd098cac7defe8d6c3f7b0afb/src/modules/user/user.controller.ts
- Command line
-
hf download hf://spaces/bardd/node-pt@ca4fcfa020aaa53fd098cac7defe8d6c3f7b0afb/src/modules/user/user.controller.ts
-
curl -L -o user.controller.ts https://huggingface.co/spaces/bardd/node-pt/resolve/ca4fcfa020aaa53fd098cac7defe8d6c3f7b0afb/src/modules/user/user.controller.ts
1.02 kB
| import { | |
| Body, | |
| Controller, | |
| Get, | |
| HttpStatus, | |
| Post, | |
| Query, | |
| Req, | |
| Res, | |
| UseGuards, | |
| } from '@nestjs/common'; | |
| import { UserService } from './user.service'; | |
| import { Response } from 'express'; | |
| import { CommonServices } from '../shared/common.service'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard' | |
| ('user') | |
| export class UserController extends CommonServices { | |
| constructor( | |
| private readonly userService: UserService, | |
| ) { | |
| super(); | |
| } | |
| ('') | |
| (JwtAuthGuard) | |
| async getUserDetails(() res: Response, () req): Promise<any> { | |
| try { | |
| const response = await this.userService.userRepository.findById( | |
| req.user.userId, | |
| ); | |
| return this.sendResponse( | |
| this.messages.Success, | |
| response ?? 'NOT_FOUND', | |
| HttpStatus.OK, | |
| res, | |
| ); | |
| } catch (error) { | |
| return this.sendResponse( | |
| 'Internal server Error', | |
| {}, | |
| HttpStatus.INTERNAL_SERVER_ERROR, | |
| res, | |
| ); | |
| } | |
| } | |
| } | |