Merge pull request 'fix: refs #7283 item filters' (!3156) from 7283-fixItemFilters into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3156 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
b41e703a1b
|
@ -38,13 +38,23 @@ module.exports = Self => {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
description: 'Type id',
|
description: 'Type id',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'producerFk',
|
||||||
|
type: 'integer',
|
||||||
|
description: 'Producer id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'instrastatFk',
|
||||||
|
type: 'string',
|
||||||
|
description: 'intrastat id',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
arg: 'isActive',
|
arg: 'isActive',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description: 'Whether the item is or not active',
|
description: 'Whether the item is or not active',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'buyerFk',
|
arg: 'workerFk',
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
description: 'The buyer of the item',
|
description: 'The buyer of the item',
|
||||||
},
|
},
|
||||||
|
@ -126,14 +136,16 @@ module.exports = Self => {
|
||||||
return {'i.stemMultiplier': value};
|
return {'i.stemMultiplier': value};
|
||||||
case 'categoryFk':
|
case 'categoryFk':
|
||||||
return {'ic.id': value};
|
return {'ic.id': value};
|
||||||
case 'buyerFk':
|
case 'workerFk':
|
||||||
return {'it.workerFk': value};
|
return {'it.workerFk': value};
|
||||||
|
case 'producerFk':
|
||||||
|
return {'pr.id': value};
|
||||||
case 'supplierFk':
|
case 'supplierFk':
|
||||||
return {'s.id': value};
|
return {'s.id': value};
|
||||||
case 'origin':
|
case 'origin':
|
||||||
return {'ori.code': value};
|
return {'ori.code': value};
|
||||||
case 'intrastat':
|
case 'intrastatFk':
|
||||||
return {'intr.description': value};
|
return {'i.intrastatFk': value};
|
||||||
case 'landed':
|
case 'landed':
|
||||||
return {'lb.landed': value};
|
return {'lb.landed': value};
|
||||||
}
|
}
|
||||||
|
@ -172,6 +184,7 @@ module.exports = Self => {
|
||||||
u.name AS userName,
|
u.name AS userName,
|
||||||
ori.code AS origin,
|
ori.code AS origin,
|
||||||
ic.name AS category,
|
ic.name AS category,
|
||||||
|
i.intrastatFk,
|
||||||
intr.description AS intrastat,
|
intr.description AS intrastat,
|
||||||
b.grouping,
|
b.grouping,
|
||||||
b.packing,
|
b.packing,
|
||||||
|
|
|
@ -86,7 +86,7 @@ describe('item filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const ctx = {args: {filter: filter, buyerFk: 16}, req: {accessToken: {userId: 1}}};
|
const ctx = {args: {filter: filter, workerFk: 16}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(2);
|
||||||
|
|
Loading…
Reference in New Issue