Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

199
Vistas
synchronous function returning Promise { <pending> } instead of a value in typeORM transaction

I am using Typeform to store value multiple tables in my DB. But after saving my value it's the return Promise { } instead of a value. This is my function. I follow the most similar question link in StackOverflow to understand my problem. But non of that methods is not working for me...I really need your help. Thank you very much.

 async create(orderData: CreateOrderDto): Promise<any> {
    const orderModel: {
      created_date: Date;
      status: string;
      customer: Customer;
    } = {
      status: orderData.status,
      created_date: orderData.created_date,
      customer: orderData.customer,
    };

    try {
      await this.entityManager.transaction(
        async (entityManager: EntityManager) => {
          const order = await entityManager
            .getRepository(Order)
            .save(orderModel);
          if (order) {
            orderData.order_details.map(async (item) => {
              await entityManager
                .getRepository(OrderHasItem)
                .save({
                  order_id: order.id,
                  item_id: item.item_id,
                  unit_price: item.unit_price,
                  qty: item.qty,
                })
                .then((item) => {
                  console.log('item', item);
                  return item;
                });
            });
          }
        },
      );
    } catch (error) {
      console.log(error);
      throw new BadRequestException('There is an error');
    }
  }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda