Added optional filtering by provider
This commit is contained in:
parent
f7eae96b8c
commit
0945060a49
|
@ -285,6 +285,11 @@ fastify.after(() => {
|
||||||
|
|
||||||
//Get all visits api route
|
//Get all visits api route
|
||||||
fastify.get('/api/visits', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
|
fastify.get('/api/visits', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
|
||||||
|
if(req.query.provider){
|
||||||
|
return await knex.select('shortcode', 'provider', 'timestamp')
|
||||||
|
.from('visits')
|
||||||
|
.where("provider", "=", req.query.provider);
|
||||||
|
}
|
||||||
return await knex.select('shortcode', 'provider', 'timestamp')
|
return await knex.select('shortcode', 'provider', 'timestamp')
|
||||||
.from('visits');
|
.from('visits');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue