nestjs-paginate
nestjs-paginate copied to clipboard
How to use nestjs-paginate with limiting the query fields results?
is there a way to defind /cats?fields=field1,field2 etc? ats the movement even using some custom solution?
E.g. provide also somehow FindOneOptions options when calling
paginate(query, this.repository, config);
Doesn't currently exist for repositories. You could use QueryBuilder
as a workaround.
But..
Allowing query to pass fields onto FindOptions
would probably be an easy and straightforward solution.
Helper config:
paginate(query, this.usersRepository, {
sortableColumns: ['id', 'username', 'email', 'created'],
select: ['id', 'username', 'email', 'firstName', 'lastName', 'created']
})
Select may acts as a whitelist for the query string here as well.
Query string:
/users?select=email,created
PK might be always selected.
Happy to accept PR :)