feat: exclude some work from service

This commit is contained in:
Methapon2001 2024-07-23 11:53:43 +07:00
parent e233869efe
commit bada98d12d

View file

@ -67,6 +67,7 @@ type QuotationCreate = {
work: {
id: string;
// Name field will come from original data
excluded?: boolean;
product: {
id: string;
amount: number;
@ -335,6 +336,8 @@ export class QuotationController extends Controller {
detail: currentService.detail,
attributes: currentService.attributes as Prisma.JsonObject,
work: a.work.flatMap((c) => {
if (c.excluded) return [];
const currentWork = currentService.work.find((d) => d.id === c.id);
if (!currentWork) return []; // should not possible