@balena/odata-to-abstract-sql
Advanced tools
Comparing version 5.4.2 to 5.4.3-date-compares-with-date-trunc-1fbea7c4974d959b0f58791126aeba80b161904e
@@ -7,2 +7,6 @@ # Change Log | ||
## 5.4.3 - 2021-07-28 | ||
* Add SBVR Date TIme Type to DateTrunc Wrapper [fisehara] | ||
## 5.4.2 - 2021-06-30 | ||
@@ -9,0 +13,0 @@ |
@@ -825,2 +825,16 @@ "use strict"; | ||
else { | ||
const mapping = this.ResourceMapping(prop.resource); | ||
if (mapping[prop.name]) { | ||
const fieldDefinition = _.find(prop.resource.fields, { | ||
fieldName: mapping[prop.name][1], | ||
}); | ||
if ((fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.dataType) === 'Date Time' || | ||
(fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.dataType) === 'Date') { | ||
return [ | ||
'DateTrunc', | ||
['Text', 'milliseconds'], | ||
this.ReferencedField(prop.resource, prop.name), | ||
]; | ||
} | ||
} | ||
return this.ReferencedField(prop.resource, prop.name); | ||
@@ -827,0 +841,0 @@ } |
{ | ||
"name": "@balena/odata-to-abstract-sql", | ||
"version": "5.4.2", | ||
"version": "5.4.3-date-compares-with-date-trunc-1fbea7c4974d959b0f58791126aeba80b161904e", | ||
"description": "A consumer of the OData parser, written in OMeta", | ||
@@ -54,3 +54,6 @@ "main": "out/odata-to-abstract-sql.js", | ||
"_": "test/resource_parsing.coffee" | ||
}, | ||
"versionist": { | ||
"publishedAt": "2021-07-28T12:31:10.760Z" | ||
} | ||
} |
@@ -1083,2 +1083,20 @@ import * as _ from 'lodash'; | ||
} else { | ||
// Used as ReferencedProperty a DateValue has to be handled with a date_trunc | ||
// TODO: How to get the underlying db engine on this.layer | ||
const mapping = this.ResourceMapping(prop.resource); | ||
if (mapping[prop.name]) { | ||
const fieldDefinition = _.find(prop.resource.fields, { | ||
fieldName: mapping[prop.name][1], | ||
}); | ||
if ( | ||
fieldDefinition?.dataType === 'Date Time' || | ||
fieldDefinition?.dataType === 'Date' | ||
) { | ||
return [ | ||
'DateTrunc', | ||
['Text', 'milliseconds'], | ||
this.ReferencedField(prop.resource, prop.name), | ||
]; | ||
} | ||
} | ||
return this.ReferencedField(prop.resource, prop.name); | ||
@@ -1085,0 +1103,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
397849
2986
2