refactor: where conditions
This commit is contained in:
parent
916ea84565
commit
114f008934
2 changed files with 53 additions and 60 deletions
|
|
@ -184,12 +184,24 @@ export class CustomerBranchController extends Controller {
|
|||
: {
|
||||
registeredBranch: {
|
||||
OR: [
|
||||
{ user: { some: { userId: req.user.sub } } },
|
||||
{
|
||||
user: { some: { userId: req.user.sub } },
|
||||
},
|
||||
{
|
||||
branch: globalAllow(req.user)
|
||||
? { some: { user: { some: { userId: req.user.sub } } } }
|
||||
: undefined,
|
||||
},
|
||||
{
|
||||
headOffice: globalAllow(req.user)
|
||||
? { branch: { some: { user: { some: { userId: req.user.sub } } } } }
|
||||
: undefined,
|
||||
},
|
||||
{
|
||||
headOffice: globalAllow(req.user)
|
||||
? { user: { some: { userId: req.user.sub } } }
|
||||
: undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue