for prev commit
This commit is contained in:
parent
9d2c8d9bf8
commit
d7d19bc4de
@ -34,7 +34,7 @@ const quoteRouter = t.router({
|
||||
.input(GetQuoteInputDataSchema)
|
||||
.output(GetQuoteOutputDataSchema)
|
||||
.query(async ({ input }) => {
|
||||
const output = await Promise.all(
|
||||
const processData = await Promise.all(
|
||||
[
|
||||
configurator,
|
||||
supplierAgent,
|
||||
@ -49,10 +49,13 @@ const quoteRouter = t.router({
|
||||
].map(({ getKPData }) => getKPData(input))
|
||||
);
|
||||
|
||||
const values = output.reduce((obj, data) => Object.assign(obj, data.values), defaultValues);
|
||||
const payments = output.find((x) => x.payments)?.payments ?? defaultPayments;
|
||||
const insurance = output.find((x) => x.insurance)?.insurance ?? defaultInsurance;
|
||||
const fingap = output.find((x) => x.fingap)?.fingap ?? defaultFingap;
|
||||
const values = processData.reduce(
|
||||
(obj, data) => Object.assign(obj, data.values),
|
||||
defaultValues
|
||||
);
|
||||
const payments = processData.find((x) => x.payments)?.payments ?? defaultPayments;
|
||||
const insurance = processData.find((x) => x.insurance)?.insurance ?? defaultInsurance;
|
||||
const fingap = processData.find((x) => x.fingap)?.fingap ?? defaultFingap;
|
||||
|
||||
return {
|
||||
values,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user