Closed kjh107704 closed 5 years ago
기존에 product table에서 creator랑 category등 jointable의 정보가 한꺼번에 검색이 안돼서
let product = await getConnection().getRepository(Product).findOne(options); const category = await getConnection().getRepository(Category) .findOne({where: {Cate_ID: product.categoryCateID}}); const creator = await getConnection().getRepository(Creator) .findOne({where: {CID: product.creatorCID}}); product = {...product, category, creator};
이렇게 처리했던 부분을
let products = await getConnection().getRepository(Product) .createQueryBuilder("product") .where("product.State = :state", {state: 1}) .leftJoinAndSelect("product.creator","creator") .leftJoinAndSelect("product.category","category") .leftJoinAndSelect("product.fils","file") .skip(start_index).take(page_size) .getMany();
이렇게 await 하나로 바꿀 수 있어요
기존에 product table에서 creator랑 category등 jointable의 정보가 한꺼번에 검색이 안돼서
이렇게 처리했던 부분을
이렇게 await 하나로 바꿀 수 있어요