feat(statistics): implement top alert stocks, top last sales, top supplier debts, and top selling products endpoints with SQL queries
This commit is contained in:
@@ -21,8 +21,8 @@ export class PurchaseReceiptsService {
|
||||
create: dto.items.map((item, idx) => {
|
||||
const mapped = {
|
||||
count: new Prisma.Decimal(item.count ?? 0),
|
||||
fee: new Prisma.Decimal(item.fee ?? 0),
|
||||
total: new Prisma.Decimal(item.total ?? 0),
|
||||
unitPrice: new Prisma.Decimal(item.unitPrice ?? 0),
|
||||
totalAmount: new Prisma.Decimal(item.totalAmount ?? 0),
|
||||
description: item.description ?? null,
|
||||
product: { connect: { id: item.productId } },
|
||||
}
|
||||
@@ -34,6 +34,10 @@ export class PurchaseReceiptsService {
|
||||
const item = await this.prisma.purchaseReceipt.create({
|
||||
data,
|
||||
include: { items: true },
|
||||
omit: {
|
||||
supplierId: true,
|
||||
inventoryId: true,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user