8524-devToTest #3415
|
@ -109,7 +109,7 @@ module.exports = Self => {
|
|||
const args = ctx.args;
|
||||
const myOptions = {};
|
||||
let to;
|
||||
const myTeamIds = [];
|
||||
let myTeamIds = [];
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
@ -135,7 +135,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
if (args.myTeam != null)
|
||||
myTeamIds.value = await models.Worker.myTeam(userId);
|
||||
myTeamIds = await models.Worker.myTeam(userId);
|
||||
|
||||
const where = buildFilter(ctx.args, (param, value) => {
|
||||
switch (param) {
|
||||
|
@ -172,9 +172,9 @@ module.exports = Self => {
|
|||
return {'t.zoneFk': value};
|
||||
case 'myTeam':
|
||||
if (value)
|
||||
return {'cl.workerFk': {inq: myTeamIds.value}};
|
||||
return {'cl.workerFk': {inq: myTeamIds}};
|
||||
else
|
||||
return {'cl.workerFk': {nin: myTeamIds.value}};
|
||||
return {'cl.workerFk': {nin: myTeamIds}};
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -123,13 +123,13 @@ module.exports = Self => {
|
|||
date.setHours(0, 0, 0, 0);
|
||||
const args = ctx.args;
|
||||
const myOptions = {};
|
||||
const myTeamIds = [];
|
||||
let myTeamIds = [];
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (args.myTeam != null)
|
||||
myTeamIds.value = await models.Worker.myTeam(userId);
|
||||
myTeamIds = await models.Worker.myTeam(userId);
|
||||
|
||||
if (ctx.args && args.to) {
|
||||
const dateTo = args.to;
|
||||
|
@ -151,9 +151,9 @@ module.exports = Self => {
|
|||
case 'mine':
|
||||
case 'myTeam':
|
||||
if (value)
|
||||
return {'c.salesPersonFk': {inq: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {inq: myTeamIds}};
|
||||
else
|
||||
return {'c.salesPersonFk': {nin: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {nin: myTeamIds}};
|
||||
case 'id':
|
||||
case 'clientFk':
|
||||
param = `t.${param}`;
|
||||
|
|
|
@ -80,7 +80,7 @@ module.exports = Self => {
|
|||
const conn = Self.dataSource.connector;
|
||||
const myOptions = {};
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const myTeamIds = [];
|
||||
let myTeamIds = [];
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
@ -88,7 +88,7 @@ module.exports = Self => {
|
|||
const args = ctx.args;
|
||||
|
||||
if (args.myTeam != null)
|
||||
myTeamIds.value = await models.Worker.myTeam(userId);
|
||||
myTeamIds = await models.Worker.myTeam(userId);
|
||||
|
||||
if (args?.to)
|
||||
args.to.setHours(23, 59, 0, 0);
|
||||
|
@ -119,9 +119,9 @@ module.exports = Self => {
|
|||
return {'o.confirmed': value ? 1 : 0};
|
||||
case 'myTeam':
|
||||
if (value)
|
||||
return {'c.salesPersonFk': {inq: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {inq: myTeamIds}};
|
||||
else
|
||||
return {'c.salesPersonFk': {nin: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {nin: myTeamIds}};
|
||||
case 'showEmpty':
|
||||
return {'o.total': {neq: value}};
|
||||
case 'id':
|
||||
|
|
|
@ -87,7 +87,7 @@ module.exports = Self => {
|
|||
const myOptions = {};
|
||||
const models = Self.app.models;
|
||||
const args = ctx.args;
|
||||
const myTeamIds = [];
|
||||
let myTeamIds = [];
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
@ -96,7 +96,7 @@ module.exports = Self => {
|
|||
ctx.args.attenderFk = userId;
|
||||
|
||||
if (args.myTeam != null)
|
||||
myTeamIds.value = await models.Worker.myTeam(userId);
|
||||
myTeamIds = await models.Worker.myTeam(userId);
|
||||
|
||||
const today = Date.vnNew();
|
||||
const future = Date.vnNew();
|
||||
|
@ -134,9 +134,9 @@ module.exports = Self => {
|
|||
return {'c.salesPersonFk': value};
|
||||
case 'myTeam':
|
||||
if (value)
|
||||
return {'tr.requesterFk': {inq: myTeamIds.value}};
|
||||
return {'tr.requesterFk': {inq: myTeamIds}};
|
||||
else
|
||||
return {'tr.requesterFk': {nin: myTeamIds.value}};
|
||||
return {'tr.requesterFk': {nin: myTeamIds}};
|
||||
case 'daysOnward':
|
||||
today.setHours(0, 0, 0, 0);
|
||||
future.setDate(today.getDate() + value);
|
||||
|
|
|
@ -142,14 +142,14 @@ module.exports = Self => {
|
|||
date.setHours(0, 0, 0, 0);
|
||||
const models = Self.app.models;
|
||||
const args = ctx.args;
|
||||
const myTeamIds = [];
|
||||
let myTeamIds = [];
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (args.myTeam != null)
|
||||
myTeamIds.value = await models.Worker.myTeam(userId);
|
||||
myTeamIds = await models.Worker.myTeam(userId);
|
||||
|
||||
if (ctx.args && args.to) {
|
||||
const dateTo = args.to;
|
||||
|
@ -181,9 +181,9 @@ module.exports = Self => {
|
|||
case 'mine':
|
||||
case 'myTeam':
|
||||
if (value)
|
||||
return {'c.salesPersonFk': {inq: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {inq: myTeamIds}};
|
||||
else
|
||||
return {'c.salesPersonFk': {nin: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {nin: myTeamIds}};
|
||||
|
||||
case 'alertLevel':
|
||||
return {'ts.alertLevel': value};
|
||||
|
|
|
@ -95,14 +95,14 @@ module.exports = Self => {
|
|||
const conn = Self.dataSource.connector;
|
||||
const models = Self.app.models;
|
||||
const args = ctx.args;
|
||||
const myTeamIds = [];
|
||||
let myTeamIds = [];
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (args.myTeam != null)
|
||||
myTeamIds.value = await models.Worker.myTeam(userId);
|
||||
myTeamIds = await models.Worker.myTeam(userId);
|
||||
|
||||
const where = buildFilter(ctx.args, (param, value) => {
|
||||
switch (param) {
|
||||
|
@ -135,9 +135,9 @@ module.exports = Self => {
|
|||
return {'eu.email': {like: `%${value}%`}};
|
||||
case 'myTeam':
|
||||
if (value)
|
||||
return {'c.salesPersonFk': {inq: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {inq: myTeamIds}};
|
||||
else
|
||||
return {'c.salesPersonFk': {nin: myTeamIds.value}};
|
||||
return {'c.salesPersonFk': {nin: myTeamIds}};
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue