Merge branch 'refactor/error-response' into dev

This commit is contained in:
Methapon2001 2024-04-02 15:43:05 +07:00
commit 8a512c2ba3
2 changed files with 8 additions and 1 deletions

View file

@ -148,7 +148,7 @@ export class BranchController extends Controller {
const { provinceId, districtId, subDistrictId, headOfficeId, ...rest } = body; const { provinceId, districtId, subDistrictId, headOfficeId, ...rest } = body;
return await prisma.branch.create({ const record = await prisma.branch.create({
include: { include: {
province: true, province: true,
district: true, district: true,
@ -165,6 +165,10 @@ export class BranchController extends Controller {
updateBy: req.user.name, updateBy: req.user.name,
}, },
}); });
this.setStatus(HttpStatus.CREATED);
return record;
} }
@Patch("{branchId}") @Patch("{branchId}")

View file

@ -95,6 +95,9 @@ export class BranchContactController extends Controller {
include: { branch: true }, include: { branch: true },
data: { ...body, branchId, createdBy: req.user.name, updateBy: req.user.name }, data: { ...body, branchId, createdBy: req.user.name, updateBy: req.user.name },
}); });
this.setStatus(HttpStatus.CREATED);
return Object.assign(record, { return Object.assign(record, {
qrCodeImageUrl: await minio.presignedGetObject( qrCodeImageUrl: await minio.presignedGetObject(
MINIO_BUCKET, MINIO_BUCKET,