@buildingsblock/core
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -6,9 +6,3 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "createSchema", { | ||
enumerable: true, | ||
get: function get() { | ||
return _schema.default; | ||
} | ||
}); | ||
exports.default = exports.calcContingencyReserveFundPerSquareFoot = void 0; | ||
exports.createSchema = exports.calcContingencyReserveFundPerSquareFoot = void 0; | ||
@@ -21,6 +15,5 @@ var _lodash = _interopRequireDefault(require("lodash")); | ||
var _schema = _interopRequireDefault(require("./schema")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// import createSchema from './schema' | ||
var calcContingencyReserveFundPerSquareFoot = function calcContingencyReserveFundPerSquareFoot(stratas) { | ||
@@ -42,5 +35,72 @@ var stratasWithContingencyReserveFund = stratas.filter(function (x) { | ||
exports.calcContingencyReserveFundPerSquareFoot = calcContingencyReserveFundPerSquareFoot; | ||
var _default = { | ||
calcContingencyReserveFundPerSquareFoot: calcContingencyReserveFundPerSquareFoot | ||
}; | ||
exports.default = _default; | ||
var createSchema = function createSchema(Mongoose) { | ||
var StrataSchema = new Mongoose.Schema({ | ||
strataNumber: String, | ||
units: Number, | ||
postalCode: String, | ||
builtAt: Number, | ||
elevators: Number, | ||
pools: Number, | ||
gyms: Number, | ||
area: { | ||
total: Number, | ||
liveable: Number, | ||
basement: Number, | ||
unfinishedBasement: Number, | ||
finishedBasement: Number | ||
}, | ||
budget: [{ | ||
value: Number, | ||
at: String | ||
}], | ||
repairAndMaintenanceBudget: [{ | ||
value: Number, | ||
at: String | ||
}], | ||
contingencyReserveFund: [{ | ||
value: Number, | ||
at: String | ||
}], | ||
contingencyReserveFundContributions: [{ | ||
value: Number, | ||
at: String | ||
}], | ||
levies: [{ | ||
value: Number, | ||
at: String | ||
}] | ||
}, { | ||
timestamps: true | ||
}); | ||
/* eslint-disable func-names */ | ||
StrataSchema.pre('save', function (next) { | ||
var strata = this; // order values | ||
strata.budget = _lodash.default.orderBy(strata.budget, ['at'], ['desc']); | ||
strata.repairAndMaintenanceBudget = _lodash.default.orderBy(strata.repairAndMaintenanceBudget, ['at'], ['desc']); | ||
strata.contingencyReserveFund = _lodash.default.orderBy(strata.contingencyReserveFund, ['at'], ['desc']); | ||
strata.contingencyReserveFundContributions = _lodash.default.orderBy(strata.contingencyReserveFundContributions, ['at'], ['desc']); | ||
strata.levies = _lodash.default.orderBy(strata.levies, ['at'], ['desc']); | ||
next(); | ||
}); | ||
StrataSchema.set('toJSON', { | ||
transform: function transform(doc, ret) { | ||
ret.id = ret._id; // eslint-disable-line | ||
delete ret._id; // eslint-disable-line | ||
delete ret.__v; // eslint-disable-line | ||
} | ||
}); | ||
return StrataSchema; | ||
}; // import * as colors from './colors'; | ||
// | ||
// export { colors }; | ||
// export default { | ||
// calcContingencyReserveFundPerSquareFoot, | ||
// } | ||
exports.createSchema = createSchema; |
{ | ||
"name": "@buildingsblock/core", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Core code base for Buildingsblock", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42150
10
152