Implement an authenticated endpoint (GET /projects) for a logged in user to get their own list of projects. The endpoint will get the agent from the bearer token and use that id as the lookup, returning an unexpanded list of projects, offering only (at this time) project ID and Title.
This is a GET, but for more sophisticated uses, a query string can manipulate the default options:
parameter
default
description
isPublic
undefined
true to include only public projects; false to exclude public projects. (TODO: open GET /publicProjects)
hasRoles[]
ALL
limit based on the group membership for projects. If used multiple times, matching ANY includes it in the return
exceptRoles[]
NONE
remove projects from the returned list based on group membership. Can be used multiple times. Overrules inclusion from hasRoles[]
createdBefore
NOW
only include projects with a creation date not before the UNIX seconds value. Combine with createdAfter for a single range.
modifiedBefore
NOW
only include projects modified (by anyone) before the UNIX seconds value. Combine with modifiedAfter for a single range. Overruled by created-x filters.
createdAfter
0
inverts createdBefore
modifiedAfter
0
inverts modifiedBefore
hasCollaborators
undefined
true for group sizes >1; false for group sizes >1
tags[]
undefined
may be multiple to match any exact tag (case insensitive) on the project.
fields[]
[id, title]
The returned array will include these listed fields on each entry, adding a value of undefined if the property is not present.
count
false
Only return an integer of the length of the list that would have been returned with all other filters applied. Invalidates fields[]
Interfaces
Many Interfaces will use a version of this and it can get expensive to call, so leave room for the caching of this list in TPEN Static. In this way, starting a new project would push up to that list and may avoid making the call into MongoDB. However, any custom filter requests would need to be applied. If we create the need for many vanilla options, we can include more cached options.
Notes
These are authenticated so the long and messy GETs are not a big deal and make logging more helpful.
The "[]" on some parameters is not a standard, but a widely used convention that will likely work well with the NodeJS/Express used now and whatever may be implemented in the future for unambiguous unordered parameter arrays.
This method and the shape of a Project may not coevolve smoothly, so missing parameters and close spellings may need to be handled on a case-by-case basis. In general, we shouldn't get Errors from this except for malformed URLs, Unauthenticated.
No matches returns an empty array. One match returns one Project object in an array.
We may consider paging in the future, possibly compulsory if things go nuts.
Implement an authenticated endpoint (GET /projects) for a logged in user to get their own list of projects. The endpoint will get the agent from the bearer token and use that id as the lookup, returning an unexpanded list of projects, offering only (at this time) project ID and Title.
This is a GET, but for more sophisticated uses, a query string can manipulate the default options:
hasRoles[]
createdAfter
for a single range.modifiedAfter
for a single range. Overruled bycreated-x
filters.createdBefore
modifiedBefore
undefined
if the property is not present.fields[]
Interfaces
Many Interfaces will use a version of this and it can get expensive to call, so leave room for the caching of this list in TPEN Static. In this way, starting a new project would push up to that list and may avoid making the call into MongoDB. However, any custom filter requests would need to be applied. If we create the need for many vanilla options, we can include more cached options.
Notes