fix: update branch status when assign user to branch

This commit is contained in:
Methapon2001 2024-08-14 14:03:25 +07:00
parent ebba5cff03
commit 3aa405db7b

View file

@ -560,6 +560,13 @@ export class UserController extends Controller {
branchId: v,
})),
}),
prisma.branch.updateMany({
where: {
id: { in: Array.isArray(branchId) ? branchId : [branchId] },
status: "CREATED",
},
data: { status: "ACTIVE" },
}),
]);
if (branch[0]?.id !== user.branch[0]?.id) {