refactor: set status to 201 on create data
This commit is contained in:
parent
94d77e494c
commit
2197ee4104
2 changed files with 8 additions and 1 deletions
|
|
@ -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}")
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue