-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDeleteCollectionFeaturedItems.ts
More file actions
23 lines (20 loc) · 1.15 KB
/
DeleteCollectionFeaturedItems.ts
File metadata and controls
23 lines (20 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { ROOT_COLLECTION_ID } from '../models/Collection'
import { ICollectionsRepository } from '../repositories/ICollectionsRepository'
export class DeleteCollectionFeaturedItems implements UseCase<void> {
private collectionsRepository: ICollectionsRepository
constructor(collectionsRepository: ICollectionsRepository) {
this.collectionsRepository = collectionsRepository
}
/**
* Deletes all featured items from a collection, given a collection identifier.
*
* @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'
* @returns {Promise<void>} - This method does not return anything upon successful completion.
* @throws {WriteError} - If there are errors while writing data.
*/
async execute(collectionIdOrAlias: number | string = ROOT_COLLECTION_ID): Promise<void> {
return await this.collectionsRepository.deleteCollectionFeaturedItems(collectionIdOrAlias)
}
}