@kohanajs/mixin-orm
Advanced tools
Comparing version 3.2.3 to 3.3.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [3.3.0](https://gitlab.com/kohana-js/controller-mixins/orm/compare/v3.2.3...v3.3.0) (2023-06-01) | ||
### Features | ||
* ControllerMixinORMRead with additional critieria ([3bd5348](https://gitlab.com/kohana-js/controller-mixins/orm/commit/3bd53487d7360902b53df74bd0b9a66adbd12dba)) | ||
### [3.2.3](https://gitlab.com/kohana-js/controller-mixins/orm/compare/v3.2.2...v3.2.3) (2023-03-14) | ||
@@ -7,0 +14,0 @@ |
@@ -17,2 +17,4 @@ const { ControllerMixin } = require('@kohanajs/core-mvc'); | ||
static LIST_FILTER = 'listFilter'; | ||
static #formatDate(date) { | ||
@@ -41,2 +43,3 @@ let d = date, | ||
state.set(this.MODEL, state.get(this.MODEL)); | ||
state.set(this.LIST_FILTER, state.get(this.LIST_FILTER) ?? []); | ||
} | ||
@@ -58,11 +61,12 @@ | ||
const result = await ORM.readWith(model, [ | ||
['', 'created_at', 'GREATER_THAN_EQUAL', `${start} 00:00:00+08:00`], | ||
['AND', 'created_at', 'LESS_THAN_EQUAL', `${end} 00:00:00+08:00`], | ||
] | ||
,{ database, ...options, offset } | ||
); | ||
const criteria = [ | ||
['', 'created_at', 'GREATER_THAN_EQUAL', `${start} 00:00:00+08:00`], | ||
['AND', 'created_at', 'LESS_THAN_EQUAL', `${end} 00:00:00+08:00`], | ||
...state.get(this.LIST_FILTER) | ||
]; | ||
state.set(this.COUNT, await ORM.count(model, { database })); | ||
state.set(this.INSTANCES, (!result) ? [] : [result].flat()); | ||
const result = await ORM.readWith(model, criteria,{ database, ...options, offset, asArray:true }); | ||
state.set(this.COUNT, await ORM.countWith(model, criteria,{ database })); | ||
state.set(this.INSTANCES, result); | ||
} | ||
@@ -69,0 +73,0 @@ |
{ | ||
"name": "@kohanajs/mixin-orm", | ||
"version": "3.2.3", | ||
"version": "3.3.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "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
21609
441