location hiarrch alteration done
This commit is contained in:
parent
a43d3efa68
commit
6edb5da84f
@ -379,7 +379,7 @@ export const updateUser = async (req: AuthRequest, res: Response) => {
|
||||
await user.update(updates);
|
||||
|
||||
if (Array.isArray(assignments)) {
|
||||
await upsertUserAssignments(id, assignments, req.user?.id);
|
||||
await upsertUserAssignments(id as string, assignments, req.user?.id);
|
||||
} else if (roleCode !== undefined || locationId !== undefined) {
|
||||
const primaryRoleCode = roleCode || user.roleCode;
|
||||
if (primaryRoleCode) {
|
||||
|
||||
@ -331,7 +331,9 @@ export const getManagersByRole = async (req: Request, res: Response) => {
|
||||
const asmAssignments = assignments.filter((a: any) =>
|
||||
(a.role?.roleCode === 'ASM' || m.roleCode === 'ASM') && a.location?.type === 'area'
|
||||
);
|
||||
const asmCode = assignments.find((a: any) => a.managerCode)?.managerCode || null;
|
||||
const asmCode = assignments.find((a: any) =>
|
||||
(a.role?.roleCode === 'ASM' || m.roleCode === 'ASM') && a.managerCode
|
||||
)?.managerCode || null;
|
||||
|
||||
const result = m.toJSON();
|
||||
result.asmCode = asmCode;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user