Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adonis-lucid-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-lucid-mongodb - npm Package Compare versions

Comparing version 1.0.17 to 1.0.18

2

package.json

@@ -8,3 +8,3 @@ {

},
"version": "1.0.17",
"version": "1.0.18",
"scripts": {

@@ -11,0 +11,0 @@ "lint": "standard",

@@ -29,3 +29,3 @@ 'use strict'

if (this.constructor.createTimestamp) {
values[this.constructor.createTimestamp] = moment().format(this.constructor.dateFormat)
values[this.constructor.createTimestamp] = moment().toDate()
}

@@ -49,3 +49,3 @@ return values

if (this.constructor.updateTimestamp) {
values[this.constructor.updateTimestamp] = moment().format(this.constructor.dateFormat)
values[this.constructor.updateTimestamp] = moment().toDate()
}

@@ -69,3 +69,3 @@ return values

if (this.constructor.deleteTimestamp) {
values[this.constructor.deleteTimestamp] = moment().format(this.constructor.dateFormat)
values[this.constructor.deleteTimestamp] = moment().toDate()
}

@@ -72,0 +72,0 @@ return values

@@ -51,3 +51,3 @@ 'use strict'

*
* @method getStoreAbleValues
* @method getPersistanceFormat
*

@@ -59,6 +59,6 @@ * @param {Object} values

*/
FieldTypes.getStoreAbleValues = function (values) {
FieldTypes.getPersistanceFormat = function (values) {
return _(values).transform((result, value, key) => {
if (this.constructor.dateFields && this.constructor.dateFields.indexOf(key) > -1) {
result[key] = value.toISOString()
result[key] = value.toDate()
} else if (this.constructor.geoFields && this.constructor.geoFields.indexOf(key) > -1) {

@@ -80,3 +80,3 @@ result[key] = {

*
* @method fillDataFromDb
* @method parsePersistance
*

@@ -88,6 +88,6 @@ * @param {Object} values

*/
FieldTypes.fillDataFromDb = function (values) {
FieldTypes.parsePersistance = function (values) {
_.map(values, (value, key) => {
if (this.constructor.dateFields && this.constructor.dateFields.indexOf(key) > -1) {
this.attributes[key] = moment(value)
if (this.getTimestampKey(key) || (this.constructor.dateFields && this.constructor.dateFields.indexOf(key) > -1)) {
this.attributes[key] = value ? moment(value) : value
} else if (this.constructor.geoFields && this.constructor.geoFields.indexOf(key) > -1 &&

@@ -94,0 +94,0 @@ _.isObject(value) && _.isArray(value.coordinates)) {

@@ -32,3 +32,3 @@ 'use strict'

const insertHandler = function * () {
const values = this.getStoreAbleValues(this.attributes)
const values = this.getPersistanceFormat(this.attributes)
if (!values || _.size(values) < 1) {

@@ -38,3 +38,3 @@ throw CE.ModelException.invalidState(`Cannot save empty ${this.constructor.name} model`)

const query = this.constructor.query()
yield query.connect()
// yield query.connect()
if (this.transaction) {

@@ -68,4 +68,4 @@ query.transacting(this.transaction)

const query = this.constructor.query()
yield query.connect()
const dirtyValues = this.getStoreAbleValues(this.$dirty)
// yield query.connect()
const dirtyValues = this.getPersistanceFormat(this.$dirty)
if (!_.size(dirtyValues) && !this.unsetFields.length) {

@@ -107,3 +107,3 @@ return 0

const query = this.constructor.query().where(this.constructor.primaryKey, this.$primaryKeyValue)
yield query.connect()
// yield query.connect()
if (this.transaction) {

@@ -135,2 +135,3 @@ query.transacting(this.transaction)

const query = this.constructor.query().where(this.constructor.primaryKey, this.$primaryKeyValue)
// yield query.connect()
if (this.transaction) {

@@ -137,0 +138,0 @@ query.transacting(this.transaction)

@@ -85,3 +85,3 @@ 'use strict'

const modelInstance = new this.queryBuilder.HostModel()
modelInstance.fillDataFromDb(value)
modelInstance.parsePersistance(value)
modelInstance.exists = true

@@ -88,0 +88,0 @@ modelInstance.original = _.cloneDeep(modelInstance.attributes)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc