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

Commit f0e1acf

Browse files
author
Nick Litwin
committed
save for update
1 parent 78b31cc commit f0e1acf

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/services/submissions.service.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,27 @@
7777
console.log('response to use .save restnagular with: ', presignedURLResponse);
7878

7979
// Update and start processing
80+
updateSubmissionStatus(presignedURLResponse);
8081

8182
})
8283
.catch(function(err) {
8384
console.log('error uploading to S3: ', err);
8485
});
8586
}
8687

87-
function updateSubmissionStatus(id, data) {
88+
function updateSubmissionStatus(body) {
8889
// Pass data from upload to S3
89-
return api.one('submissions', id).customPUT(data)
90+
body.data.files.forEach(function(file) {
91+
file.status = 'UPLOADED';
92+
});
93+
94+
return body.save()
9095
.then(function(response) {
91-
$log.info('Successfully updated file status');
96+
$log.info('Successfully updated file statuses');
97+
console.log('response from saving: ', response);
9298
})
9399
.catch(function(err) {
94-
$log.info('Error updating file status');
100+
$log.info('Error updating file statuses');
95101
$log.error(err);
96102
});
97103
}

0 commit comments

Comments
 (0)