8524-devToTest #3415

Merged
alexm merged 343 commits from 8524-devToTest into test 2025-02-04 13:42:16 +00:00
6 changed files with 24 additions and 24 deletions
Showing only changes of commit 602e822599 - Show all commits

View File

@ -109,7 +109,7 @@ module.exports = Self => {
const args = ctx.args; const args = ctx.args;
const myOptions = {}; const myOptions = {};
let to; let to;
const myTeamIds = []; let myTeamIds = [];
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
@ -135,7 +135,7 @@ module.exports = Self => {
} }
if (args.myTeam != null) if (args.myTeam != null)
myTeamIds.value = await models.Worker.myTeam(userId); myTeamIds = await models.Worker.myTeam(userId);
const where = buildFilter(ctx.args, (param, value) => { const where = buildFilter(ctx.args, (param, value) => {
switch (param) { switch (param) {
@ -172,9 +172,9 @@ module.exports = Self => {
return {'t.zoneFk': value}; return {'t.zoneFk': value};
case 'myTeam': case 'myTeam':
if (value) if (value)
return {'cl.workerFk': {inq: myTeamIds.value}}; return {'cl.workerFk': {inq: myTeamIds}};
else else
return {'cl.workerFk': {nin: myTeamIds.value}}; return {'cl.workerFk': {nin: myTeamIds}};
} }
}); });

View File

@ -123,13 +123,13 @@ module.exports = Self => {
date.setHours(0, 0, 0, 0); date.setHours(0, 0, 0, 0);
const args = ctx.args; const args = ctx.args;
const myOptions = {}; const myOptions = {};
const myTeamIds = []; let myTeamIds = [];
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
if (args.myTeam != null) if (args.myTeam != null)
myTeamIds.value = await models.Worker.myTeam(userId); myTeamIds = await models.Worker.myTeam(userId);
if (ctx.args && args.to) { if (ctx.args && args.to) {
const dateTo = args.to; const dateTo = args.to;
@ -151,9 +151,9 @@ module.exports = Self => {
case 'mine': case 'mine':
case 'myTeam': case 'myTeam':
if (value) if (value)
return {'c.salesPersonFk': {inq: myTeamIds.value}}; return {'c.salesPersonFk': {inq: myTeamIds}};
else else
return {'c.salesPersonFk': {nin: myTeamIds.value}}; return {'c.salesPersonFk': {nin: myTeamIds}};
case 'id': case 'id':
case 'clientFk': case 'clientFk':
param = `t.${param}`; param = `t.${param}`;

View File

@ -80,7 +80,7 @@ module.exports = Self => {
const conn = Self.dataSource.connector; const conn = Self.dataSource.connector;
const myOptions = {}; const myOptions = {};
const userId = ctx.req.accessToken.userId; const userId = ctx.req.accessToken.userId;
const myTeamIds = []; let myTeamIds = [];
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
@ -88,7 +88,7 @@ module.exports = Self => {
const args = ctx.args; const args = ctx.args;
if (args.myTeam != null) if (args.myTeam != null)
myTeamIds.value = await models.Worker.myTeam(userId); myTeamIds = await models.Worker.myTeam(userId);
if (args?.to) if (args?.to)
args.to.setHours(23, 59, 0, 0); args.to.setHours(23, 59, 0, 0);
@ -119,9 +119,9 @@ module.exports = Self => {
return {'o.confirmed': value ? 1 : 0}; return {'o.confirmed': value ? 1 : 0};
case 'myTeam': case 'myTeam':
if (value) if (value)
return {'c.salesPersonFk': {inq: myTeamIds.value}}; return {'c.salesPersonFk': {inq: myTeamIds}};
else else
return {'c.salesPersonFk': {nin: myTeamIds.value}}; return {'c.salesPersonFk': {nin: myTeamIds}};
case 'showEmpty': case 'showEmpty':
return {'o.total': {neq: value}}; return {'o.total': {neq: value}};
case 'id': case 'id':

View File

@ -87,7 +87,7 @@ module.exports = Self => {
const myOptions = {}; const myOptions = {};
const models = Self.app.models; const models = Self.app.models;
const args = ctx.args; const args = ctx.args;
const myTeamIds = []; let myTeamIds = [];
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
@ -96,7 +96,7 @@ module.exports = Self => {
ctx.args.attenderFk = userId; ctx.args.attenderFk = userId;
if (args.myTeam != null) if (args.myTeam != null)
myTeamIds.value = await models.Worker.myTeam(userId); myTeamIds = await models.Worker.myTeam(userId);
const today = Date.vnNew(); const today = Date.vnNew();
const future = Date.vnNew(); const future = Date.vnNew();
@ -134,9 +134,9 @@ module.exports = Self => {
return {'c.salesPersonFk': value}; return {'c.salesPersonFk': value};
case 'myTeam': case 'myTeam':
if (value) if (value)
return {'tr.requesterFk': {inq: myTeamIds.value}}; return {'tr.requesterFk': {inq: myTeamIds}};
else else
return {'tr.requesterFk': {nin: myTeamIds.value}}; return {'tr.requesterFk': {nin: myTeamIds}};
case 'daysOnward': case 'daysOnward':
today.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0);
future.setDate(today.getDate() + value); future.setDate(today.getDate() + value);

View File

@ -142,14 +142,14 @@ module.exports = Self => {
date.setHours(0, 0, 0, 0); date.setHours(0, 0, 0, 0);
const models = Self.app.models; const models = Self.app.models;
const args = ctx.args; const args = ctx.args;
const myTeamIds = []; let myTeamIds = [];
const myOptions = {}; const myOptions = {};
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
if (args.myTeam != null) if (args.myTeam != null)
myTeamIds.value = await models.Worker.myTeam(userId); myTeamIds = await models.Worker.myTeam(userId);
if (ctx.args && args.to) { if (ctx.args && args.to) {
const dateTo = args.to; const dateTo = args.to;
@ -181,9 +181,9 @@ module.exports = Self => {
case 'mine': case 'mine':
case 'myTeam': case 'myTeam':
if (value) if (value)
return {'c.salesPersonFk': {inq: myTeamIds.value}}; return {'c.salesPersonFk': {inq: myTeamIds}};
else else
return {'c.salesPersonFk': {nin: myTeamIds.value}}; return {'c.salesPersonFk': {nin: myTeamIds}};
case 'alertLevel': case 'alertLevel':
return {'ts.alertLevel': value}; return {'ts.alertLevel': value};

View File

@ -95,14 +95,14 @@ module.exports = Self => {
const conn = Self.dataSource.connector; const conn = Self.dataSource.connector;
const models = Self.app.models; const models = Self.app.models;
const args = ctx.args; const args = ctx.args;
const myTeamIds = []; let myTeamIds = [];
const myOptions = {}; const myOptions = {};
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
if (args.myTeam != null) if (args.myTeam != null)
myTeamIds.value = await models.Worker.myTeam(userId); myTeamIds = await models.Worker.myTeam(userId);
const where = buildFilter(ctx.args, (param, value) => { const where = buildFilter(ctx.args, (param, value) => {
switch (param) { switch (param) {
@ -135,9 +135,9 @@ module.exports = Self => {
return {'eu.email': {like: `%${value}%`}}; return {'eu.email': {like: `%${value}%`}};
case 'myTeam': case 'myTeam':
if (value) if (value)
return {'c.salesPersonFk': {inq: myTeamIds.value}}; return {'c.salesPersonFk': {inq: myTeamIds}};
else else
return {'c.salesPersonFk': {nin: myTeamIds.value}}; return {'c.salesPersonFk': {nin: myTeamIds}};
} }
}); });