I have created a get api in which i want to apply search through name in query param. that is if we don't enter query param in same api it displays full list and if we enter any query param then it will show that result only. How can i do it??? Here is my loopback4 code
@get('/zones', {
responses: {
'200': {
description: 'Array of Zone model instances',
content: {
'application/json': {
schema: {
type: 'array',
items: getModelSchemaRef(Zone, { includeRelations: true }),
},
},
},
},
},
})
async find(
//@param.path.string('name') name: String,
@param.query.object('filter', getFilterSchemaFor(Zone)) filter?: Filter<Zone>,
): Promise<Zone[]> {
return this.zoneRepository.find({ include: [{ relation: 'cameras' }] });
}