refactor: do not update status if not created

This commit is contained in:
Methapon2001 2024-04-05 16:43:44 +07:00
parent 1412938e27
commit 97cc610171

View file

@ -210,7 +210,10 @@ export class BranchController extends Controller {
});
if (headOfficeId) {
await prisma.branch.update({ where: { id: headOfficeId }, data: { status: Status.ACTIVE } });
await prisma.branch.updateMany({
where: { id: headOfficeId, status: Status.CREATED },
data: { status: Status.ACTIVE },
});
}
this.setStatus(HttpStatus.CREATED);