From 62de18b8abe5c480a73bd2445c57a03606c85aa3 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 2 Feb 2017 15:17:27 -0300 Subject: [PATCH] add push notification subscription model --- lib/model/pushnotificationsub.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/model/pushnotificationsub.js diff --git a/lib/model/pushnotificationsub.js b/lib/model/pushnotificationsub.js new file mode 100644 index 0000000..c0ee377 --- /dev/null +++ b/lib/model/pushnotificationsub.js @@ -0,0 +1,32 @@ +'use strict'; + +function PushNotificationSub() {}; + +PushNotificationSub.create = function(opts) { + opts = opts || {}; + + var x = new PushNotificationSub(); + + x.version = '1.0.0'; + x.createdOn = Math.floor(Date.now() / 1000); + x.copayerId = opts.copayerId; + x.token = opts.token; + x.packageName = opts.packageName; + x.platform = opts.platform; + return x; +}; + +PushNotificationSub.fromObj = function(obj) { + var x = new PushNotificationSub(); + + x.version = obj.version; + x.createdOn = obj.createdOn; + x.copayerId = obj.copayerId; + x.token = obj.token; + x.packageName = obj.packageName; + x.platform = obj.platform; + return x; +}; + + +module.exports = PushNotificationSub;