Merge branch 'development' into 'devops-staging'
feat: rearrangement find one user api service See merge request empatnusabangsa/ppob/ppob-backend!57
This commit is contained in:
commit
f99bede20e
|
@ -1,10 +1,4 @@
|
||||||
import {
|
import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common';
|
||||||
forwardRef,
|
|
||||||
HttpException,
|
|
||||||
HttpStatus,
|
|
||||||
Inject,
|
|
||||||
Injectable,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
import { CreateUserDto } from './dto/create-user.dto';
|
import { CreateUserDto } from './dto/create-user.dto';
|
||||||
import { UpdateUserDto } from './dto/update-user.dto';
|
import { UpdateUserDto } from './dto/update-user.dto';
|
||||||
import { Connection, EntityNotFoundError, Not, Repository } from 'typeorm';
|
import { Connection, EntityNotFoundError, Not, Repository } from 'typeorm';
|
||||||
|
@ -252,12 +246,28 @@ export class UsersService {
|
||||||
const coa = await this.coaService.findByUser(id, coaType.WALLET);
|
const coa = await this.coaService.findByUser(id, coaType.WALLET);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const userData = await this.usersRepository.findOneOrFail({
|
const userData = await this.usersRepository
|
||||||
where: {
|
.createQueryBuilder('users')
|
||||||
|
.leftJoinAndSelect('users.roles', 'roles')
|
||||||
|
.leftJoinAndSelect('users.superior', 'superior')
|
||||||
|
.leftJoinAndSelect('users.userDetail', 'userDetail')
|
||||||
|
.where('users.id = :id', {
|
||||||
id: id,
|
id: id,
|
||||||
},
|
})
|
||||||
relations: ['roles', 'superior', 'userDetail'],
|
.select([
|
||||||
});
|
'users.id',
|
||||||
|
'users.username',
|
||||||
|
'users.isActive',
|
||||||
|
'users.createdAt',
|
||||||
|
'roles.id',
|
||||||
|
'roles.name',
|
||||||
|
'superior.id',
|
||||||
|
'superior.username',
|
||||||
|
'userDetail.id',
|
||||||
|
'userDetail.name',
|
||||||
|
'userDetail.phone_number',
|
||||||
|
])
|
||||||
|
.getOne();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...userData,
|
...userData,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user