From 24d45c913477d18724869d9a6b1294fed3ed9deb Mon Sep 17 00:00:00 2001 From: Abdul Rahman Reza Date: Sun, 1 Dec 2024 13:40:45 +0700 Subject: [PATCH] update auth --- src/controllers/auth.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/controllers/auth.ts b/src/controllers/auth.ts index 0f1f0be..2b37b2a 100644 --- a/src/controllers/auth.ts +++ b/src/controllers/auth.ts @@ -124,16 +124,15 @@ export class AuthController { } const res_list = repoMenu.createQueryBuilder() - .where(whereAttr.join(' or '), whereVal) - .andWhere('id_parent is null') + .where('(' + whereAttr.join(' or ') + ') and id_parent is null', whereVal) .orderBy('order_number', 'ASC'); let list_data_final = await res_list.getMany(); if (list_data_final.length > 0) { const res_list_all = await repoMenu.createQueryBuilder() - .where(whereAttr.join(' or '), whereVal) - .andWhere('id_parent is not null').getMany(); + .where('(' + whereAttr.join(' or ') + ') and id_parent is not null', whereVal) + .orderBy('order_number', 'ASC').getMany(); let list_child: any = {}; for (let p of res_list_all) {