feat: enhance inventory management with category and location filters
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-07 07:51:47 +02:00
parent e7251fd94c
commit 7f7e4c24a8
6 changed files with 238 additions and 188 deletions
+18 -4
View File
@@ -14,6 +14,20 @@ type InventoryQuery = {
export class InventoryService {
constructor(private prisma: PrismaService) {}
private readonly productWithCategoryInclude = {
include: {
categoryRef: {
include: {
parent: {
include: {
parent: true,
},
},
},
},
},
};
private throwInventoryItemNotFound(id: number): never {
throw new NotFoundException(`Inventory item with id ${id} not found`);
}
@@ -59,7 +73,7 @@ export class InventoryService {
return this.prisma.inventoryItem.findMany({
where,
include: {
product: true,
product: this.productWithCategoryInclude,
},
orderBy,
});
@@ -78,7 +92,7 @@ export class InventoryService {
quantity: new Prisma.Decimal(newQuantity),
},
include: {
product: true,
product: this.productWithCategoryInclude,
},
});
@@ -154,7 +168,7 @@ export class InventoryService {
: undefined,
},
include: {
product: true,
product: this.productWithCategoryInclude,
},
});
}
@@ -222,7 +236,7 @@ export class InventoryService {
where: { id },
data: updateData,
include: {
product: true,
product: this.productWithCategoryInclude,
},
});
}