CenterForDigitalHumanities / TPEN-services

Services required by TPEN interfaces in order to interact with data
1 stars 0 forks source link

getUserProjects(options) #69

Open cubap opened 6 months ago

cubap commented 6 months ago

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