Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Pradnya-Paranjape/866240c47909f2c582ff73777dd01b84 to your computer and use it in GitHub Desktop.

Select an option

Save Pradnya-Paranjape/866240c47909f2c582ff73777dd01b84 to your computer and use it in GitHub Desktop.
if(data.file_id) {
self.postProcessFile(data.file_id, candidateRec.id)
.then(function() {
fulfill(true);
})
.catch(function(e) {
reject(e);
});
} else {
fulfill(true);
}
candidateModel.prototype.postProcessFile = function(fileId, entityId) {
var self = this;
var log = self.log;
return new Promise(function(fulfill, reject) {
//Process file for preview generation and text extraction
var dataToPost = {
metadata: {
"x-plugin-task-preview": "{\"doc_preview\":true,\"text_extract\":true}"
},
entity_id: entityId
};
self.storageSdk.postProcessFile(fileId, dataToPost)
.then(function(record) {
var recObject = JSON.parse(record);
fulfill(recObject);
})
.catch(function(e) {
return reject(e);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment