Workspace / Organizations
Last updated
Last updated
Shipped comes with support for Workspace / Organizations.
They are collections of users that you can use to let the users organize their teams.
For instance, if they are all part of the same company, i.e. "Acme Inc.", you can allow them to create an organization and invite other users to it, with specific roles (Owner, Admin, Member, Guest).
Use the component <CreateWorkspaceModal />
.
It is a modal with an input field.
The route POST /api/workspace
handles the workspace creation.
Use the component <AddWorkspaceMember />
.
It is a modal with email and role.
The route POST /api/workspace/invite
handles the workspace invitation.
It sends an email to the target email.
If the user doesn't have an account (never signed up) it is added to the table WorkspacePendingInvitation, otherwise to the table WorkspaceUsers. If a user is pending an invitation, when he or she signs up, the user is automatically moved from the WorkspacePendingInvitation table to the WorkspaceUsers one.
GET /api/workspace/[id]/invitations
— Get invitations to a workspace
DELETE /api/workspace/[id]/invitations
— Delete invitation to a workspace
GET /api/workspace/[id]/members
— Get members of a workspace
DELETE /api/workspace/[id]/members
— Delete member of a workspace
PUT /api/user/role
— Update the role of a member