Skip to content

Add groups resource #27

@biggujo

Description

@biggujo

Each group has tasks and users

Important notes:

  • if a user is not in /groups/:id/users, reject access to /groups/:id/tasks;
  • if a user is not in groups/:id/users, reject access to this route to the user;
  • other users cannot join other users (a user only can join/leave the group if he and only he wants to)

Model:

  • name of the group;
  • array of Users model;
  • array of tasks like in Tasks controller and Tasks model;
  • timestamps (created_at, updated_at)

Routes:

  • GET /groups – get all groups (array of groups);
  • POST /groups – create new group;
  • GET /groups/:id – get one group:

Schema of response of GET /groups/:id:

{
  "name": "string",
  "members": 123
}
  • PUT /groups/:id – update group

Accepted data to PUT /groups/:id:

{
"name": "string",
}

  • POST /groups/:groupid/users – add new user to the group (user joins). Works only if userid == current_user.id;

Accepted data to POST /groups/:groupid/users:

{
"id": 12345,
}

  • DELETE /groups/:groupid/users/:userid – remove a user from the group (user leaves). Works only if userid == current_user.id;

  • ALL /groups/:id/tasks – GET, POST, PUT like in tasks controller etc.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions