editar funcion en backend
This commit is contained in:
		
							parent
							
								
									05600cb829
								
							
						
					
					
						commit
						387cf0ebca
					
				| 
						 | 
					@ -182,7 +182,7 @@ export class AppController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Post('user/updateAdminSystem')
 | 
					  @Post('user/updateAdminSystem')
 | 
				
			||||||
  updateAdminSystem(
 | 
					  updateAdminSystem(
 | 
				
			||||||
    //Nombre, Apellidos, Correo electrónico, Cédula, Teléfono, Contraseña
 | 
					    //Nombre, Apellidos, Correo electrónico, Cédula, Teléfono
 | 
				
			||||||
    @Body('_id') _id: string,
 | 
					    @Body('_id') _id: string,
 | 
				
			||||||
    @Body('dni') dni: string,
 | 
					    @Body('dni') dni: string,
 | 
				
			||||||
    @Body('name') name: string,
 | 
					    @Body('name') name: string,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,10 +74,9 @@ export class UsersController {
 | 
				
			||||||
    let dni = id['dni'];
 | 
					    let dni = id['dni'];
 | 
				
			||||||
    return this.userService.remove(dni);
 | 
					    return this.userService.remove(dni);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  @MessagePattern({ cmd: 'updateAdminSystem' })
 | 
					  @MessagePattern({ cmd: 'updateAdminSystem' })
 | 
				
			||||||
  updateAdminSystem(@Payload() user: UserDocument) {
 | 
					  updateAdminSystem(@Payload() user: UserDocument) {
 | 
				
			||||||
    return this.userService.update(user._id, user);
 | 
					    return this.userService.updateAdminSystem(user._id, user);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  //inicio de sesion
 | 
					  //inicio de sesion
 | 
				
			||||||
  @MessagePattern({ cmd: 'loginUser' })
 | 
					  @MessagePattern({ cmd: 'loginUser' })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,6 +78,15 @@ export class UsersService {
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  async updateAdminSystem(id: string, user: UserDocument) {
 | 
				
			||||||
 | 
					    return this.userModel.findOneAndUpdate({ _id: id }, {
 | 
				
			||||||
 | 
					      name: user['name'], last_name: user['last_name'],
 | 
				
			||||||
 | 
					      dni:user['dni'], email: user['email'], phone: user['phone']
 | 
				
			||||||
 | 
					  }, {
 | 
				
			||||||
 | 
					      new: true,
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* async remove(id: string) {
 | 
					  /* async remove(id: string) {
 | 
				
			||||||
     return this.userModel.findByIdAndRemove({ _id: id }).exec();
 | 
					     return this.userModel.findByIdAndRemove({ _id: id }).exec();
 | 
				
			||||||
   }*/
 | 
					   }*/
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue