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 items = await Promise.all(
        body.quotations.map((quotation) =>
          prisma.item
            .findUnique({
              where: {
                code: quotation.itemCode,
              },
              select: {
                UoMCode: true,
                SmUCode: true,
              },
            })
            // .filter((item) => item)
            .catch(() => {
              throw new Error(`Item '${quotation.itemCode}' not found`);
            })
        )
      );

      // ); //filter out null items
      console.log("Items: ", items);

      const createMany = await prisma.$transaction(async (tx) => {
        const quotations = await Promise.all(
          body.quotations.map((quotation, index) => {
            if (!quotation.itemCode || !items[index]) return null; //skip if item code is not found
            (quotation as any).status = QuotationStatus.BRANCH_APPROVED;
            (quotation as any).creationStatus =
              QuotationCreationStatus.IMPORTED;
            if (!quotation.collectorId) quotation.collectorId = req.user!.id;
            return 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: items?.[index]!?.UoMCode,
                    })),
                  },
                  // quotation.quotes?.map((quote) => { return {...quote,quantity: items[index]?.measurementQuantity,
                  // measurmentId: items[index]?.measurement,};}),
                },
              },
              select: {
                id: true,
                questionnaireId: true,
                itemCode: true,
                quotes: true,
              },
            });
          })
        );

        await Promise.all(
          quotations.reduce((acc: any, quotation, index) => {
            if (!quotation) return acc; //skip if quotation is not found

            quotation.quotes.forEach((quote) => {
              if (!quote) return; //skip if quote is not found

              acc.push(
                tx.interpolatedQuote.create({
                  data: {
                    quoteId: quote.id,
                    quotationId: quotation.id,
                    price: quote.price,
                    measurementUnit: items[index]!.SmUCode,
                    quantity: quote.quantity,
                  },
                })
              );

              acc.push(
                tx.cleanedQuote.create({
                  data: {
                    quoteId: quote.id,
                    quotationId: quotation.id,
                    price: quote.price,
                    measurementUnit: items[index]!.SmUCode,
                    quantity: quote.quantity,
                    questionnaireId: quotation.questionnaireId,
                    itemCode: quotation.itemCode,
                  },
                })
              );
            });

            return acc;
          }, [])

          // quotations.reduce((acc: any, quotation, index) => {
          //   if (!quotation || !quotation.quotes[index]) return acc; //skip if quotation or quote is not found
          //   acc.push(
          //     tx.interpolatedQuote.create({
          //       data: {
          //         quoteId: quotation.quotes[index].id,
          //         quotationId: quotation.id,
          //         price: quotation.quotes[index].price,
          //         measurementUnit: items[index]!.SmUCode,
          //         quantity: quotation.quotes[index].quantity,
          //       },
          //     })
          //   );
          //   acc.push(
          //     tx.cleanedQuote.create({
          //       data: {
          //         quoteId: quotation.quotes[index].id,
          //         quotationId: quotation.id,
          //         price: quotation.quotes[index].price,
          //         measurementUnit: items[index]!.SmUCode,
          //         quantity: quotation.quotes[index].quantity,
          //         questionnaireId: quotation.questionnaireId,
          //         itemCode: quotation.itemCode,
          //       },
          //     })
          //   );
          //   return acc;
          // }, [])
        );

        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); //Filter out null/undefined quotations
      });

      console.log("Quotations created: ", createMany);
      return res
        .status(httpStatusCodes.OK)
        .json(
          new ResponseJSON(
            "Quotations Created",
            false,
            httpStatusCodes.OK,
            createMany
          )
        );
    } catch (err) {
      // console.log("Error message: ", );
      console.log("Error --- ", err);
      next(
        apiErrorHandler(
          err,
          req,
          errorMessages.INTERNAL_SERVER,
          httpStatusCodes.INTERNAL_SERVER
        )
      );
    }
  } based on the above fucntion add a prisma query to update the export const questionnaireQuotationsStatus = {
  PENDING: "PENDING",
  INTERPOLATED: "INTERPOLATED",
  CLEANED: "CLEANED",
}; status to QuestionnarieQuotationStatus.CLEANED with the following prisma schema model QuestionnaireRegionStatus {
  questionnaireId Int
  questionnaire   Questionnaire                 @relation(fields: [questionnaireId], references: [id], onDelete: Cascade)
  regionCode      Int
  region          Region                        @relation(fields: [regionCode], references: [code])
  status          QuestionnaireQuotationsStatus

  @@id([questionnaireId, regionCode])
} upon importing quoatations