Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
a92f7eca09
1 changed files with 10 additions and 4 deletions
|
|
@ -780,14 +780,20 @@ export class PositionController extends Controller {
|
||||||
...typeCondition,
|
...typeCondition,
|
||||||
...checkChildConditions,
|
...checkChildConditions,
|
||||||
},
|
},
|
||||||
|
skip: (body.page - 1) * body.pageSize,
|
||||||
|
take: body.pageSize,
|
||||||
});
|
});
|
||||||
if (!posMaster || posMaster.length === 0) {
|
const total = posMaster.length;
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
|
||||||
}
|
// if (!posMaster || posMaster.length === 0) {
|
||||||
|
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
// }
|
||||||
|
|
||||||
const formattedData = await Promise.all(
|
const formattedData = await Promise.all(
|
||||||
posMaster.map(async (posMaster) => {
|
posMaster.map(async (posMaster) => {
|
||||||
const positions = await this.positionRepository.find({
|
const positions = await this.positionRepository.find({
|
||||||
where: { posMasterId: posMaster.id },
|
where: { posMasterId: posMaster.id },
|
||||||
|
relations:["posLevel","posType","posExecutive"]
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -813,7 +819,7 @@ export class PositionController extends Controller {
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess({data:formattedData,total});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue