From c33fa3fd4224d9dd96ea23b346991983ffe01870 Mon Sep 17 00:00:00 2001 From: Cheng Shi Date: Fri, 13 Dec 2024 17:26:33 -0500 Subject: [PATCH] fix: fix one type error for publicationDate --- .../infrastructure/FileJSDataverseRepository.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/files/infrastructure/FileJSDataverseRepository.ts b/src/files/infrastructure/FileJSDataverseRepository.ts index d88e2bb2e..caf238d5b 100644 --- a/src/files/infrastructure/FileJSDataverseRepository.ts +++ b/src/files/infrastructure/FileJSDataverseRepository.ts @@ -147,10 +147,7 @@ export class FileJSDataverseRepository implements FileRepository { private static getAllDownloadCount(jsFiles: JSFile[]): Promise { return Promise.all( jsFiles.map((jsFile) => { - return FileJSDataverseRepository.getDownloadCountById( - jsFile.id, - jsFile.publicationDate ? new Date(jsFile.publicationDate) : new Date() - ) + return FileJSDataverseRepository.getDownloadCountById(jsFile.id, jsFile.publicationDate) }) ) } @@ -164,7 +161,7 @@ export class FileJSDataverseRepository implements FileRepository { .then((jsFilePermissions) => JSFilePermissionsMapper.toFilePermissions(jsFilePermissions)) } - private static getDownloadCountById(id: number, publicationDate?: Date): Promise { + private static getDownloadCountById(id: number, publicationDate?: string): Promise { return publicationDate !== undefined ? getFileDownloadCount.execute(id).then((downloadCount) => Number(downloadCount)) : Promise.resolve(0) @@ -237,10 +234,7 @@ export class FileJSDataverseRepository implements FileRepository { jsDataset, getDatasetCitation.execute(jsDataset.id, datasetVersionNumber, includeDeaccessioned), FileJSDataverseRepository.getCitationById(jsFile.id), - FileJSDataverseRepository.getDownloadCountById( - jsFile.id, - jsFile.publicationDate ? new Date(jsFile.publicationDate) : new Date() - ), + FileJSDataverseRepository.getDownloadCountById(jsFile.id, jsFile.publicationDate), FileJSDataverseRepository.getPermissionsById(jsFile.id), FileJSDataverseRepository.getThumbnailById(jsFile.id), FileJSDataverseRepository.getTabularDataById(jsFile.id, jsFile.tabularData)