Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map out API routes for workspaces - #173

Open
sigaloid opened this issue Apr 21, 2023 · 5 comments
Open

Map out API routes for workspaces - #173

sigaloid opened this issue Apr 21, 2023 · 5 comments

Comments

@sigaloid
Copy link
Collaborator

It might be helpful for backend to have like a list of possible fetches that anything worskpace related

for example, we probably need one endpoint to get all the queries in a given workspace

@sigaloid
Copy link
Collaborator Author

sigaloid commented Apr 21, 2023

  • GET */workspaces -> Return all workspaces
  • GET */workspaces/[id] -> Return workspace info (name, contents, users?)
  • POST */workspaces/[id]/add -> Send javascript array of result ID's, add to workspace.
  • POST */workspaces/[id]/remove -> Send javascript of result ID's, remove from workspace.
  • POST */workspaces/[id]/create -> Send javascript object with workspace name, password (?), etc. Create new workspace.
  • POST */workspaces/[id]/join -> Send password, add user to workspace
  • POST */workspaces/[id]/leave -> Send no content, remove user from workspace

Front end, please add on to this if necessary!

@ts2002
Copy link
Collaborator

ts2002 commented Apr 23, 2023

For rendering workspaces here is some of the information that would need to be passed back -> front for each individual workspace:

  1. ID. integer
  2. Owner. String
  3. Name. String
  4. Tags. List of strings?

We might want to talk about what exactly we want security looks like - what does it means when a user successfully joins a workspace?

@ts2002
Copy link
Collaborator

ts2002 commented Apr 24, 2023

For rendering individual workspaces, here is what is needed for each article:

  1. Article ID (int)
  2. Name (string)
  3. URL (string)

Just in general for frontend people, there is a set up for how this could be done on lines 118-135 in Results.jsx

@ts2002
Copy link
Collaborator

ts2002 commented Apr 24, 2023

The skeleton fetch requests in place right now (please feel free to add to this!)

Workspaces.jsx:

  1. getAllWorkspaces: Responsible for getting all workspaces a user can access -- theirs and others they have accessed.

Right now I have it passing in the user name of the current user in the header.
I am not sure if that would be needed.
Needs to return information detailed above.

  1. executeView: Responsible for someone trying to "log in" to a workspace with a workspace name and password.

Right now: I have it passing in the workspace name and password.

3.executeCreate: Responsible for sending information about a workspace someone is trying to create. Guaranteed through validation to always have a name and password set by the user.

Right now: I have it passing in the workspace name and password.

indvidualWorkspacePage.jsx: Responsible for getting the information about each articles in an individual workspace.

Right now I have it sending the workspace name and the user name (?) in the header.
Needs to return information detailed above.

Results.jsx:

  1. handleGetWorkspaces: responsible for getting the list of workspaces the user has (edit) access to.
  • not sure what to put for the header/authorization yet
  • is the json object the list or will it have an attribute workspaces that is the list (like queries, which also has an attribute count for the datagrid)?
  • the data returned is used for a dropdown
  1. handleAddtoWorkspace: responsible for adding the array of selected article ids to the selected workspace (workspace-id in the url)
  • not sure what to put for the header/authorization yet

Workspaces.jsx:

  1. handleGetWorkspaces: responsible for getting the list of workspaces the user has access to. (dupe functionality of getAllWorkspaces listed above)
  • assumes (like in queries) it receives a JSON with attributes "count" and "list of workspaces", sets the corresponding "RowCount" and "Workspaces" to be used by the DataGrid
  • not sure what to put for the header/authorization yet

@turtlu
Copy link
Collaborator

turtlu commented Apr 24, 2023

GET */workspaces -> Return all workspaces
Something I need to know is whether this returns JSONobj.workspaces (all workspaces) and JSONobj.count (number of workspaces) like in queries (count is used in the DataGrid), or is the JSONobj itself the array/list of all workspaces?

I don't think count is needed, so either way is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants