@dhyasama/totem-models 10.51.0 → 10.53.0

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.
package/index.js CHANGED
@@ -61,6 +61,7 @@ var bootstrap = function(mongoose, config) {
61
61
  require('./lib/Activity.js')(mongoose, config);
62
62
  require('./lib/CalendarEvent.js')(mongoose, config);
63
63
  require('./lib/CapTable.js')(mongoose, config);
64
+ require('./lib/Currency.js')(mongoose, config);
64
65
  require('./lib/Document.js')(mongoose, config);
65
66
  require('./lib/Event.js')(mongoose, config);
66
67
  require('./lib/EventAttendee.js')(mongoose, config);
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ module.exports = function(mongoose, config) {
4
+
5
+ let
6
+
7
+ Schema = mongoose.Schema,
8
+ _ = require('underscore'),
9
+
10
+ Currency = new Schema({
11
+
12
+ date: { type: Date, required: true },
13
+
14
+ currency: { type: String, required: true },
15
+
16
+ conversions: [{
17
+ _id: false,
18
+ currency: { type: String },
19
+ rate: { type: Number }
20
+ }]
21
+
22
+ });
23
+
24
+ Currency.statics.getByDate = function getByDate(date, cb) {
25
+ this
26
+ .find({date: date, currency: currency})
27
+ .exec(cb);
28
+ };
29
+
30
+ Currency.statics.upsert = function (currency, cb) {
31
+ currency.save(cb);
32
+ };
33
+
34
+ Currency.set('usePushEach', true);
35
+ Currency.set('autoIndex', false);
36
+ Currency.set('usePushEach', true);
37
+ Currency.on('index', function(err) { console.log('error building currency indexes: ' + err); });
38
+
39
+ mongoose.model('Currency', Currency);
40
+
41
+ };
package/lib/Financials.js CHANGED
@@ -70,13 +70,7 @@ module.exports = function(mongoose, config) {
70
70
 
71
71
  uuid: { type: String },
72
72
 
73
- currency: {
74
- code: { type: String, default: 'USD' },
75
- conversion: [{
76
- code: { type: String },
77
- rate: { type: Number }
78
- }]
79
- },
73
+ currency: { type: String, default: 'USD' },
80
74
 
81
75
  review: { type: Boolean, default: false },
82
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "10.51.0",
3
+ "version": "10.53.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",