I need help in restricting the related data when querying using query builder. Here is the code I have for fetching employee orders:
import { getRepository, Repository } from "typeorm";
public async findEmployeeQuery(id : number) {
try {
let query = await getRepository(Employees)
.createQueryBuilder('employee')
.where('employee.id = :id' , {id})
.leftJoinAndSelect('employee.customers' , 'customers')
.getOne()
const user = query
return user
} catch (error) {
throw error
}
}
Now I want to control the number of customers returned for each request - is there a way to do that?
I experimented with the limit and skip options, but they only seem to work for the employee entity and not for the related data.