Skip to content

Commit d220252

Browse files
author
Gavin Barron
committed
adding subscriptionId lookup
1 parent f049a15 commit d220252

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

common/models/userRepository.js

+21
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,27 @@ UserRepository.prototype = {
9292
});
9393
},
9494

95+
96+
getItemBySubscriptionId: function(itemId, callback) {
97+
var self = this;
98+
99+
var querySpec = {
100+
query: 'SELECT * FROM root r WHERE r.data.subscriptionId=@id',
101+
parameters: [{
102+
name: '@id',
103+
value: itemId
104+
}]
105+
};
106+
107+
self.client.queryDocuments(self.collection._self, querySpec).toArray(function(err, results) {
108+
if (err) {
109+
callback(err);
110+
} else {
111+
callback(null, results[0]);
112+
}
113+
});
114+
},
115+
95116
getItem: function(itemId, callback) {
96117
var self = this;
97118

0 commit comments

Comments
 (0)