diff --git a/apps/server/src/modules/board/board-collaboration.config.ts b/apps/server/src/modules/board/board-collaboration.config.ts index 5a74844d2af..e824b4ca867 100644 --- a/apps/server/src/modules/board/board-collaboration.config.ts +++ b/apps/server/src/modules/board/board-collaboration.config.ts @@ -1,6 +1,7 @@ import { Configuration } from '@hpi-schul-cloud/commons'; import { JwtAuthGuardConfig } from '@infra/auth-guard'; import { Algorithm } from 'jsonwebtoken'; +import { getTldrawClientConfig } from '../tldraw-client'; export interface BoardCollaborationConfig extends JwtAuthGuardConfig { NEST_LOG_LEVEL: string; @@ -13,6 +14,7 @@ const boardCollaborationConfig: BoardCollaborationConfig = { JWT_PUBLIC_KEY: (Configuration.get('JWT_PUBLIC_KEY') as string).replace(/\\n/g, '\n'), JWT_SIGNING_ALGORITHM: Configuration.get('JWT_SIGNING_ALGORITHM') as Algorithm, SC_DOMAIN: Configuration.get('SC_DOMAIN') as string, + ...getTldrawClientConfig(), }; export const config = () => boardCollaborationConfig; diff --git a/apps/server/src/modules/tldraw-client/interface/tldraw-client-config.interface.ts b/apps/server/src/modules/tldraw-client/interface/tldraw-client-config.interface.ts index 22b6cb2ac8c..40564ab2e81 100644 --- a/apps/server/src/modules/tldraw-client/interface/tldraw-client-config.interface.ts +++ b/apps/server/src/modules/tldraw-client/interface/tldraw-client-config.interface.ts @@ -1,5 +1,4 @@ export interface TldrawClientConfig { TLDRAW_ADMIN_API_CLIENT_BASE_URL: string; TLDRAW_ADMIN_API_CLIENT_API_KEY: string; - WITH_TLDRAW2: boolean; } diff --git a/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.spec.ts b/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.spec.ts index 4867778f515..634d6485bbb 100644 --- a/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.spec.ts +++ b/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.spec.ts @@ -49,14 +49,12 @@ describe(DrawingElementAdapterService.name, () => { }); describe('deleteDrawingBinData', () => { - describe('when WITH_TLDRAW2 env var is true', () => { + describe('when deleteDrawingBinData is called', () => { const setup = () => { const apiKey = 'a4a20e6a-8036-4603-aba6-378006fedce2'; const baseUrl = 'http://localhost:3349'; - const WITH_TLDRAW2 = true; configService.get.mockReturnValueOnce(baseUrl); - configService.get.mockReturnValueOnce(WITH_TLDRAW2); configService.get.mockReturnValueOnce(apiKey); httpService.delete.mockReturnValue( of( @@ -81,37 +79,5 @@ describe(DrawingElementAdapterService.name, () => { }); }); }); - - describe('when WITH_TLDRAW2 env var is false', () => { - const setup = () => { - const apiKey = 'a4a20e6a-8036-4603-aba6-378006fedce2'; - const baseUrl = 'http://localhost:3349'; - const WITH_TLDRAW2 = false; - configService.get.mockReturnValueOnce(baseUrl); - configService.get.mockReturnValueOnce(WITH_TLDRAW2); - configService.get.mockReturnValueOnce(apiKey); - httpService.delete.mockReturnValue( - of( - axiosResponseFactory.build({ - data: '', - status: HttpStatus.OK, - statusText: 'OK', - }) - ) - ); - - return { apiKey, baseUrl }; - }; - - it('should call axios delete method', async () => { - const { apiKey, baseUrl } = setup(); - - await service.deleteDrawingBinData('test'); - - expect(httpService.delete).toHaveBeenCalledWith(`${baseUrl}/api/v3/tldraw-document/test`, { - headers: { 'X-Api-Key': apiKey, Accept: 'Application/json' }, - }); - }); - }); }); }); diff --git a/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.ts b/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.ts index 7b98fdaa144..baa16703a94 100644 --- a/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.ts +++ b/apps/server/src/modules/tldraw-client/service/drawing-element-adapter.service.ts @@ -17,8 +17,7 @@ export class DrawingElementAdapterService { async deleteDrawingBinData(parentId: string): Promise { const baseUrl = this.configService.get('TLDRAW_ADMIN_API_CLIENT_BASE_URL'); - const isTlDraw2 = this.configService.get('WITH_TLDRAW2'); - const endpointUrl = isTlDraw2 ? '/api/tldraw-document' : '/api/v3/tldraw-document'; + const endpointUrl = '/api/tldraw-document'; const tldrawDocumentEndpoint = new URL(endpointUrl, baseUrl).toString(); await firstValueFrom(this.httpService.delete(`${tldrawDocumentEndpoint}/${parentId}`, this.defaultHeaders())); diff --git a/apps/server/src/modules/tldraw-client/tldraw-client.config.spec.ts b/apps/server/src/modules/tldraw-client/tldraw-client.config.spec.ts index b3f7f4b2051..240a34ae7fc 100644 --- a/apps/server/src/modules/tldraw-client/tldraw-client.config.spec.ts +++ b/apps/server/src/modules/tldraw-client/tldraw-client.config.spec.ts @@ -20,12 +20,10 @@ describe(getTldrawClientConfig.name, () => { Configuration.set('TLDRAW_ADMIN_API_CLIENT__BASE_URL', baseUrl); Configuration.set('TLDRAW_ADMIN_API_CLIENT__API_KEY', apiKey); - Configuration.set('WITH_TLDRAW2', true); const expectedConfig = { TLDRAW_ADMIN_API_CLIENT_BASE_URL: baseUrl, TLDRAW_ADMIN_API_CLIENT_API_KEY: apiKey, - WITH_TLDRAW2: true, }; return { expectedConfig }; diff --git a/apps/server/src/modules/tldraw-client/tldraw-client.config.ts b/apps/server/src/modules/tldraw-client/tldraw-client.config.ts index 0f308fad4ec..b778408b0c9 100644 --- a/apps/server/src/modules/tldraw-client/tldraw-client.config.ts +++ b/apps/server/src/modules/tldraw-client/tldraw-client.config.ts @@ -5,6 +5,5 @@ export const getTldrawClientConfig = (): TldrawClientConfig => { return { TLDRAW_ADMIN_API_CLIENT_BASE_URL: Configuration.get('TLDRAW_ADMIN_API_CLIENT__BASE_URL') as string, TLDRAW_ADMIN_API_CLIENT_API_KEY: Configuration.get('TLDRAW_ADMIN_API_CLIENT__API_KEY') as string, - WITH_TLDRAW2: Configuration.get('WITH_TLDRAW2') as boolean, }; }; diff --git a/config/default.schema.json b/config/default.schema.json index 00afd8e6a69..14cb3e99a1c 100644 --- a/config/default.schema.json +++ b/config/default.schema.json @@ -1648,11 +1648,6 @@ "default": "http://localhost:3349", "description": "Address for tldraw management app" }, - "WITH_TLDRAW2": { - "type": "boolean", - "default": false, - "description": "Enables tldraw2 feature" - }, "SCHULCONNEX_CLIENT": { "type": "object", "description": "Configuration of the schulcloud's schulconnex client.",