fix: active only does not detect if head is not active
This commit is contained in:
parent
3f04f3c727
commit
76ea340fe5
1 changed files with 6 additions and 1 deletions
|
|
@ -253,7 +253,12 @@ export class BranchController extends Controller {
|
||||||
) {
|
) {
|
||||||
const where = {
|
const where = {
|
||||||
AND: {
|
AND: {
|
||||||
...filterStatus(status),
|
...filterStatus(activeOnly ? Status.ACTIVE : status),
|
||||||
|
AND: activeOnly
|
||||||
|
? {
|
||||||
|
OR: [{ headOffice: { status: { not: Status.INACTIVE } } }, { headOffice: null }],
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
headOfficeId: headOfficeId ?? (filter === "head" || tree ? null : undefined),
|
headOfficeId: headOfficeId ?? (filter === "head" || tree ? null : undefined),
|
||||||
NOT: { headOfficeId: filter === "sub" && !headOfficeId ? null : undefined },
|
NOT: { headOfficeId: filter === "sub" && !headOfficeId ? null : undefined },
|
||||||
OR: permissionCond(req.user, { alwaysIncludeHead: withHead, activeOnly }),
|
OR: permissionCond(req.user, { alwaysIncludeHead: withHead, activeOnly }),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue