How to translate an SQL statement to TypeORM query builder? How to translate an SQL statement to TypeORM query builder? database database

How to translate an SQL statement to TypeORM query builder?


I figured it out.

await getManager()    .createQueryBuilder(Item, 'item')    .select(['item.id', 'item.name'])    .innerJoin('item.location', 'location')    .where('location.id = :id', { id: queryObject.filter });


Let me know if below is what you are looking for.

const item = await getManager().createQueryBuilder(Item, "item").innerJoinAndSelect("item.item_location", "item_location", "item_location.locationId = :queryfilter", { queryfilter: queryObject.filter}).select("item.name, item.id").getMany();