diff --git a/src/controllers/service/service-controller.ts b/src/controllers/service/service-controller.ts index cb1b4c5..2946add 100644 --- a/src/controllers/service/service-controller.ts +++ b/src/controllers/service/service-controller.ts @@ -94,6 +94,7 @@ export class ServiceController extends Controller { @Query() status?: Status, @Query() productTypeId?: string, @Query() registeredBranchId?: string, + @Query() fullDetail?: boolean, ) { const filterStatus = (val?: Status) => { if (!val) return {}; @@ -118,7 +119,17 @@ export class ServiceController extends Controller { const [result, total] = await prisma.$transaction([ prisma.service.findMany({ include: { - work: true, + work: fullDetail + ? { + orderBy: { order: "asc" }, + include: { + productOnWork: { + include: { product: true }, + orderBy: { order: "asc" }, + }, + }, + } + : true, createdBy: true, updatedBy: true, },