Commit d359fede authored by Tamlyn Rhodes's avatar Tamlyn Rhodes

Apply query filter to new endpoints

parent 803cf111
Pipeline #2609 passed with stage
in 5 minutes 37 seconds
......@@ -172,7 +172,8 @@ api.get('/collections/:collectionId/fragments/:fragmentId/teams', authBearerAndP
// Get all fragments
api.get('/fragments', authBearerAndPublic, async (req, res, next) => {
try {
const fragments = await Fragment.all()
const fragments = (await Fragment.all())
.filter(createFilterFromQuery(req.query))
// Filter fragments and their properties
const propertyFilter = fieldSelector(req)
......@@ -294,11 +295,12 @@ api.delete('/fragments/:fragmentId', authBearer, async (req, res, next) => {
// Retrieve teams for a fragment
api.get('/fragments/:fragmentId/teams', authBearerAndPublic, async (req, res, next) => {
try {
let teams = await getTeams({
let teams = (await getTeams({
req: req,
Team: Team,
id: req.params.fragmentId,
type: 'fragment' })
type: 'fragment' }))
.filter(createFilterFromQuery(req.query))
res.status(STATUS.OK).json(teams)
} catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment