Skip to content

Add use case for setting default contributor - #415

Open
vera wants to merge 9 commits into
IQSS:developfrom
vera:feat/set-default-contributor
Open

Add use case for setting default contributor#415
vera wants to merge 9 commits into
IQSS:developfrom
vera:feat/set-default-contributor

Conversation

@vera

@vera vera commented Jan 26, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

This PR adds code for setting the default contributor role of a collection.

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:

@vera vera changed the title Set default contributor Add use case for setting default contributor Jan 26, 2026
@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
@cmbz cmbz added the FY26 Sprint 25 FY26 Sprint 25 (2026-06-03 - 2026-06-17) label Jun 3, 2026
@ChengShi-1
ChengShi-1 requested review from ChengShi-1 and Copilot June 5, 2026 20:49
@ChengShi-1 ChengShi-1 moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jun 5, 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

This PR adds a new Collections use case to set a collection’s default contributor role (Dataverse endpoint for assigning the default role to users creating datasets in a collection), wiring it through the repository layer, public exports, docs, and unit tests.

Changes:

  • Add SetDefaultContributorRole use case and expose it from the collections public API.
  • Implement setDefaultContributorRole in CollectionsRepository and add it to ICollectionsRepository.
  • Document the new use case and add a unit test for the use case behavior.

Reviewed changes

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

Show a summary per file
File Description
test/unit/collections/SetDefaultContributorRole.test.ts Adds unit tests for the new use case.
src/collections/infra/repositories/CollectionsRepository.ts Adds repository method calling the Dataverse API endpoint via PUT.
src/collections/index.ts Exposes the new use case from the collections module.
src/collections/domain/useCases/SetDefaultContributorRole.ts Introduces the new use case implementation and JSDoc.
src/collections/domain/repositories/ICollectionsRepository.ts Extends the repository interface with the new method.
docs/useCases.md Documents the new use case and adds it to the use-cases list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/unit/collections/SetDefaultContributorRole.test.ts Outdated
Comment thread test/unit/collections/SetDefaultContributorRole.test.ts Outdated
Comment thread src/collections/domain/useCases/SetDefaultContributorRole.ts
Comment thread src/collections/infra/repositories/CollectionsRepository.ts
Comment thread docs/useCases.md

@ChengShi-1 ChengShi-1 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.

Hi Vera, thanks for your contribution! Here are some suggestions

  • Merge with dev to update
  • update Changelog.md
  • For roleAlias(see roles in Dataverse), we could have a built-in reference to export, similar toFileCitationFormat.ts in js-dataverse
    • For example, export enum RoleAlias { ADMIN = 'Admin', ...}
  • add integration test proving the setDefault is working in different conditions
    • Successfully set a role, if possible, please check GET collection return a correct roleAlias
    • If this parameter is not set, the default value is: ':root'
    • maybe a few error conditions
  • run npm run format npx prettier . --check before your commit to clear the format

@cmbz cmbz added the FY26 Sprint 26 FY26 Sprint 26 (2026-06-17 - 2026-07-01) label Jun 18, 2026
@ChengShi-1 ChengShi-1 moved this from In Review 🔎 to On Hold ⌛ in IQSS Dataverse Project Jun 25, 2026
@ChengShi-1

Copy link
Copy Markdown
Contributor

Hi Vera, thanks for your contribution! Here are some suggestions

  • Merge with dev to update

  • update Changelog.md

  • For roleAlias(see roles in Dataverse), we could have a built-in reference to export, similar toFileCitationFormat.ts in js-dataverse

    • For example, export enum RoleAlias { ADMIN = 'Admin', ...}
  • add integration test proving the setDefault is working in different conditions

    • Successfully set a role, if possible, please check GET collection return a correct roleAlias
    • If this parameter is not set, the default value is: ':root'
    • maybe a few error conditions
  • run npm run format npx prettier . --check before your commit to clear the format

Hi @vera , sorry I forgot to @ you earlier. Just mentioning you here in case you have time to follow up.

@vera

vera commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

@ChengShi-1 thanks for the reminder. I'll be on vacation for the rest of the month, but I'll be picking this up again in August (along with my other open PRs in this repo).

@vera

vera commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

Hey @ChengShi-1 , I think I've resolved all the feedback now.

For the integration test, I think currently there is no existing use case that allows to check that the correct roleAlias has been stored, but I've still added a simple integration test.

I've recently had a PR for a "Get default contributor role" API be merged into main Dataverse (IQSS/dataverse#12112), and I plan to open a separate PR for that in this repo.

@ChengShi-1 ChengShi-1 moved this from On Hold ⌛ to In Review 🔎 in IQSS Dataverse Project Aug 18, 2026
@ChengShi-1

Copy link
Copy Markdown
Contributor

Hey @ChengShi-1 , I think I've resolved all the feedback now.

For the integration test, I think currently there is no existing use case that allows to check that the correct roleAlias has been stored, but I've still added a simple integration test.

I've recently had a PR for a "Get default contributor role" API be merged into main Dataverse (IQSS/dataverse#12112), and I plan to open a separate PR for that in this repo.

Thanks, Vera! I'll review and QA it soon

@ChengShi-1 ChengShi-1 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.

Looks good!

Some lint errors in the following files, I suggest to run npx prettier --write . to fix all them. Also, you could run npm run lint to verify.

  • SetDefaultContributorRole.ts:25
  • roles/index.ts:11 (missing final newline)
  • SetDefaultContributorRole.test.ts:12,23
  • integration SetDefaultContributorRole.test.ts:53

@ChengShi-1 ChengShi-1 assigned vera and unassigned vera and ChengShi-1 Aug 18, 2026
@ChengShi-1 ChengShi-1 added the FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) label Aug 18, 2026
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) FY26 Sprint 25 FY26 Sprint 25 (2026-06-03 - 2026-06-17) FY26 Sprint 26 FY26 Sprint 26 (2026-06-17 - 2026-07-01) FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: In Review 🔎

Development

Successfully merging this pull request may close these issues.

7 participants