fest: add page
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s

This commit is contained in:
Kanjana 2025-07-09 17:40:24 +07:00
parent c2195d4448
commit 1f63089363

View file

@ -44,6 +44,8 @@ export class businessTypeController extends Controller {
const [result, total] = await prisma.$transaction([ const [result, total] = await prisma.$transaction([
prisma.businessType.findMany({ prisma.businessType.findMany({
where, where,
take: pageSize,
skip: (page - 1) * pageSize,
}), }),
prisma.businessType.count({ where }), prisma.businessType.count({ where }),
]); ]);
@ -84,7 +86,7 @@ export class businessTypeController extends Controller {
}); });
if (!record) throw notFoundError("BusinessType"); if (!record) throw notFoundError("BusinessType");
return await prisma.businessType.update({ return await tx.businessType.update({
where: { id: businessTypeId }, where: { id: businessTypeId },
data: { data: {
...body, ...body,
@ -103,7 +105,7 @@ export class businessTypeController extends Controller {
}); });
if (!record) throw notFoundError("BusinessType"); if (!record) throw notFoundError("BusinessType");
return await prisma.businessType.delete({ return await tx.businessType.delete({
where: { id: businessTypeId }, where: { id: businessTypeId },
}); });
}); });