-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add use case to get all datasets previews with pagination #107
Conversation
… into 106-get-collection-datasets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use case looks good!
I think we're going to have everything that we need to integrate it with the frontend except that we need an use case to get the total count if we want the pagination to work
I left some comments
src/datasets/infra/repositories/transformers/datasetPreviewsTransformers.ts
Outdated
Show resolved
Hide resolved
import { DatasetPreview } from './DatasetPreview'; | ||
|
||
export interface DatasetPreviewSubset { | ||
datasetPreviews: DatasetPreview[]; | ||
totalDatasetCount: number; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that for the sake of consistency within the module, getDatasetFiles
should also return FilesSubset, including files and the count information
This would ensure that the module's responses are predictable. Users of the module would then know that if they use some getAllItems
use case, the response will be paginated and will include both the items and their count
I think that the module use cases shouldn't be coupled to the type of API used and how they are implemented, (Native API or Search API) and the module should be consistent even if each API works differently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but I wouldn't make this change now as I would first extend the files API to return the total files count along with the files to avoid making two API calls per use case call. We can create two new issues for this: Files API extension + files use case extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this PR does / why we need it:
Adds use case to get all dataset previews of the installation.
Which issue(s) this PR closes:
Special notes for your reviewer:
The integration testing environment setup has been modified, now creating the test datasets at that point, to ensure that they are correctly created and indexed in Solr when running the integration tests and that there are no race conditions between the tests, since for getAllDatasetPreviews the total number of retrieved datasets is checked.
Suggestions on how to test this:
Visual inspection and execute integration tests.
Is there a release notes update needed for this change?:
N/A
Additional documentation:
None