blue-button-record
Advanced tools
Comparing version 1.2.0-beta.15 to 1.2.0-beta.16
@@ -9,3 +9,3 @@ "use strict"; | ||
//Saves raw file to gridFS. | ||
exports.saveSource = function (dbinfo, ptKey, content, sourceInfo, contentType, callback) { | ||
exports.saveSource = function(dbinfo, ptKey, content, sourceInfo, contentType, callback) { | ||
var buffer = new Buffer(content); | ||
@@ -21,3 +21,7 @@ | ||
//source of file | ||
var source = sourceInfo.source || ""; | ||
var source = ""; | ||
if (sourceInfo.source) { | ||
source = sourceInfo.source; | ||
console.log("file source is "< source); | ||
} | ||
@@ -29,3 +33,3 @@ dbinfo.grid.put(buffer, { | ||
content_type: sourceInfo.type, | ||
}, function (err, fileInfo) { | ||
}, function(err, fileInfo) { | ||
//console.log("fileInfo", fileInfo); | ||
@@ -45,4 +49,4 @@ if (err) { | ||
exports.getSourceList = function (dbinfo, ptKey, callback) { | ||
dbinfo.db.collection('storage.files', function (err, recordCollection) { | ||
exports.getSourceList = function(dbinfo, ptKey, callback) { | ||
dbinfo.db.collection('storage.files', function(err, recordCollection) { | ||
if (err) { | ||
@@ -53,5 +57,5 @@ callback(err); | ||
"metadata.pat_key": ptKey | ||
}, function (err, findResults) { | ||
findResults.toArray(function (err, recordArray) { | ||
var result = recordArray.map(function (record) { | ||
}, function(err, findResults) { | ||
findResults.toArray(function(err, recordArray) { | ||
var result = recordArray.map(function(record) { | ||
var r = {}; | ||
@@ -85,5 +89,5 @@ r.file_id = record._id; | ||
exports.updateSource = function (dbinfo, ptKey, sourceId, update, callback) { | ||
exports.updateSource = function(dbinfo, ptKey, sourceId, update, callback) { | ||
dbinfo.db.collection('storage.files', function (err, recordCollection) { | ||
dbinfo.db.collection('storage.files', function(err, recordCollection) { | ||
if (err) { | ||
@@ -100,3 +104,3 @@ callback(err); | ||
$set: update | ||
}, {}, function (err) { | ||
}, {}, function(err) { | ||
if (err) { | ||
@@ -114,5 +118,5 @@ callback(err); | ||
exports.getSource = function (dbinfo, ptKey, sourceId, callback) { | ||
exports.getSource = function(dbinfo, ptKey, sourceId, callback) { | ||
//Removed owner validation for demo purposes. | ||
dbinfo.db.collection('storage.files', function (err, coll) { | ||
dbinfo.db.collection('storage.files', function(err, coll) { | ||
if (err) { | ||
@@ -127,7 +131,7 @@ callback(err); | ||
'metadata.pat_key': ptKey | ||
}, function (err, results) { | ||
}, function(err, results) { | ||
if (err) { | ||
callback(err); | ||
} else if (results) { | ||
dbinfo.grid.get(sourceId, function (err, data) { | ||
dbinfo.grid.get(sourceId, function(err, data) { | ||
if (err) { | ||
@@ -148,8 +152,8 @@ callback(err); | ||
exports.sourceCount = function (dbinfo, ptKey, callback) { | ||
exports.sourceCount = function(dbinfo, ptKey, callback) { | ||
dbinfo.storageModel.count({ | ||
"metadata.pat_key": ptKey | ||
}, function (err, count) { | ||
}, function(err, count) { | ||
callback(err, count); | ||
}); | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "Master Health Record and Data Reconciliation Engine Persistance Layer", | ||
"version": "1.2.0-beta.15", | ||
"version": "1.2.0-beta.16", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
370240
4893