diff options
Diffstat (limited to 'examples/lib/okpush/db.js')
| -rw-r--r-- | examples/lib/okpush/db.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/lib/okpush/db.js b/examples/lib/okpush/db.js new file mode 100644 index 0000000..5a66b01 --- /dev/null +++ b/examples/lib/okpush/db.js @@ -0,0 +1,29 @@ +// db + +function init (config) { + var db = mongoose.connect(config.mongodbUrl); + mongoose.connection.on('error', errorHandler); + + var pushAssociationSchema = new db.Schema({ + user: { + type: 'String', + required: true + }, + type: { + type: 'String', + required: true, + enum: ['ios', 'android'], + lowercase: true + }, + token: { + type: 'String', + required: true + } + }); + + PushAssociation = db.model('PushAssociation', pushAssociationSchema); +} + +function errorHandler (error) { + console.error('ERROR: ' + error); +};
\ No newline at end of file |
