Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!