fix: error required args
This commit is contained in:
parent
065163dac8
commit
463e28c089
1 changed files with 3 additions and 3 deletions
|
|
@ -90,9 +90,9 @@ export class CustomerBranchCitizenController extends Controller {
|
||||||
async create(@Path() branchId: string, @Body() body: CustomerBranchCitizenPayload) {
|
async create(@Path() branchId: string, @Body() body: CustomerBranchCitizenPayload) {
|
||||||
const { provinceId, districtId, subDistrictId, ...rest } = body;
|
const { provinceId, districtId, subDistrictId, ...rest } = body;
|
||||||
const [province, district, subDistrict] = await prisma.$transaction([
|
const [province, district, subDistrict] = await prisma.$transaction([
|
||||||
prisma.province.findUnique({ where: { id: body.provinceId ?? undefined } }),
|
prisma.province.findFirst({ where: { id: body.provinceId ?? undefined } }),
|
||||||
prisma.district.findUnique({ where: { id: body.districtId ?? undefined } }),
|
prisma.district.findFirst({ where: { id: body.districtId ?? undefined } }),
|
||||||
prisma.subDistrict.findUnique({ where: { id: body.subDistrictId ?? undefined } }),
|
prisma.subDistrict.findFirst({ where: { id: body.subDistrictId ?? undefined } }),
|
||||||
]);
|
]);
|
||||||
if (body.provinceId && !province) throw relationError("Province");
|
if (body.provinceId && !province) throw relationError("Province");
|
||||||
if (body.districtId && !district) throw relationError("District");
|
if (body.districtId && !district) throw relationError("District");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue