refactor: set status to 201 on create data

This commit is contained in:
Methapon2001 2024-04-02 15:42:53 +07:00
parent 94d77e494c
commit 2197ee4104
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;
return await prisma.branch.create({
const record = await prisma.branch.create({
include: {
province: true,
district: true,
@ -165,6 +165,10 @@ export class BranchController extends Controller {
updateBy: req.user.name,
},
});
this.setStatus(HttpStatus.CREATED);
return record;
}
@Patch("{branchId}")

View file

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