feat(api): add inviting to workspace

This commit is contained in:
Karol Sójko
2022-10-10 11:57:44 +02:00
parent a275a45753
commit 158ca6ac6a
15 changed files with 165 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import { WorkspaceApiServiceInterface } from '@standardnotes/api'
import { WorkspaceType } from '@standardnotes/common'
import { Uuid, WorkspaceType } from '@standardnotes/common'
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
import { AbstractService } from '../Service/AbstractService'
@@ -13,6 +13,20 @@ export class WorkspaceManager extends AbstractService implements WorkspaceClient
super(internalEventBus)
}
async inviteToWorkspace(dto: { inviteeEmail: string; workspaceUuid: Uuid }): Promise<{ uuid: string } | null> {
try {
const result = await this.workspaceApiService.inviteToWorkspace(dto)
if (result.data.error !== undefined) {
return null
}
return result.data
} catch (error) {
return null
}
}
async createWorkspace(dto: {
workspaceType: WorkspaceType,
encryptedWorkspaceKey?: string