Skip to content

Add use case for getting list of collections a user may create datasets in - #418

Open
vera wants to merge 6 commits into
IQSS:developfrom
vera:feat/get-collections-for-creating
Open

Add use case for getting list of collections a user may create datasets in#418
vera wants to merge 6 commits into
IQSS:developfrom
vera:feat/get-collections-for-creating

Conversation

@vera

@vera vera commented Jan 27, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

This PR adds code for getting the list of collections a user may create datasets in. (IQSS/dataverse#11681)

Which issue(s) this PR closes:

/

Related Dataverse PRs:

/

Special notes for your reviewer:

/

Suggestions on how to test this:

I've added tests and docs on how to use.

Is there a release notes or changelog update needed for this change?:

Yes

Additional documentation:

/

@pdurbin pdurbin moved this to Ready for Triage in IQSS Dataverse Project Mar 31, 2026
@scolapasta scolapasta moved this from Ready for Triage to Ready for Review ⏩ in IQSS Dataverse Project Mar 31, 2026
@cmbz cmbz added the FY26 Sprint 20 FY26 Sprint 20 (2026-03-26 - 2026-04-08) label Apr 8, 2026
@ekraffmiller ekraffmiller added GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours. labels Apr 8, 2026
@cmbz cmbz added the FY26 Sprint 21 FY26 Sprint 21 (2026-04-08 - 2026-04-22) label Apr 8, 2026
@cmbz cmbz added the FY26 Sprint 22 FY26 Sprint 22 (2026-04-22 - 2026-05-06) label Apr 22, 2026
@cmbz cmbz added the FY26 Sprint 23 FY26 Sprint 23 (2026-05-06 - 2026-05-20) label May 6, 2026
@cmbz cmbz added the FY26 Sprint 24 FY26 Sprint 24 (2026-05-20 - 2026-06-03) label May 21, 2026
@ekraffmiller ekraffmiller self-assigned this Jun 1, 2026
@ekraffmiller ekraffmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jun 1, 2026
@ekraffmiller

ekraffmiller commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Hi @vera thanks for your PR! I was just reviewing the API that this use case is wrapping, and it has some issues with it - it doesn't have a paging option, and if the endpoint is called for a user such as an admin that returns a long list of collections, the performance is not good.
We have a more general API, /mydata/retrieve, that takes parameters for paging, dvObject type, roles, and also allows filtering of the results by collection name. It's the API used in the MyData page to filter the table contents. With the right parameters, it can return a list of collections that a user can create a dataset in. Could that be used for your purposes instead? We are thinking we might deprecate the collectionList endpoint in favor of mydata/retrieve.

UPDATE: after talking to the team, we think it's better to keep collectionList as a separate API, and add pagination and filtering to it. I created an issue for it here: IQSS/dataverse#12423

@ekraffmiller ekraffmiller moved this from In Review 🔎 to On Hold ⌛ in IQSS Dataverse Project Jun 3, 2026
@ekraffmiller

Copy link
Copy Markdown
Contributor

Putting this on hold, so it can be updated when IQSS/dataverse#12423 is completed

@ekraffmiller ekraffmiller removed their assignment Jun 3, 2026
…ns-for-creating

# Conflicts:
#	src/collections/index.ts
@vera

vera commented Aug 17, 2026

Copy link
Copy Markdown
Member Author

@pdurbin has let me know that a PR for IQSS/dataverse#12423 (IQSS/dataverse#12436) is in the works. I'll update this PR with the new pagination and filtering params once that's merged. For now, I've just fixed merge conflicts.

@ChengShi-1
ChengShi-1 requested a lite review from Copilot August 20, 2026 14:31
@ChengShi-1 ChengShi-1 assigned ChengShi-1 and vera and unassigned ChengShi-1 Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Collections-domain use case to retrieve the list of Dataverse collections in which an authenticated user can create datasets, with repository support and public exports, plus usage documentation and a unit test.

Changes:

  • Introduces GetCollectionsForCreating use case and adds getCollectionsForCreating to ICollectionsRepository + CollectionsRepository.
  • Exports the new use case instance from src/collections/index.ts.
  • Adds docs and a unit test for the new use case.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/unit/collections/GetCollectionsForCreating.test.ts Adds unit coverage for the new use case behavior (success + error propagation).
src/collections/infra/repositories/CollectionsRepository.ts Implements the new API call and maps API payload to CollectionSummary[].
src/collections/index.ts Wires and exports getCollectionsForCreating for package consumers.
src/collections/domain/useCases/GetCollectionsForCreating.ts Adds the use case class delegating to the repository method.
src/collections/domain/repositories/ICollectionsRepository.ts Extends repository contract with getCollectionsForCreating(...).
docs/useCases.md Documents the new use case and adds it to the collections read-use-cases list.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +670 to +672
public async getCollectionsForCreating(userIdentifier?: string): Promise<CollectionSummary[]> {
const queryParams = new URLSearchParams()

queryParams.set(GetMyDataCollectionItemsQueryParams.USER_IDENTIFIER, userIdentifier)
}

return this.doGet("/mydata/retrieve/collectionList", true, queryParams)
Comment thread docs/useCases.md
Comment on lines +518 to +521
#### Get Collections for Creating

Returns an array of [CollectionSummary](../src/collections/domain/models/CollectionSummary.ts) (id, alias, displayName) representing the Dataverse collections which an authenticated user may create a new dataset in.

@ChengShi-1

Copy link
Copy Markdown
Contributor

Hi @vera , I thought this was Ready for Review, so I assigned Copilot to review it, sorry for interrupting! I see your comment here and realize you're still working on this PR now.

@pdurbin has let me know that a PR for IQSS/dataverse#12423 (IQSS/dataverse#12436) is in the works. I'll update this PR with the new pagination and filtering params once that's merged. For now, I've just fixed merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 20 FY26 Sprint 20 (2026-03-26 - 2026-04-08) FY26 Sprint 21 FY26 Sprint 21 (2026-04-08 - 2026-04-22) FY26 Sprint 22 FY26 Sprint 22 (2026-04-22 - 2026-05-06) FY26 Sprint 23 FY26 Sprint 23 (2026-05-06 - 2026-05-20) FY26 Sprint 24 FY26 Sprint 24 (2026-05-20 - 2026-06-03) GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: On Hold ⌛

Development

Successfully merging this pull request may close these issues.

7 participants