From 95df0e83fdb7f564d64b6c916e674e0db46c116d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 4 Oct 2016 19:50:38 -0400 Subject: starting push notification module --- examples/lib/okpush/db.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 examples/lib/okpush/db.js (limited to 'examples/lib/okpush/db.js') 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 -- cgit v1.2.3-70-g09d2