chore: remove field from include in report
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s
This commit is contained in:
parent
536e812394
commit
cfe820b89f
1 changed files with 28 additions and 9 deletions
|
|
@ -7,8 +7,6 @@ import {
|
|||
RequestWorkStatus,
|
||||
PaymentStatus,
|
||||
User,
|
||||
Invoice,
|
||||
CustomerType,
|
||||
} from "@prisma/client";
|
||||
import { Controller, Get, Query, Request, Route, Security, Tags } from "tsoa";
|
||||
import prisma from "../db";
|
||||
|
|
@ -64,6 +62,7 @@ export class StatsController extends Controller {
|
|||
code: true,
|
||||
quotationStatus: true,
|
||||
customerBranch: {
|
||||
omit: { otpCode: true, otpExpires: true, userId: true },
|
||||
include: { customer: true },
|
||||
},
|
||||
finalPrice: true,
|
||||
|
|
@ -127,7 +126,10 @@ export class StatsController extends Controller {
|
|||
code: true,
|
||||
quotation: {
|
||||
select: {
|
||||
customerBranch: { include: { customer: true } },
|
||||
customerBranch: {
|
||||
omit: { otpCode: true, otpExpires: true, userId: true },
|
||||
include: { customer: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
payment: {
|
||||
|
|
@ -198,7 +200,12 @@ export class StatsController extends Controller {
|
|||
invoice: {
|
||||
select: {
|
||||
quotation: {
|
||||
select: { customerBranch: { include: { customer: true } } },
|
||||
select: {
|
||||
customerBranch: {
|
||||
omit: { otpCode: true, otpExpires: true, userId: true },
|
||||
include: { customer: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -402,6 +409,7 @@ export class StatsController extends Controller {
|
|||
include: {
|
||||
createdBy: true,
|
||||
customerBranch: {
|
||||
omit: { otpCode: true, otpExpires: true, userId: true },
|
||||
include: { customer: true },
|
||||
},
|
||||
},
|
||||
|
|
@ -430,9 +438,9 @@ export class StatsController extends Controller {
|
|||
});
|
||||
|
||||
return list.reduce<{
|
||||
byProductGroup: (ProductGroup & { _count: number })[];
|
||||
bySale: (User & { _count: number })[];
|
||||
byCustomer: ((CustomerBranch & { customer: Customer }) & { _count: number })[];
|
||||
byProductGroup: ((typeof list)[number]["product"]["productGroup"] & { _count: number })[];
|
||||
bySale: ((typeof list)[number]["quotation"]["createdBy"] & { _count: number })[];
|
||||
byCustomer: ((typeof list)[number]["quotation"]["customerBranch"] & { _count: number })[];
|
||||
}>(
|
||||
(a, c) => {
|
||||
{
|
||||
|
|
@ -683,7 +691,9 @@ export class StatsController extends Controller {
|
|||
{
|
||||
paid: number;
|
||||
unpaid: number;
|
||||
customerBranch: CustomerBranch & { customer: Customer };
|
||||
customerBranch: CustomerBranch & {
|
||||
customer: Customer;
|
||||
};
|
||||
}[]
|
||||
>((acc, item) => {
|
||||
const exists = acc.find((v) => v.customerBranch.id === item.customerBranch!.id);
|
||||
|
|
@ -702,6 +712,15 @@ export class StatsController extends Controller {
|
|||
|
||||
return acc;
|
||||
}, [])
|
||||
.map((v) => ({ ...v, _quotation: undefined }));
|
||||
.map((v) => ({
|
||||
...v,
|
||||
customerBranch: {
|
||||
...v.customerBranch,
|
||||
userId: undefined,
|
||||
otpCode: undefined,
|
||||
otpExpires: undefined,
|
||||
},
|
||||
_quotation: undefined,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue