|
20 | 20 | function getPresignedURL(body, files) {
|
21 | 21 | console.log('Body of request for presigned url: ', body);
|
22 | 22 |
|
23 |
| - return api.all('submissions').customPOST(JSON.stringify({param: body})) |
| 23 | + return api.all('submissions').customPOST(body) |
24 | 24 | .then(function(response) {
|
25 | 25 | console.log('POST/Presigned URL Response: ', response.plain());
|
26 | 26 |
|
|
77 | 77 | console.log('response to use .save restnagular with: ', presignedURLResponse);
|
78 | 78 |
|
79 | 79 | // Update and start processing
|
80 |
| - updateSubmissionStatus(presignedURLResponse); |
| 80 | + updateSubmissionStatus(presignedURLResponse.plain()); |
81 | 81 |
|
82 | 82 | })
|
83 | 83 | .catch(function(err) {
|
|
91 | 91 | file.status = 'UPLOADED';
|
92 | 92 | });
|
93 | 93 |
|
94 |
| - return body.save() |
| 94 | + return api.one('submissions', body.id).customPUT(body) |
95 | 95 | .then(function(response) {
|
96 | 96 | $log.info('Successfully updated file statuses');
|
97 |
| - console.log('response from saving: ', response); |
| 97 | + recordCompletedSubmission(response.plain()); |
98 | 98 | })
|
99 | 99 | .catch(function(err) {
|
100 | 100 | $log.info('Error updating file statuses');
|
101 | 101 | $log.error(err);
|
102 | 102 | });
|
103 | 103 | }
|
104 | 104 |
|
105 |
| - function recordCompletedSubmission(id, data) { |
| 105 | + function recordCompletedSubmission(body) { |
106 | 106 | // 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') |
108 | 108 | .then(function(response) {
|
109 | 109 | $log.info('Successfully made file record. Beginning processing');
|
| 110 | + console.log('response from process call: ', response); |
110 | 111 | })
|
111 | 112 | .catch(function(err) {
|
112 |
| - $log.info('Error in creating file record'); |
| 113 | + $log.info('Error in starting processing'); |
113 | 114 | $log.error(err);
|
114 | 115 | });
|
115 | 116 | }
|
|
0 commit comments