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

@kohanajs/mixin-orm

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kohanajs/mixin-orm - npm Package Compare versions

Comparing version 3.1.1 to 3.2.0

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [3.2.0](https://gitlab.com/kohana-js/controller-mixins/orm/compare/v3.1.1...v3.2.0) (2022-04-29)
### Features
* action_index support start and end query string ([c2b70d0](https://gitlab.com/kohana-js/controller-mixins/orm/commit/c2b70d06dfe8b4f37b53104f265ebd4ac6f8cfcb))
### [3.1.1](https://gitlab.com/kohana-js/controller-mixins/orm/compare/v3.1.0...v3.1.1) (2022-03-09)

@@ -7,0 +14,0 @@

25

classes/controller-mixin/ORMRead.js

@@ -17,2 +17,16 @@ const { ControllerMixin } = require('@kohanajs/core-mvc');

static #formatDate(date) {
let d = date,
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [year, month, day].join('-');
}
static init(state) {

@@ -39,4 +53,13 @@ state.set(this.ORM_OPTIONS, new Map([

const offset = page * options.limit;
const result = await ORM.readAll(model, { database, ...options, offset });
const start = client.request.query.start ?? '1970-1-1';
const end = this.#formatDate(new Date(new Date(client.request.query.end ?? '2999-12-31').getTime() + 86400000));
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 }
);
state.set(this.COUNT, await ORM.count(model, { database }));

@@ -43,0 +66,0 @@ state.set(this.INSTANCES, (!result) ? [] : [result].flat());

2

package.json
{
"name": "@kohanajs/mixin-orm",
"version": "3.1.1",
"version": "3.2.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

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