File tree Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 1+ import { IsEmail , IsUrl } from 'class-validator' ;
12import { Entity , Column } from 'typeorm' ;
2- import { Status , Role , Team } from './types' ;
3+ import { Role , Status , Team } from './types' ;
34
45@Entity ( )
56export class User {
@@ -19,12 +20,14 @@ export class User {
1920 lastName : string ;
2021
2122 @Column ( )
23+ @IsEmail ( )
2224 email : string ;
2325
2426 @Column ( )
2527 profilePicture : string | null ;
2628
2729 @Column ( )
30+ @IsUrl ( )
2831 linkedin : string | null ;
2932
3033 @Column ( )
Original file line number Diff line number Diff line change @@ -22,20 +22,20 @@ export class UsersController {
2222
2323 @UseGuards ( AuthGuard ( 'jwt' ) )
2424 @Get ( '/:userId' )
25- async getUser ( @Param ( 'userId' , ParseIntPipe ) userId : number ) : Promise < User > {
25+ getUser ( @Param ( 'userId' , ParseIntPipe ) userId : number ) {
2626 return this . usersService . findOne ( userId ) ;
2727 }
2828
29- @Delete ( '/:id' )
30- removeUser ( @Param ( 'id' ) id : string ) {
31- return this . usersService . remove ( parseInt ( id ) ) ;
32- }
33-
3429 @Patch ( ':userId' )
3530 async updateUser (
3631 @Body ( ) updateUserDTO : UpdateUserDTO ,
3732 @Param ( 'userId' , ParseIntPipe ) userId : number ,
3833 ) : Promise < User > {
3934 return this . usersService . updateUser ( updateUserDTO , userId ) ;
4035 }
36+
37+ @Delete ( '/:id' )
38+ removeUser ( @Param ( 'id' ) id : string ) {
39+ return this . usersService . remove ( parseInt ( id ) ) ;
40+ }
4141}
Original file line number Diff line number Diff line change 11import {
2- Injectable ,
32 BadRequestException ,
3+ Injectable ,
44 UnauthorizedException ,
55 NotFoundException ,
66} from '@nestjs/common' ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Status } from './types';
22import { User } from './user.entity' ;
33
44export const getCurrentUser = ( ) : User => ( {
5- userId : 999 ,
5+ userId : 1 ,
66 status : Status . ADMIN ,
77 firstName : 'jimmy' ,
88 lastName : 'jimmy2' ,
You can’t perform that action at this time.
0 commit comments