8062-testToMaster_2 #3059

Merged
alexm merged 293 commits from 8062-testToMaster_2 into master 2024-10-03 05:43:41 +00:00
1 changed files with 15 additions and 2 deletions
Showing only changes of commit 882f1eb7c2 - Show all commits

View File

@ -79,6 +79,10 @@ module.exports = Self => {
arg: 'landingHour',
type: 'string',
description: 'The landing hour'
}, {
arg: 'daysOnward',
type: 'number',
description: 'The days onward'
}
],
returns: {
@ -92,8 +96,11 @@ module.exports = Self => {
});
Self.filter = async(ctx, filter) => {
let conn = Self.dataSource.connector;
let where = buildFilter(ctx.args, (param, value) => {
const conn = Self.dataSource.connector;
const today = Date.vnNew();
const future = Date.vnNew();
const where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
@ -109,6 +116,12 @@ module.exports = Self => {
return {'t.landed': {gte: value}};
case 'landedTo':
return {'t.landed': {lte: value}};
case 'daysOnward':
today.setHours(0, 0, 0, 0);
future.setDate(today.getDate() + value);
future.setHours(23, 59, 59, 999);
return {'t.landed': {between: [today, future]}};
case 'id':
case 'agencyModeFk':
case 'warehouseOutFk':