diff --git a/package-lock.json b/package-lock.json index 65606b5..3dd33be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "file-service", - "version": "0.0.4", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "file-service", - "version": "0.0.4", + "version": "0.1.0", "license": "EUPL-1.2", "dependencies": { "@fastify/cookie": "^9.3.1", diff --git a/package.json b/package.json index 87c7191..e3f1bde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "file-service", - "version": "0.0.4", + "version": "0.1.0", "description": "A file serving microservice for the Alkemio platform", "main": "main.ts", "scripts": { diff --git a/src/services/file-reader/file.service.ts b/src/services/file-reader/file.service.ts index 47fe030..8037e36 100644 --- a/src/services/file-reader/file.service.ts +++ b/src/services/file-reader/file.service.ts @@ -5,11 +5,20 @@ import { Readable } from 'stream'; import { ConfigService } from '@nestjs/config'; import { ConfigType } from '../../config'; import { pathResolve } from '../../core/utils/files'; -import { Inject, Injectable, LoggerService, StreamableFile } from '@nestjs/common'; +import { + Inject, + Injectable, + LoggerService, + StreamableFile, +} from '@nestjs/common'; import { FileAdapterService } from './file.adapter.service'; import { FileInfoInputData } from './inputs'; import { FileInfoOutputData, isFileInfoOutputWithErrorData } from './outputs'; -import { FileInfoException, FileReadException, LocalStorageReadFailedException } from './exceptions'; +import { + FileInfoException, + FileReadException, + LocalStorageReadFailedException, +} from './exceptions'; import { DocumentData } from './types'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; @@ -38,14 +47,12 @@ export class FileService { auth: { cookie?: string; authorization?: string; - apiToken?: string; }, ): Promise { - const cookie = auth.cookie; - const apiToken = auth?.apiToken ?? auth?.authorization?.split(' ')?.[1]; + const { cookie, authorization } = auth; return this.adapter.fileInfo( - new FileInfoInputData(docId, { cookie, apiToken }), + new FileInfoInputData(docId, { cookie, authorization }), ); } @@ -62,7 +69,6 @@ export class FileService { auth: { cookie?: string; authorization?: string; - apiToken?: string; }, ): Promise { const { data } = await this.fileInfo(docId, auth); diff --git a/src/services/file-reader/inputs/file.info.input.data.ts b/src/services/file-reader/inputs/file.info.input.data.ts index a2445d4..069bef0 100644 --- a/src/services/file-reader/inputs/file.info.input.data.ts +++ b/src/services/file-reader/inputs/file.info.input.data.ts @@ -5,7 +5,7 @@ export class FileInfoInputData extends BaseInputData { public docId: string, public auth: { cookie?: string; - apiToken?: string; + authorization?: string; }, ) { super('file-info-input');