fix: refs #7917 fix userId
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2024-12-03 08:34:15 +01:00
parent 6f66b6b5ff
commit 2bf9f87394
4 changed files with 19 additions and 6 deletions

View File

@ -246,5 +246,6 @@
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
"The raid information is not correct": "The raid information is not correct",
"Payment method is required": "Payment method is required",
"Sales already moved": "Sales already moved"
"Sales already moved": "Sales already moved",
"null": "null"
}

View File

@ -173,7 +173,7 @@ module.exports = Self => {
}
});
filter = mergeFilters(ctx.args.filter, {where});
const supplier = await Self.app.models.Supplier.isSupplier(ctx);
const supplier = await Self.app.models.Supplier.isSupplier(ctx.req.accessToken.userId);
if (supplier) {
if (!filter.where) filter.where = {};
filter.where[`e.supplierFk`] = supplier.id;

View File

@ -36,7 +36,13 @@ module.exports = Self => {
arg: 'to',
type: 'date',
description: 'The to date filter',
}
},
{
arg: 'userId',
type: 'integer',
description: 'The user id',
required: true,
},
],
returns: {
type: ['object'],
@ -77,7 +83,7 @@ module.exports = Self => {
filter = mergeFilters(ctx.args?.filter ?? {}, {where});
const getRouteByAgency = await models.ACL.checkAccessAcl(ctx, 'Route', 'getRouteByAgency', 'WRITE');
const supplier = await models.Supplier.isSupplier(userId, myOptions);
const supplier = await models.Supplier.isSupplier(ctx.req.accessToken.userId, myOptions);
if (supplier && getRouteByAgency) {
if (!filter.where) filter.where = {};
filter.where[`a.supplierFk`] = supplier.id;

View File

@ -11,6 +11,12 @@ module.exports = Self => {
type: 'object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
http: {source: 'query'}
},
{
arg: 'userId',
type: 'integer',
description: 'The user id',
required: true,
}
],
returns: {
@ -87,7 +93,7 @@ module.exports = Self => {
if (!filter.where) filter.where = {};
const supplier = await Self.app.models.Supplier.isSupplier(ctx, myOptions);
const supplier = await Self.app.models.Supplier.isSupplier(ctx.req.accessToken.userId, myOptions);
if (supplier)
filter.where['sat.supplierFk'] = supplier.id;