Skip to content

Commit

Permalink
fix rut user/:id
Browse files Browse the repository at this point in the history
  • Loading branch information
sibas1 committed Dec 17, 2024
1 parent f9980be commit 688eb2f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/apps/users/src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export class UsersController {
}
}
@Get(':id')
async prifile(@Param('id') id: Request) {
async prifile(@Param('id') id: string) {
Logger.log('Recibiendo peticion profile')
try{
const resp = await this.usersService.findUserById(id)
const resp = await this.usersService.findUserByIdUnAuthorized(id)
return resp as unknown as Promise<ProfileSuccess>;
}catch(error){
Logger.error(error)
Expand Down
20 changes: 20 additions & 0 deletions server/apps/users/src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ export class UsersService {
async updateMode(useId: string, modeDto:ModeDto) {

}
async findUserByIdUnAuthorized(id: string): Promise<any> {
return await this.userRepository.findOne({
where: { id: id },
select: [
'id',
'firstName',
'lastName',
'email',
'title',
'biography',
'image',
'reviws',
'whyLearn',
'rating',
'role',
'createdAt',
],
relations: ['accounts'],
});
}
//
// async changeUserRole(userId: string, mode) {
// // Buscar al usuario por ID
Expand Down

0 comments on commit 688eb2f

Please sign in to comment.