Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

fix(portability.upload): upload file for portability attachment #261

Merged
merged 1 commit into from
Nov 20, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ angular.module('ovh-api-services').service('OvhApiTelephonyPortabilityDocumentV6
},
getDocument: {
method: 'GET',
isArray: false,
isArray: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

telephony.PortabilityDocument isn't an Array. Are you sure about this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I am sure. The call of the API return an array.

},
updateDocument: {
method: 'PUT',
Expand All @@ -46,17 +46,23 @@ angular.module('ovh-api-services').service('OvhApiTelephonyPortabilityDocumentV6
this.resetCache();
};

docResource.upload = function (filename, file) {
return docResource.create({}, {
docResource.upload = function (billingAccount, id, filename, file) {
return docResource.create({
billingAccount,
id,
}, {
name: filename,
}).$promise.then((resp) => $http.put(resp.putUrl, file, {
serviceType: 'storage',
headers: {
'Content-type': 'multipart/form-data',
},
}).then(() => docResource.get({
id: resp.id,
}).$promise));
}).then(() => docResource.getDocument({
billingAccount,
id,
}, {
id: resp.documentId,
})));
};

return docResource;
Expand Down