diff --git a/lib/core/models/file.model.ts b/lib/core/models/file.model.ts index 2f114e1b99..6d82a5ff26 100644 --- a/lib/core/models/file.model.ts +++ b/lib/core/models/file.model.ts @@ -15,6 +15,8 @@ * limitations under the License. */ +import { AssocChildBody, AssocTargetBody } from 'alfresco-js-api'; + export interface FileUploadProgress { loaded: number; total: number; @@ -28,6 +30,10 @@ export interface FileUploadOptions { parentId?: string; path?: string; nodeType?: string; + properties?: any; + association?: any; + secondaryChildren?: AssocChildBody[]; + targets?: AssocTargetBody[]; } export enum FileUploadStatus { diff --git a/lib/core/services/upload.service.spec.ts b/lib/core/services/upload.service.spec.ts index b44e39cd2b..7d51c2cef1 100644 --- a/lib/core/services/upload.service.spec.ts +++ b/lib/core/services/upload.service.spec.ts @@ -186,7 +186,7 @@ describe('UploadService', () => { expect(uploadFileSpy).toHaveBeenCalledWith({ name: 'fake-name', size: 10 - }, undefined, undefined, null, { + }, undefined, undefined, { newVersion: true }, { renditions: 'doclib', include: [ 'allowableOperations' ], overwrite: true, @@ -222,6 +222,39 @@ describe('UploadService', () => { }); }); + it('should append to the request the extra upload options', () => { + let uploadFileSpy = spyOn(alfrescoApiService.getInstance().upload, 'uploadFile').and.callThrough(); + let emitter = new EventEmitter(); + + let filesFake = new FileModel( + { name: 'fake-name', size: 10 }, + { parentId: '123', path: 'fake-dir', + secondaryChildren: [{ assocType: 'assoc-1', childId: 'child-id' }], + association: { assocType: 'fake-assoc' }, + targets: [{ assocType: 'target-assoc', targetId: 'fake-target-id' }] + } + ); + service.addToQueue(filesFake); + service.uploadFilesInTheQueue(emitter); + + expect(uploadFileSpy).toHaveBeenCalledWith({ + name: 'fake-name', + size: 10 + }, 'fake-dir', '123', { + newVersion: false, + parentId: '123', + path: 'fake-dir', + secondaryChildren: [ + { assocType: 'assoc-1', childId: 'child-id' }], + association: { assocType: 'fake-assoc' }, + targets: [{ assocType: 'target-assoc', targetId: 'fake-target-id' }] + }, { + renditions: 'doclib', + include: ['allowableOperations'], + autoRename: true + }); + }); + it('should start downloading the next one if a file of the list is aborted', (done) => { let emitter = new EventEmitter(); diff --git a/lib/core/services/upload.service.ts b/lib/core/services/upload.service.ts index 6ee002a23d..4bdaaefabd 100644 --- a/lib/core/services/upload.service.ts +++ b/lib/core/services/upload.service.ts @@ -189,7 +189,7 @@ export class UploadService { file.file, file.options.path, file.options.parentId, - null, + file.options, opts ); }