-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathindex.js
41 lines (33 loc) · 1.17 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright IBM Corp. 2013,2019. All Rights Reserved.
// Node module: loopback-component-push
// This file is licensed under the Artistic License 2.0.
// License text available at https://opensource.org/licenses/Artistic-2.0
'use strict';
const SG = require('strong-globalize');
SG.SetRootDir(__dirname);
/**
* Export the connector
*/
const loopback = require('loopback');
const PushConnector = require('./lib/push-connector');
exports = module.exports = PushConnector;
/**
* Export two model classes as properties
*/
exports.Installation = require('./models').Installation;
exports.Notification = require('./models').Notification;
exports.createPushModel = function(options) {
options = options || {};
const pushDataSource = loopback.createDataSource({
connector: PushConnector,
installation: options.installation,
application: options.application,
notification: options.notification,
ttlInSeconds: options.ttlInSeconds,
checkPeriodInSeconds: options.checkPeriodInSeconds,
});
const PushModel = pushDataSource.createModel(options.name || 'Push', {},
{plural: options.plural || 'push'});
return PushModel;
};
exports.Push = exports.createPushModel();