ChildMindInstitute / MindLogger-bug-reports

GitHub repository for bug tracking and feature requesting for the MindLogger project
Other
0 stars 1 forks source link

🚜⬆️ Update / overhaul the "users" screen of mindlogger-admin #48

Closed shnizzedy closed 3 years ago

shnizzedy commented 4 years ago

current "users" screen

We need to replace the above (current "users" screen) of mindlogger-admin with an interface that works with the updated user model (Girder for MindLogger v0.6).

Most relevant routes (I think):

User List

Get user list: GET /applet/{id}/users

Returns an Object with active user profiles and pending invitations. Sample response:

{
  "active": [
    {
      "_id": "5dd706cb28d2dcdc5bf64ba7",
      "displayName": "Jon",
      "email": "jon.clucas@childmind.org"
    },
    {
      "_id": "5dd70cd90f2c1c65de7ee345",
      "displayName": "Bart",
      "idCodes": [
        "Bart"
      ]
    },
    {
      "_id": "5dd70cba0f2c1c65de7ee344",
      "displayName": "Homer",
      "idCode": "Homer",
      "invitedBy": {
        "_id": "5dd70cb90f2c1c65de7ee343",
        "displayName": "Jon",
        "email": "jon.clucas@childmind.org"
      },
      "schema:knows": {
        "rel:parentOf": [
          "5dd70cd90f2c1c65de7ee345"
        ]
      }
    }
  ],
  "pending": [
    {
      "_id": "5dd7f9c7f0e054fd5dc3d950",
      "displayName": "Thom",
      "idCode": "11525",
      "invitedBy": {
        "_id": "5dd7f9c7f0e054fd5dc3d94f",
        "displayName": "Jon",
        "email": "jon.clucas@childmind.org"
      }
    }
  ]
}

Invitations

Create invitation: POST /applet/{id}/invite

Sample response:

{
  "_id": "5dd7f9c7f0e054fd5dc3d950",
  "displayName": "Thom",
  "invitedBy": {
    "_id": "5dd7f9c7f0e054fd5dc3d94f",
    "displayName": "Jon",
    "email": "jon.clucas@childmind.org"
  }
}

Link to Invitation: https://web.mindlogger.org/#/invitation/{id}

Delete invitation: DELETE /invitation/{id}

Relationships

Get defined relationships: GET /relationship

Returns an Object of relationship definitions. The keys of this object are the properties to use as keys in encoding these relationships. rel:parentOf and schema:children (which are interchangeable) are the only relationships that are currently planned on having any practical effect in the near term.

Add a relationship: PUT /user/{id}/knows

id and otherId can be profile IDs, invitation IDs or ID codes. If otherId does not already exist, it will be created. Sample response to call PUT /user/5dd70cba0f2c1c65de7ee344/knows?rel=rel%3AparentOf&otherId=2&otherName=Lisa:

{
  "_id": "5dd70cba0f2c1c65de7ee344",
  "displayName": "Homer",
  "idCode": "Homer",
  "schema:knows": {
    "rel:parentOf": [
      "5dd70cd90f2c1c65de7ee345",
      "5dd7fcbaf0e054fd5dc3d951"
    ]
  }
}

ID Codes

Include an ID code in an invitation: param idCode in POST /applet/{id}/invite

Add an ID Code to an existing user: PUT /user/{id}/code

Sample response to call PUT /user/5dd709172dfca1daa8a965c2/code?code=R5r:

{
  "_id": "5dd709172dfca1daa8a965c2",
  "displayName": "Maggie",
  "idCodes": [
    "R5r"
  ]
}
shnizzedy commented 4 years ago

I don't think any of the current design of that screen needs to be preserved…

shnizzedy commented 4 years ago

Blocked by https://github.com/ChildMindInstitute/mindlogger-app-backend/issues/245

henryrossiter commented 4 years ago

This is mostly finished- the setUser screen is updated to match the current user model and invitations with invitation links are working.

We have not added the relationship functionality or the custom id code functionality yet though.