diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-10-04 19:50:38 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-10-04 19:50:38 -0400 |
| commit | 95df0e83fdb7f564d64b6c916e674e0db46c116d (patch) | |
| tree | b0e68ea99a5a57fdb95aa1046db8fe69d0aefbbb /examples/lib/okpush/db.js | |
| parent | 7e525bc4ae191bde7cb40de2c489250cb3e0af0f (diff) | |
starting push notification module
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 |
