feat: add query param to include full detail in service
This commit is contained in:
parent
74ed6fb321
commit
053eb8b04a
1 changed files with 12 additions and 1 deletions
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue