Skip to content

Commit d51ed77

Browse files
committed
Merge pull request #11 from agonbina/master
Closes #8, and #10. Added Getter and Setter for model and schema internal variables, and added `feathers-plugin` keyboard, and cleaned up comments and console.log calls.
2 parents 2739c2b + 356d3d4 commit d51ed77

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@ Session.vim
4747
# proportion of contributors will probably not be using SublimeText
4848
# *.sublime-project
4949

50+
# === Webstorm ===
51+
.idea

lib/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ module.exports = function(modelName, schema, mongoose) {
2121
return this;
2222
}
2323

24+
// Getter methods for 'model' and 'schema'
25+
Store.prototype.getModel = function() {
26+
return this.model;
27+
};
28+
29+
Store.prototype.getSchema = function () {
30+
return this.schema;
31+
};
32+
2433
// Helpers
2534
var parseQuery = function(query) {
2635
if (typeof query !== 'object')
@@ -45,7 +54,7 @@ module.exports = function(modelName, schema, mongoose) {
4554
return query;
4655
};
4756

48-
// Returns a Todo by it's id
57+
// Returns a Model by it's id
4958
Store.prototype.find = function (params, callback) {
5059
if (typeof params === 'function') {
5160
callback = params;
@@ -71,16 +80,14 @@ module.exports = function(modelName, schema, mongoose) {
7180
};
7281

7382
Store.prototype.create = function (data, params, callback) {
74-
// Create our actual Todo object so that we only get what we really want
83+
// Create our actual Model object so that we only get what we really want
7584
var obj = new this.model(data);
7685
obj.save(function (err, data) {
77-
//console.log(err, data);
7886
callback(err, data);
7987
});
8088
};
8189

8290
Store.prototype.update = function (id, data, params, callback) {
83-
console.log('UPDATE', id, data, params);
8491
this.model.findByIdAndUpdate(id, data, { upsert: true }, function(err, data) {
8592
return callback(err, data);
8693
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"keywords": [
1414
"feathers",
15+
"feathers-plugin",
1516
"REST",
1617
"Socket.io",
1718
"realtime",

0 commit comments

Comments
 (0)