I'm at a loss for words. Project A shows the below code to retrieve a list of businesses.
async readAccountAll(accountID: string, req: Request, res: Response) {
// find the user by email
const user = await this.accountRepository.findOne({
where: {
id: accountID,
isActive: true
},
relations: {
businessList: true
}
});
// if user does not exist throw exception
if (!user) throw new ForbiddenException('Unable to find user.');
return user.businessList;
}
Project B, is a clone of Project A, and has been retooled for a product entity. I've also added a console.log to get the user data.
async readAccountAll(accountID: string, req: Request, res: Response) {
// find the account by id
const user = await this.accountRepository.findOne({
where: {
id: accountID,
isActive: true
},
relations: {
productList: true
}
});
console.log('readAccountAll-user\n', user);
// if user does not exist throw exception
if (!user) throw new ForbiddenException('Unable to find user.');
return user.productList;
}