includeRelations
Include relations specific fields or all fields depending on the input.
Usage
import { includeReferencesIDs, transformOutputArraysToIds } from '@ra-libs/nestjs'
@Injectable()
export class Service {
private relations = ["client", "seller.firstName"]
findAll(query: any) {
query = includeRelations(query, this.relations)
...
}
}
the includeRelations used above will return a JSON
{
...query,
include: {
"client": true,
"seller.select.firstName": true
}
}
Last updated