Merge branch 'warunee-dev' into develop
* warunee-dev: add auth sync by menu # Conflicts: # src/controllers/AuthSysController.ts
This commit is contained in:
commit
225063e8b7
2 changed files with 50 additions and 11 deletions
|
|
@ -27,11 +27,25 @@ export class AuthSysController extends Controller {
|
|||
|
||||
@Get("list")
|
||||
public async listAuthSys() {
|
||||
const getList = await this.authSysRepo.find();
|
||||
const getList = await this.authSysRepo.find({
|
||||
select: ["id", "parentId", "sysName", "sysDescription", "order"],
|
||||
});
|
||||
|
||||
if (!getList || getList.length === 0) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(getList);
|
||||
|
||||
const lists = getList
|
||||
.filter((x) => x.parentId == null)
|
||||
.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
children: getList.filter((x) => x.parentId == item.id).sort((a, b) => a.order - b.order),
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.order - b.order);
|
||||
|
||||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
||||
@Get("{systemId}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue