Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This changelog follows the principles of [Keep a Changelog](https://keepachangel
- Datasets: Added `exportDatasetMetadata` use case, repository method, and `ExportedDatasetMetadata` response type to support exporting dataset metadata by numeric id or persistent id through Dataverse endpoint `GET /datasets/export`.
- Collections: Added `allowedDatasetTypes` field to the [Collection](./src/collections/domain/models/Collection.ts) model. This field is optional and only populated the feature is enabled on the installation and configured on the collection.
- Collections: Added theme information when retrieving a collection using `getCollection`.
- Collections: Added optional `ignoreSettingExcludeEmailFromExport` support to `getCollection`.

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import { StorageDriver } from '../../../core/domain/models/StorageDriver'
import { LinkingObjectType } from '../useCases/GetCollectionsForLinking'

export interface ICollectionsRepository {
getCollection(collectionIdOrAlias: number | string): Promise<Collection>
getCollection(
collectionIdOrAlias: number | string,
ignoreSettingExcludeEmailFromExport?: boolean
): Promise<Collection>
getCollectionStorageDriver(
collectionIdOrAlias: number | string,
getEffective?: boolean
Expand Down
11 changes: 9 additions & 2 deletions src/collections/domain/useCases/GetCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ export class GetCollection implements UseCase<Collection> {
*
* @param {number | string} [collectionIdOrAlias = ':root'] - A generic collection identifier, which can be either a string (for queries by CollectionAlias), or a number (for queries by CollectionId)
* If this parameter is not set, the default value is: ':root'
* @param {boolean} ignoreSettingExcludeEmailFromExport - This prevents the contact emails from being excluded when the setting `ExcludeEmailFromExport` is set to true and the user has EditDataverse permissions.
* @returns {Promise<Collection>}
*/
async execute(collectionIdOrAlias: number | string = ROOT_COLLECTION_ID): Promise<Collection> {
return await this.collectionsRepository.getCollection(collectionIdOrAlias)
async execute(
collectionIdOrAlias: number | string = ROOT_COLLECTION_ID,
ignoreSettingExcludeEmailFromExport?: boolean
): Promise<Collection> {
return await this.collectionsRepository.getCollection(
collectionIdOrAlias,
ignoreSettingExcludeEmailFromExport
)
}
}
6 changes: 4 additions & 2 deletions src/collections/infra/repositories/CollectionsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ export enum GetMyDataCollectionItemsQueryParams {
export class CollectionsRepository extends ApiRepository implements ICollectionsRepository {
private readonly collectionsResourceName: string = 'dataverses'
public async getCollection(
collectionIdOrAlias: number | string = ROOT_COLLECTION_ID
collectionIdOrAlias: number | string = ROOT_COLLECTION_ID,
ignoreSettingExcludeEmailFromExport?: boolean
): Promise<Collection> {
return this.doGet(`/${this.collectionsResourceName}/${collectionIdOrAlias}`, true, {
returnOwners: true,
returnChildCount: true
returnChildCount: true,
ignoreSettingExcludeEmailFromExport: ignoreSettingExcludeEmailFromExport
})
.then((response) => transformCollectionResponseToCollection(response))
.catch((error) => {
Expand Down
Loading