Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 23e0bcb

Browse files
author
Nick Litwin
committed
Make updating and processing calls
1 parent 610f561 commit 23e0bcb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

app/services/submissions.service.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
function getPresignedURL(body, files) {
2121
console.log('Body of request for presigned url: ', body);
2222

23-
return api.all('submissions').customPOST(JSON.stringify({param: body}))
23+
return api.all('submissions').customPOST(body)
2424
.then(function(response) {
2525
console.log('POST/Presigned URL Response: ', response.plain());
2626

@@ -77,7 +77,7 @@
7777
console.log('response to use .save restnagular with: ', presignedURLResponse);
7878

7979
// Update and start processing
80-
updateSubmissionStatus(presignedURLResponse);
80+
updateSubmissionStatus(presignedURLResponse.plain());
8181

8282
})
8383
.catch(function(err) {
@@ -91,25 +91,26 @@
9191
file.status = 'UPLOADED';
9292
});
9393

94-
return body.save()
94+
return api.one('submissions', body.id).customPUT(body)
9595
.then(function(response) {
9696
$log.info('Successfully updated file statuses');
97-
console.log('response from saving: ', response);
97+
recordCompletedSubmission(response.plain());
9898
})
9999
.catch(function(err) {
100100
$log.info('Error updating file statuses');
101101
$log.error(err);
102102
});
103103
}
104104

105-
function recordCompletedSubmission(id, data) {
105+
function recordCompletedSubmission(body) {
106106
// Once all uploaded, make record and begin processing
107-
return api.one('submissions', id).customPOST(data, 'process')
107+
return api.one('submissions', body.id).customPOST(body, 'process')
108108
.then(function(response) {
109109
$log.info('Successfully made file record. Beginning processing');
110+
console.log('response from process call: ', response);
110111
})
111112
.catch(function(err) {
112-
$log.info('Error in creating file record');
113+
$log.info('Error in starting processing');
113114
$log.error(err);
114115
});
115116
}

0 commit comments

Comments
 (0)