I am wondering, how can I build a request which filters my result level by level. I have controller which looks like this:
@Get('/filter/:column/:value')
public getDragonfliesByColumn(
@Param('column') column: string,
@Param('value') value: string,
) {
return this.service.getDragonfliesByColumn(column, value);
}
My service looks like:
public getDragonfliesByColumn(column: string, columnValue: string):
Promise<Dragonflies[]> {
return Dragonflies.findBy({[column]: columnValue});
}
If I select couple of filters, or sorting and filtering on frontend, how should it look like on backend? I try to make all the data operations on server, to receive the complete data on frontend to just visualize. What is the best method to combine filters and sort requests? Should it be achieved in one request or handled in sequence? If so, how can I develop a sequence of filters/sorts on backend in nestjs?
I will be grateful for any advices or tips, because I am just on beginning and I am trying to learn best practices to help me in the future. Thank you in advance!