Merge branch 'development' into 'devops-staging'
Development See merge request empatnusabangsa/ppob/ppob-backend!73
This commit is contained in:
commit
a6fce54b87
|
@ -336,8 +336,8 @@ export class ProductService {
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await baseQuery
|
const data = await baseQuery
|
||||||
.offset(page * 10)
|
.offset(page * pageSize)
|
||||||
.limit(10)
|
.limit(pageSize)
|
||||||
.getRawMany();
|
.getRawMany();
|
||||||
|
|
||||||
const totalData = await baseQuery.getCount();
|
const totalData = await baseQuery.getCount();
|
||||||
|
|
|
@ -113,8 +113,18 @@ export class UsersController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
async findAll(@Request() req, @Query('page') page: number) {
|
async findAll(
|
||||||
const data = await this.usersService.findAll(page, req.user.userId);
|
@Request() req,
|
||||||
|
@Query('page') page: number,
|
||||||
|
@Query('superior') superior: string,
|
||||||
|
@Query('type') type: string,
|
||||||
|
) {
|
||||||
|
const data = await this.usersService.findAll(
|
||||||
|
page,
|
||||||
|
req.user.userId,
|
||||||
|
superior == 'null' ? null : superior,
|
||||||
|
type == 'null' ? null : type,
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...data,
|
...data,
|
||||||
|
|
|
@ -118,7 +118,7 @@ export class UsersService {
|
||||||
return userData;
|
return userData;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findAll(page: number, id: string) {
|
async findAll(page: number, id: string, superior: string, type: string) {
|
||||||
const baseQuery = this.usersRepository
|
const baseQuery = this.usersRepository
|
||||||
.createQueryBuilder('user')
|
.createQueryBuilder('user')
|
||||||
.where('user.id != :id', {
|
.where('user.id != :id', {
|
||||||
|
@ -148,6 +148,20 @@ export class UsersService {
|
||||||
'coa.amount',
|
'coa.amount',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if(superior){
|
||||||
|
baseQuery.where('user.superior = :id_supperior',{
|
||||||
|
id_supperior:superior
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type){
|
||||||
|
if(type == 'partner'){
|
||||||
|
baseQuery.where('user.partner_id is not null')
|
||||||
|
} else {
|
||||||
|
baseQuery.where('user.partner_id is null')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const data = await baseQuery
|
const data = await baseQuery
|
||||||
.orderBy('user.createdAt', 'DESC')
|
.orderBy('user.createdAt', 'DESC')
|
||||||
.skip(page * 10)
|
.skip(page * 10)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user