@@ -42,7 +42,10 @@ export class UserService {
4242 * @returns {Promise<User> }
4343 */
4444 public async findOne ( id : number ) : Promise < User > {
45- let user = await this . userRepo . findOne ( id ) ;
45+ const user = await this . userRepo . findOne ( id ) ;
46+ console . log ( user ) ;
47+ console . log ( user === null ) ;
48+ console . log ( user === undefined ) ;
4649 if ( user === null ) {
4750 log . warn ( `User with the id=${ id } was not found!` ) ;
4851 throw new NotFoundException ( id ) ;
@@ -57,7 +60,7 @@ export class UserService {
5760 * @returns {Promise<User> }
5861 */
5962 public async findByUserId ( userId : string ) : Promise < User > {
60- let user = await this . userRepo . findByUserId ( userId ) ;
63+ const user = await this . userRepo . findByUserId ( userId ) ;
6164 if ( user === null ) {
6265 log . warn ( `User with the userId=${ userId } was not found!` ) ;
6366 throw new NotFoundException ( userId ) ;
@@ -78,7 +81,7 @@ export class UserService {
7881 await request . validate ( ) ;
7982
8083 // If the request body was valid we will create the user
81- let user = await this . userRepo . create ( data ) ;
84+ const user = await this . userRepo . create ( data ) ;
8285 return user ;
8386 }
8487
@@ -92,7 +95,7 @@ export class UserService {
9295 */
9396 public async update ( id : number , newUser : any ) : Promise < User > {
9497 const oldUserModel = await this . findOne ( id ) ;
95- let oldUser = oldUserModel . toJSON ( ) ;
98+ const oldUser = oldUserModel . toJSON ( ) ;
9699 const request = new UserUpdateRequest ( oldUser ) ;
97100
98101 request . setFirstName ( newUser . firstName ) ;
@@ -103,7 +106,7 @@ export class UserService {
103106 await request . validate ( ) ;
104107
105108 // If the request body was valid we will create the user
106- let user = await this . userRepo . update ( id , request . toJSON ( ) ) ;
109+ const user = await this . userRepo . update ( id , request . toJSON ( ) ) ;
107110 return user ;
108111 }
109112
0 commit comments