Skip to content

Instantly share code, notes, and snippets.

@mariusa
Last active Aug 13, 2021
Embed
What would you like to do?
NodeX code sample: Back-end API for reading users list in Manage staff
fastify.addHook('onRequest', uti.checkAuth({ permissions: ['Admin'] }))
fastify.get('/', async (req, reply) => {
let where = uti.queryModelWhere(req.query, dbm['staff']) // set filters from query string
where.orgId = req.user.orgId
let recs = await dbm.findAll('staff', {
where: where
})
return recs
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment