Comparing version 0.0.14 to 0.0.15
@@ -114,8 +114,9 @@ var config = require('./config'); | ||
} | ||
if (targets.length == 1) { | ||
resource = targets[0]; | ||
} | ||
else { | ||
throw new Error('Unable to determine resource type for this search (:[type] modifier required)'); | ||
if (targets.length == 1) { | ||
resource = targets[0]; | ||
} | ||
else { | ||
throw new Error('Unable to determine resource type for this search (:[type] modifier required)'); | ||
} | ||
} | ||
@@ -122,0 +123,0 @@ |
{ | ||
"name": "fhirball", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "An Express router for a nodejs+MongoDB FHIR server", | ||
@@ -26,2 +26,6 @@ "keywords": [ | ||
{ | ||
"name": "Allan Hodkinson", | ||
"email": "allan.hodkinson@blackpear.com" | ||
}, | ||
{ | ||
"name": "Ian McNicoll", | ||
@@ -28,0 +32,0 @@ "email": "ian@freshehr.com" |
@@ -996,2 +996,18 @@ var query = require('./../../../../lib/RouteFactory/search/query'); | ||
it('filters by resource type & id when multiple resource type targets defined', function () { | ||
var req = { | ||
query: { | ||
'provider:Practitioner': '456', | ||
'provider:Organization': '789' | ||
} | ||
}; | ||
var result = query.reduceToOperations(req.query, searchParam2); | ||
should.exist(result); | ||
result.match.length.should.equal(2); | ||
result.match[0].should.deep.equal({'resource.managingOrganization.reference': 'Practitioner/456'}); | ||
result.match[1].should.deep.equal({'resource.managingOrganization.reference': 'Organization/789'}); | ||
}); | ||
it('throws if resource is ambiguous', function () { | ||
@@ -998,0 +1014,0 @@ var req = { |
2770457
8781