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,
|
RequestWorkStatus,
|
||||||
PaymentStatus,
|
PaymentStatus,
|
||||||
User,
|
User,
|
||||||
Invoice,
|
|
||||||
CustomerType,
|
|
||||||
} from "@prisma/client";
|
} from "@prisma/client";
|
||||||
import { Controller, Get, Query, Request, Route, Security, Tags } from "tsoa";
|
import { Controller, Get, Query, Request, Route, Security, Tags } from "tsoa";
|
||||||
import prisma from "../db";
|
import prisma from "../db";
|
||||||
|
|
@ -64,6 +62,7 @@ export class StatsController extends Controller {
|
||||||
code: true,
|
code: true,
|
||||||
quotationStatus: true,
|
quotationStatus: true,
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
|
omit: { otpCode: true, otpExpires: true, userId: true },
|
||||||
include: { customer: true },
|
include: { customer: true },
|
||||||
},
|
},
|
||||||
finalPrice: true,
|
finalPrice: true,
|
||||||
|
|
@ -127,7 +126,10 @@ export class StatsController extends Controller {
|
||||||
code: true,
|
code: true,
|
||||||
quotation: {
|
quotation: {
|
||||||
select: {
|
select: {
|
||||||
customerBranch: { include: { customer: true } },
|
customerBranch: {
|
||||||
|
omit: { otpCode: true, otpExpires: true, userId: true },
|
||||||
|
include: { customer: true },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
|
|
@ -198,7 +200,12 @@ export class StatsController extends Controller {
|
||||||
invoice: {
|
invoice: {
|
||||||
select: {
|
select: {
|
||||||
quotation: {
|
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: {
|
include: {
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
|
omit: { otpCode: true, otpExpires: true, userId: true },
|
||||||
include: { customer: true },
|
include: { customer: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -430,9 +438,9 @@ export class StatsController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
return list.reduce<{
|
return list.reduce<{
|
||||||
byProductGroup: (ProductGroup & { _count: number })[];
|
byProductGroup: ((typeof list)[number]["product"]["productGroup"] & { _count: number })[];
|
||||||
bySale: (User & { _count: number })[];
|
bySale: ((typeof list)[number]["quotation"]["createdBy"] & { _count: number })[];
|
||||||
byCustomer: ((CustomerBranch & { customer: Customer }) & { _count: number })[];
|
byCustomer: ((typeof list)[number]["quotation"]["customerBranch"] & { _count: number })[];
|
||||||
}>(
|
}>(
|
||||||
(a, c) => {
|
(a, c) => {
|
||||||
{
|
{
|
||||||
|
|
@ -683,7 +691,9 @@ export class StatsController extends Controller {
|
||||||
{
|
{
|
||||||
paid: number;
|
paid: number;
|
||||||
unpaid: number;
|
unpaid: number;
|
||||||
customerBranch: CustomerBranch & { customer: Customer };
|
customerBranch: CustomerBranch & {
|
||||||
|
customer: Customer;
|
||||||
|
};
|
||||||
}[]
|
}[]
|
||||||
>((acc, item) => {
|
>((acc, item) => {
|
||||||
const exists = acc.find((v) => v.customerBranch.id === item.customerBranch!.id);
|
const exists = acc.find((v) => v.customerBranch.id === item.customerBranch!.id);
|
||||||
|
|
@ -702,6 +712,15 @@ export class StatsController extends Controller {
|
||||||
|
|
||||||
return acc;
|
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