@wmfs/pg-model
Advanced tools
Comparing version 1.26.1 to 1.26.2
@@ -0,1 +1,13 @@ | ||
## [1.26.2](https://github.com/wmfs/pg-model/compare/v1.26.1...v1.26.2) (2021-08-04) | ||
### 🐛 Bug Fixes | ||
* default options and fix typo ([f1c6644](https://github.com/wmfs/pg-model/commit/f1c66449a95507b7c5fdf1e0992d939287fbd879)) | ||
### 🚨 Tests | ||
* add tests to ensure dates can be queried ([47b0a01](https://github.com/wmfs/pg-model/commit/47b0a01e3d4a0d9df3167dd137775e46c554bcb6)) | ||
## [1.26.1](https://github.com/wmfs/pg-model/compare/v1.26.0...v1.26.1) (2021-08-02) | ||
@@ -2,0 +14,0 @@ |
@@ -136,3 +136,3 @@ 'use strict' | ||
update (doc, options, callback = NotSet) { | ||
update (doc, options = {}, callback = NotSet) { | ||
if (callback !== NotSet) { | ||
@@ -154,3 +154,3 @@ return callbackify(this.update(doc, options), callback) | ||
options.destroyMissingSubDocsv = false | ||
options.destroyMissingSubDocs = false | ||
options.setMissingPropertiesToNull = false | ||
@@ -162,3 +162,3 @@ | ||
upsert (jsonData, options, callback = NotSet) { | ||
upsert (jsonData, options = {}, callback = NotSet) { | ||
if (callback !== NotSet) { | ||
@@ -165,0 +165,0 @@ return callbackify(this.upsert(jsonData, options), callback) |
{ | ||
"name": "@wmfs/pg-model", | ||
"version": "1.26.1", | ||
"version": "1.26.2", | ||
"description": "Takes a relational database structure and returns model objects for noSQL-like abilities.", | ||
@@ -5,0 +5,0 @@ "author": "West Midlands Fire Service", |
@@ -77,2 +77,10 @@ { | ||
"comment": "UserID that last modified this record (if known)" | ||
}, | ||
"date": { | ||
"columnDefault": null, | ||
"isNullable": "YES", | ||
"dataType": "timestamp with time zone", | ||
"characterMaximumLength": null, | ||
"numericScale": null, | ||
"comment": "Timestamp for testing finding by datetime" | ||
} | ||
@@ -79,0 +87,0 @@ }, |
@@ -73,3 +73,4 @@ /* eslint-env mocha */ | ||
lastName: 'Simpson', | ||
age: 39 | ||
age: 39, | ||
date: new Date('2021-08-13') | ||
}, | ||
@@ -92,3 +93,4 @@ {} | ||
firstName: 'Maggie', | ||
lastName: 'Simpson' | ||
lastName: 'Simpson', | ||
date: new Date('2021-08-13') | ||
}, | ||
@@ -99,3 +101,4 @@ { | ||
lastName: 'Simpson', | ||
age: 8 | ||
age: 8, | ||
date: new Date('2021-08-10') | ||
}, | ||
@@ -106,3 +109,4 @@ { | ||
lastName: 'Simpson', | ||
age: 36 | ||
age: 36, | ||
date: new Date('2021-08-06') | ||
}, | ||
@@ -440,2 +444,41 @@ { | ||
}) | ||
it('find where date equals', async () => { | ||
const doc = await models.pgmodelTest.person.find( | ||
{ | ||
where: { | ||
date: { equals: new Date('2021-08-13') } | ||
}, | ||
fields: ['employeeNo', 'date'] | ||
} | ||
) | ||
expect(doc.map(({ employeeNo }) => employeeNo)).to.eql(['1', '2']) | ||
expect(doc.length).to.eql(2) | ||
}) | ||
it('find where date more then', async () => { | ||
const doc = await models.pgmodelTest.person.find( | ||
{ | ||
where: { | ||
date: { moreThan: new Date('2021-08-11') } | ||
}, | ||
fields: ['employeeNo', 'date'] | ||
} | ||
) | ||
expect(doc.map(({ employeeNo }) => employeeNo)).to.eql(['1', '2']) | ||
expect(doc.length).to.eql(2) | ||
}) | ||
it('find where date less then', async () => { | ||
const doc = await models.pgmodelTest.person.find( | ||
{ | ||
where: { | ||
date: { lessThan: new Date('2021-08-11') } | ||
}, | ||
fields: ['employeeNo', 'date'] | ||
} | ||
) | ||
expect(doc.map(({ employeeNo }) => employeeNo)).to.eql(['3', '4']) | ||
expect(doc.length).to.eql(2) | ||
}) | ||
}) | ||
@@ -442,0 +485,0 @@ |
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
165815
3588