refactor: user relation

This commit is contained in:
Methapon2001 2024-07-01 13:24:02 +07:00
parent a74d8b63b1
commit 2bd30b735d
21 changed files with 607 additions and 185 deletions

View file

@ -79,7 +79,7 @@ export class BranchContactController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "Branch cannot be found.", "branchBadReq");
}
const record = await prisma.branchContact.create({
data: { ...body, branchId, createdBy: req.user.name, updatedBy: req.user.name },
data: { ...body, branchId, createdByUserId: req.user.sub, updatedByUserId: req.user.sub },
});
this.setStatus(HttpStatus.CREATED);
@ -107,7 +107,7 @@ export class BranchContactController extends Controller {
}
const record = await prisma.branchContact.update({
data: { ...body, updatedBy: req.user.name },
data: { ...body, updatedByUserId: req.user.sub },
where: { id: contactId, branchId },
});