-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathUpdateFileMetadata.ts
More file actions
26 lines (23 loc) · 1.11 KB
/
Copy pathUpdateFileMetadata.ts
File metadata and controls
26 lines (23 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { IFilesRepository } from '../repositories/IFilesRepository'
import { UpdateFileMetadataDTO } from '../dtos/UpdateFileMetadataDTO'
export class UpdateFileMetadata implements UseCase<void> {
private filesRepository: IFilesRepository
constructor(filesRepository: IFilesRepository) {
this.filesRepository = filesRepository
}
/**
* Updates the metadata for a particular File.
* More detailed information about updating a file's metadata behavior can be found in https://guides.dataverse.org/en/latest/api/native-api.html#updating-file-metadata
*
* @param {number | string} [fileId] - The file identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers).
* @param {UpdateFileMetadataDTO} [updateFileMetadataDTO] - The DTO containing the metadata updates.
* @returns {Promise<void>}
*/
async execute(
fileId: number | string,
updateFileMetadataDTO: UpdateFileMetadataDTO
): Promise<void> {
await this.filesRepository.updateFileMetadata(fileId, updateFileMetadataDTO)
}
}