fix: update condition and response relation
This commit is contained in:
parent
7ba77907d3
commit
e7568fa06f
1 changed files with 9 additions and 2 deletions
|
|
@ -216,7 +216,7 @@ export class BranchController extends Controller {
|
||||||
include: { province: true, district: true, subDistrict: true },
|
include: { province: true, district: true, subDistrict: true },
|
||||||
data: {
|
data: {
|
||||||
...rest,
|
...rest,
|
||||||
isHeadOffice: headOfficeId === null,
|
isHeadOffice: headOfficeId !== undefined ? headOfficeId === null : undefined,
|
||||||
province: {
|
province: {
|
||||||
connect: provinceId ? { id: provinceId } : undefined,
|
connect: provinceId ? { id: provinceId } : undefined,
|
||||||
disconnect: provinceId === null || undefined,
|
disconnect: provinceId === null || undefined,
|
||||||
|
|
@ -262,6 +262,13 @@ export class BranchController extends Controller {
|
||||||
throw new HttpError(HttpStatus.FORBIDDEN, "Branch is in used.", "data_exists");
|
throw new HttpError(HttpStatus.FORBIDDEN, "Branch is in used.", "data_exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
return await prisma.branch.delete({ where: { id: branchId } });
|
return await prisma.branch.delete({
|
||||||
|
include: {
|
||||||
|
province: true,
|
||||||
|
district: true,
|
||||||
|
subDistrict: true,
|
||||||
|
},
|
||||||
|
where: { id: branchId },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue