-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BC-7165-Include tldraw to quick links
- Loading branch information
Artemida
authored and
Artemida
committed
Apr 29, 2024
1 parent
3bdee0f
commit a32b612
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { FeathersServiceProvider } from '@infra/feathers/feathers-service.provider'; | ||
import { LegacyLogger } from '@src/core/logger'; | ||
import { Injectable } from '@nestjs/common'; | ||
import { EntityId } from '@shared/domain/types'; | ||
|
||
export type TldrawResponse = { id: string; publicLink: string }; | ||
|
||
@Injectable() | ||
export class TldrawService { | ||
constructor(private readonly feathersServiceProvider: FeathersServiceProvider, private logger: LegacyLogger) {} | ||
|
||
async createTldraw( | ||
userId: EntityId, | ||
title: string, | ||
): Promise<{ board: string; url: string } | false> { | ||
const data = { | ||
title, | ||
}; | ||
try { | ||
const service = this.feathersServiceProvider.getService('/tldraw/roomName'); | ||
const tldraw = (await service.create(data, { account: { userId } })) as TldrawResponse; | ||
return { board: tldraw.id, url: tldraw.publicLink }; | ||
} catch (error) { | ||
this.logger.error('Could not create new Tldraw', error); | ||
return false; | ||
} | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters