1.0.3 • Published 6 years ago

adonis-workspaces v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Workspaces (Adonis 4.* Package)

A simple user and workspace management package for the adonis framework

Installation

adonis install adonis-workspaces

Checkout instructions.md for setup instructions

Usage

Add this in your controller.

const Workspaces = use('Workspaces')

Create a workspace.

const user = auth.user
await Workspaces.createWorkspace('My Creative Workspace', user)

Join the workspace. Creator of workspace will be joined automatically.

const user = auth.user
const workspace = await Workspace.find(id)
await Workspaces.joinWorkspace(workspace, user)

Invite others to the workspace.

const workspace = await Workspace.find(id)
const inviteFrom = await User.find(auth.user.id)
const inviteTo = await User.query().where('email', 'adam@example.com').first()

await Workspaces.inviteToWorkspace(workspace, inviteTo, inviteFrom)

Accept Invitation.

const invite = await Workspaces.getInviteFromAcceptToken(accept_token)
await Workspaces.acceptInvite(invite)

Deny Invitation.

const invite = await Workspaces.getInviteFromDenyToken(deny_token)
await Workspaces.denyInvite(invite)

Check in to a workspace. Check in to make workspace 'current workspace'.

await Workspaces.checkIntoWorkspace(workspace, user)

Check out from a workspace.

await Workspaces.checkOutFromWorkspace(workspace, user)

Leave a workspace.

await Workspaces.leaveWorkspace(workspace, user)

Delete a workspace. Only owner of workspace is allowed to do so.

await Workspaces.deleteWorkspace(workspace, user)

Other methods

await Workspaces.isOwnerOfWorkspace(workspace, user)
await Workspaces.getCurrentWorkspace(user)
await Workspaces.getWorkspaceOwner(workspace)
await Workspaces.getWorkspaces(user)
await Workspaces.hasPendingInvite(user, workspace)
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago