Skip to content

Commit f31af9c

Browse files
committed
Revert "feat: use case for dataset download count"
This reverts commit 20f759c.
1 parent 20f759c commit f31af9c

File tree

8 files changed

+1
-227
lines changed

8 files changed

+1
-227
lines changed

docs/useCases.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -807,29 +807,6 @@ The `version` parameter should be a string or a [DatasetNotNumberedVersion](../s
807807

808808
You cannot deaccession a dataset more than once. If you call this endpoint twice for the same dataset version, you will get a not found error on the second call, since the dataset you are looking for will no longer be published since it is already deaccessioned.
809809

810-
#### Get Download Count of a Dataset
811-
812-
Total number of downloads requested for a dataset, given a dataset numeric identifier,
813-
814-
##### Example call:
815-
816-
```typescript
817-
import { getDatasetDownloadCount } from '@iqss/dataverse-client-javascript'
818-
819-
/* ... */
820-
821-
const datasetId = 1
822-
const includeMDC = true
823-
824-
getDatasetDownloadCount.execute(datasetId, includeMDC)
825-
826-
/* ... */
827-
```
828-
829-
_See [use case](../src/datasets/domain/useCases/GetDatasetDownloadCount.ts) implementation_.
830-
The `datasetId` parameter is a number for numeric identifiers.
831-
The `includeMDC` parameter is optional. If MDC is enabled the count will be limited to the time before MDC start if the optional `includeMDC` parameter is not included or set to False. Setting `includeMDC` to True will ignore the `:MDCStartDate` setting and return a total count.
832-
833810
## Files
834811

835812
### Files read use cases

src/datasets/domain/repositories/IDatasetsRepository.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,4 @@ export interface IDatasetsRepository {
5151
datasetVersionId: string,
5252
deaccessionDTO: DatasetDeaccessionDTO
5353
): Promise<void>
54-
getDatasetDownloadCount(datasetId: number, includeMDC?: boolean): Promise<number>
5554
}

src/datasets/domain/useCases/GetDatasetDownloadCount.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/datasets/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { PublishDataset } from './domain/useCases/PublishDataset'
1717
import { UpdateDataset } from './domain/useCases/UpdateDataset'
1818
import { GetDatasetVersionDiff } from './domain/useCases/GetDatasetVersionDiff'
1919
import { DeaccessionDataset } from './domain/useCases/DeaccessionDataset'
20-
import { GetDatasetDownloadCount } from './domain/useCases/GetDatasetDownloadCount'
2120

2221
const datasetsRepository = new DatasetsRepository()
2322

@@ -49,7 +48,6 @@ const updateDataset = new UpdateDataset(
4948
datasetResourceValidator
5049
)
5150
const deaccessionDataset = new DeaccessionDataset(datasetsRepository)
52-
const getDatasetDownloadCount = new GetDatasetDownloadCount(datasetsRepository)
5351

5452
export {
5553
getDataset,
@@ -64,8 +62,7 @@ export {
6462
publishDataset,
6563
createDataset,
6664
updateDataset,
67-
deaccessionDataset,
68-
getDatasetDownloadCount
65+
deaccessionDataset
6966
}
7067
export { DatasetNotNumberedVersion } from './domain/models/DatasetNotNumberedVersion'
7168
export { DatasetUserPermissions } from './domain/models/DatasetUserPermissions'

src/datasets/infra/repositories/DatasetsRepository.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,4 @@ export class DatasetsRepository extends ApiRepository implements IDatasetsReposi
235235
throw error
236236
})
237237
}
238-
239-
public async getDatasetDownloadCount(datasetId: number, includeMDC?: boolean): Promise<number> {
240-
const queryParams = includeMDC !== undefined ? { includeMDC } : {}
241-
242-
return this.doGet(
243-
this.buildApiEndpoint(this.datasetsResourceName, `${datasetId}/download/count`),
244-
true,
245-
queryParams
246-
)
247-
.then((response) => response.data.downloadCount)
248-
.catch((error) => {
249-
throw error
250-
})
251-
}
252238
}

test/functional/datasets/GetDatasetDownloadCount.test.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

test/integration/datasets/DatasetsRepository.test.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -925,41 +925,4 @@ describe('DatasetsRepository', () => {
925925
).rejects.toBeInstanceOf(WriteError)
926926
})
927927
})
928-
929-
describe('getDatasetDownloadCount', () => {
930-
test('should return download count for a dataset', async () => {
931-
const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO)
932-
const fileMetadata = {
933-
description: 'test description',
934-
directoryLabel: 'directoryLabel',
935-
categories: ['category1', 'category2']
936-
}
937-
await uploadFileViaApi(testDatasetIds.numericId, testTextFile1Name, fileMetadata)
938-
await publishDatasetViaApi(testDatasetIds.numericId)
939-
await waitForNoLocks(testDatasetIds.numericId, 10)
940-
const actual = await sut.getDatasetDownloadCount(testDatasetIds.numericId)
941-
942-
expect(actual).toBe(0)
943-
944-
await deletePublishedDatasetViaApi(testDatasetIds.persistentId)
945-
})
946-
947-
test('should return download count including MDC data', async () => {
948-
const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO)
949-
await publishDatasetViaApi(testDatasetIds.numericId)
950-
await waitForNoLocks(testDatasetIds.numericId, 10)
951-
952-
const actual = await sut.getDatasetDownloadCount(testDatasetIds.numericId, true)
953-
954-
expect(actual).toBe(0)
955-
956-
await deletePublishedDatasetViaApi(testDatasetIds.persistentId)
957-
})
958-
959-
test('should return error when dataset does not exist', async () => {
960-
await expect(sut.getDatasetDownloadCount(nonExistentTestDatasetId)).rejects.toBeInstanceOf(
961-
ReadError
962-
)
963-
})
964-
})
965928
})

test/unit/datasets/GetDatasetDownloadCount.test.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)