Skip to content

Commit

Permalink
fix: fix one type error for publicationDate
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengShi-1 committed Dec 13, 2024
1 parent 2f65c6e commit c33fa3f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/files/infrastructure/FileJSDataverseRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ export class FileJSDataverseRepository implements FileRepository {
private static getAllDownloadCount(jsFiles: JSFile[]): Promise<number[]> {
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)
})
)
}
Expand All @@ -164,7 +161,7 @@ export class FileJSDataverseRepository implements FileRepository {
.then((jsFilePermissions) => JSFilePermissionsMapper.toFilePermissions(jsFilePermissions))
}

private static getDownloadCountById(id: number, publicationDate?: Date): Promise<number> {
private static getDownloadCountById(id: number, publicationDate?: string): Promise<number> {
return publicationDate !== undefined
? getFileDownloadCount.execute(id).then((downloadCount) => Number(downloadCount))
: Promise.resolve(0)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c33fa3f

Please sign in to comment.