@bluedot-innovation/models 2.0.4-alpha.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,14 +5,11 @@
5
5
  "lastUpdateTime": "2018-02-14T04:12:02.103Z",
6
6
  "creationTime": "2018-02-14T04:12:02.103Z",
7
7
  "projectId": "c7058934-f1e6-4176-8730-a0bd28e8e0a9",
8
- "customData": [
9
- {
10
- "name1": "A Custom action1"
11
- },
12
- {
13
- "name2": "A Custom action2"
14
- }
15
- ],
8
+ "accountId": "23a01af0-232a-4518-9c0e-323fb773f5ef",
9
+ "customData": {
10
+ "name1": "A Custom action1",
11
+ "name2": "A Custom action2"
12
+ },
16
13
  "actions": [
17
14
  {
18
15
  "type": "message",
package/models/Beacon.js CHANGED
@@ -31,7 +31,6 @@ let schema = {
31
31
  }
32
32
  },
33
33
  location: {type: Point},
34
- proximity: {type: String, default: 'Far'},
35
34
  accountId: {
36
35
  type: String, required: true
37
36
  },
@@ -0,0 +1,24 @@
1
+ /* eslint-disable */
2
+ let mongoose = require('mongoose')
3
+ let Beacon = require('./Beacon').Model
4
+
5
+ var options = {discriminatorKey: 'type'};
6
+ const ZoneBeacon = Beacon.discriminator('beacon', new mongoose.Schema({
7
+ proximity: {type: String, default: 'Far'}
8
+ }, options));
9
+
10
+ var eventSchema = new mongoose.Schema({time: Date}, options);
11
+ var Event = mongoose.model('Event', eventSchema);
12
+
13
+ // ClickedLinkEvent is a special type of Event that has a URL.
14
+ var ClickedLinkEvent = Event.discriminator('ClickedLink', new mongoose.Schema({url: String}, options));
15
+
16
+ // When you create a generic event, it can't have a URL field...
17
+ var genericEvent = new Event({time: Date.now(), url: 'google.com'});
18
+ console.log(genericEvent)
19
+ console.log(genericEvent instanceof ClickedLinkEvent)
20
+
21
+ // But a ClickedLinkEvent can
22
+ var clickedEvent = new ClickedLinkEvent({time: Date.now(), url: 'google.com'});
23
+ console.log(clickedEvent)
24
+ console.log(clickedEvent instanceof ClickedLinkEvent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "2.0.4-alpha.3",
3
+ "version": "2.0.4",
4
4
  "description": "",
5
5
  "main": "Models.js",
6
6
  "scripts": {