From 100db9a6ca4a74a6b62ef872e3db9080c8ba2297 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Wed, 13 Nov 2024 15:18:00 +0700 Subject: [PATCH] fix: wrong shared condition --- src/controllers/04-product-controller.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/controllers/04-product-controller.ts b/src/controllers/04-product-controller.ts index c6ff1cd..6a44f3c 100644 --- a/src/controllers/04-product-controller.ts +++ b/src/controllers/04-product-controller.ts @@ -144,6 +144,12 @@ export class ProductController extends Controller { ? { OR: [ { productGroupId }, + { + shared: true, + productGroup: { + registeredBranch: { OR: permissionCondCompany(req.user) }, + }, + }, { productGroup: { shared: true, @@ -159,14 +165,8 @@ export class ProductController extends Controller { ? [] : [ { - shared: true, productGroup: { - registeredBranch: { OR: permissionCondCompany(req.user) }, - }, - }, - { - productGroup: { - shared: true, + id: productGroupId, registeredBranch: { OR: permissionCondCompany(req.user) }, }, },