async importQuotation(req: Request, res: Response, next: NextFunction) {
    try {
      console.log("Importing quotations...");
      const body: ImportCleanQuotations = req.body;
      const regionCode = getRegionCode(req.user!, req.query);
      console.log("User", req.user!);
      console.log("RegionCode: ", regionCode);
      if (!regionCode) {
        console.log("Region code is required for this operation");
        return res
          .status(httpStatusCodes.BAD_REQUEST)
          .json(
            new ResponseJSON(
              "Region code is required for this operation",
              true,
              httpStatusCodes.BAD_REQUEST
            )
          );
      }

      const createMany = await prisma.$transaction(async (tx) => {
        const interpolatedQuotePromises: Promise<any>[] = [];
        const cleanedQuotePromises: Promise<any>[] = [];

        const quotations = await Promise.all(
          body.quotations.map(async (quotation, index) => {
            try {
              const item = await prisma.item.findUnique({
                where: {
                  code: quotation.itemCode,
                },
                select: {
                  UoMCode: true,
                  SmUCode: true,
                },
              });

              if (!item) {
                console.log(`Item '${quotation.itemCode}' not found`);
                return null;
              }

              (quotation as any).status = QuotationStatus.BRANCH_APPROVED;
              (quotation as any).creationStatus =
                QuotationCreationStatus.IMPORTED;
              if (!quotation.collectorId) quotation.collectorId = req.user!.id;

              const createdQuotation = await tx.quotation.create({
                data: {
                  questionnaireId: quotation.questionnaireId,
                  collectorId: req.user!.id,
                  itemCode: quotation!.itemCode,
                  marketplaceCode: quotation.marketplaceCode!,
                  quotes: {
                    createMany: {
                      data: quotation.quotes!.map((quote) => ({
                        ...quote,
                        shopContactName: "Imported",
                        shopContactPhone: "Imported",
                        shopLatitude: "Imputated",
                        shopLongitude: "Imputated",
                        measurementUnit: item.UoMCode,
                      })),
                    },
                  },
                  status: QuotationStatus.BRANCH_APPROVED,
                  creationStatus: QuotationCreationStatus.IMPORTED,
                },
                select: {
                  id: true,
                  questionnaireId: true,
                  itemCode: true,
                  quotes: true,
                },
              });

              console.log("CreatedQuotation: ", createdQuotation);
              fs.appendFileSync(
                "output.txt",
                `Quotation: ${util.inspect(createdQuotation, {
                  depth: null,
                })}\n`
              );
              fs.appendFileSync(
                "output.txt",
                `Quotation Quotes: ${util.inspect(createdQuotation!.quotes, {
                  depth: null,
                })}\n`
              )

              await Promise.all(
                createdQuotation.quotes!.map((quote: any) => {
                  // if (!quote || !quote.id) {
                  //   console.log("Skipping quote with missing or null ID");
                  //   return
                  // }

                  fs.appendFileSync(
                    "outputInside.txt",
                    `Quotation Quotes: ${util.inspect(quotation!.quotes, {
                      depth: null,
                    })}\n`
                  );

                  fs.appendFileSync(
                    "outputQuotes.txt",
                    `Quotes: ${util.inspect(
                      quotation.quotes!.map((quote: any) => quote.id),
                      { depth: null }
                    )}\n`
                  );

                  interpolatedQuotePromises.push(
                    tx.interpolatedQuote.create({
                      data: {
                        quoteId: quote.id,
                        quotationId: createdQuotation.id,
                        price: quote.price,
                        measurementUnit: item.SmUCode,
                        quantity: quote.quantity,
                      },
                    })
                  );

                  cleanedQuotePromises.push(
                    tx.cleanedQuote.create({
                      data: {
                        quoteId: quote.id,
                        quotationId: createdQuotation.id,
                        price: quote.price,
                        measurementUnit: item.SmUCode,
                        quantity: quote.quantity,
                        questionnaireId: createdQuotation.questionnaireId,
                        itemCode: createdQuotation.itemCode,
                      },
                    })
                  );
                })
              );

              return createdQuotation;
            } catch (error) {
              console.log("Error creating quotation: ", error);
              return null;
            }
          })
        );

        await Promise.all(interpolatedQuotePromises);
        await Promise.all(cleanedQuotePromises);

        await tx.questionnaireRegionStatus.update({
          where: {
            questionnaireId_regionCode: {
              questionnaireId: body.quotations[0].questionnaireId,
              regionCode: regionCode,
            },
          },
          data: {
            status: QuestionnaireQuotationsStatus.CLEANED,
          },
        });

        await tx.itemRegionalMean.createMany({
          data: body.geomeans.map((mean) => ({
            itemCode: mean.itemCode,
            variation: mean.variation,
            stdev: mean.stdev,
            geomean: mean.geomean,
            min: mean.min,
            max: mean.max,
            questionnaireId: mean.questionnaireId,
            regionCode,
          })),
        });

        return quotations.filter((quotation) => quotation !== null);
      });

      console.log("Quotations created: ", createMany);
      return res
        .status(httpStatusCodes.OK)
        .json(
          new ResponseJSON(
            "Quotations Created",
            false,
            httpStatusCodes.OK,
            createMany
          )
        );
    } catch (err) {
      console.log("Error: ", err);
      next(
        apiErrorHandler(
          err,
          req,
          errorMessages.INTERNAL_SERVER,
          httpStatusCodes.INTERNAL_SERVER
        )
      );
    }
  } the above function is used to import quotation data and it works well and creates quotations with quotes array as well but once it reaches the promise.all the quote.id is undefined  what is causing this issue because after createdQuotation login out the output shows the associated quoteids . And also since this is a transaction createdquotations are not yet saved to the database could that be the issue