From 72f713d88c05439ef582d90434f5438885626665 Mon Sep 17 00:00:00 2001 From: MajedAlaitwniCap Date: Thu, 2 Nov 2023 10:59:56 +0100 Subject: [PATCH] added H5p File Response interface --- .../modules/h5p-editor/controller/dto/h5p-file.dto.ts | 9 +++++++++ .../service/temporary-file-storage.service.spec.ts | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/server/src/modules/h5p-editor/controller/dto/h5p-file.dto.ts b/apps/server/src/modules/h5p-editor/controller/dto/h5p-file.dto.ts index 979503b9511..abb83decc85 100644 --- a/apps/server/src/modules/h5p-editor/controller/dto/h5p-file.dto.ts +++ b/apps/server/src/modules/h5p-editor/controller/dto/h5p-file.dto.ts @@ -14,3 +14,12 @@ export class H5pFileDto implements File { mimeType: string; } + +export interface GetH5pFileResponse { + data: Readable; + etag?: string; + contentType?: string; + contentLength?: number; + contentRange?: string; + name: string; +} diff --git a/apps/server/src/modules/h5p-editor/service/temporary-file-storage.service.spec.ts b/apps/server/src/modules/h5p-editor/service/temporary-file-storage.service.spec.ts index c93c3c555b2..0dd11c1a309 100644 --- a/apps/server/src/modules/h5p-editor/service/temporary-file-storage.service.spec.ts +++ b/apps/server/src/modules/h5p-editor/service/temporary-file-storage.service.spec.ts @@ -3,9 +3,9 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { IUser } from '@lumieducation/h5p-server'; import { Test, TestingModule } from '@nestjs/testing'; import { File, S3ClientAdapter } from '@shared/infra/s3-client'; -import { GetFileResponse } from '@src/modules/files-storage/interface'; import { ReadStream } from 'fs'; import { Readable } from 'node:stream'; +import { GetH5pFileResponse } from '../controller/dto'; import { H5pEditorTempFile } from '../entity/base-entity-with-timestamp.entity'; import { H5P_CONTENT_S3_CONNECTION } from '../h5p-editor.config'; import { TemporaryFileRepo } from '../repo/temporary-file.repo'; @@ -187,7 +187,7 @@ describe('TemporaryFileStorage', () => { it('should return readable file stream', async () => { const { user1, file1 } = setup(); const actualContent = fileContent(user1.id, file1.filename); - const response: Required = { + const response: Required = { data: Readable.from(actualContent), etag: '', contentType: '',