8062-testToMaster_2 #3059
|
@ -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':
|
||||
|
|
Loading…
Reference in New Issue