fix: refs #7917 fix methods, tests, acls #3085
|
@ -36,13 +36,7 @@ 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'],
|
||||
|
@ -55,7 +49,6 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.filter = async(ctx, filter, options) => {
|
||||
const models = Self.app.models;
|
||||
const conn = Self.dataSource.connector;
|
||||
const myOptions = {};
|
||||
|
||||
|
@ -79,7 +72,8 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
filter = mergeFilters(ctx.args?.filter ?? {}, {where});
|
||||
filter = mergeFilters(filter, {where});
|
||||
|
||||
const date = Date.vnNew();
|
||||
carlossa marked this conversation as resolved
Outdated
|
||||
date.setHours(0, 0, 0, 0);
|
||||
const stmts = [];
|
||||
|
@ -121,6 +115,7 @@ module.exports = Self => {
|
|||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
const result = await conn.executeStmt(sql, myOptions);
|
||||
|
||||
const models = Self.app.models;
|
||||
for (let agencyTerm of result)
|
||||
agencyTerm.route = await models.Route.findById(agencyTerm.routeFk);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ module.exports = Self => {
|
|||
|
||||
const myOptions = {};
|
||||
|
||||
console.log('filter.where', filter.where);
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ module.exports = Self => {
|
|||
};
|
||||
|
||||
summary.route = await Self.app.models.Route.findOne(filter);
|
||||
summary.tickets = await Self.app.models.Route.getTickets(ctx, {id, order: 'priority ASC'});
|
||||
summary.tickets = await Self.app.models.Route.getTickets({id: id, order: 'priority ASC'});
|
||||
|
||||
return summary;
|
||||
};
|
||||
|
|
|
@ -171,10 +171,8 @@ module.exports = Self => {
|
|||
Object.assign(myOptions, options);
|
||||
|
||||
const client = await Self.app.models.Client.findById(userId, null, myOptions);
|
||||
console.log('client: ', client);
|
||||
|
||||
const supplier = await Self.app.models.Supplier.findOne({where: {nif: client.fi}}, myOptions);
|
||||
console.log('supplier: ', supplier);
|
||||
return supplier;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
crear acl getRouteByAgency, comprobar los acl de mas a menos permisivo.
esta part de la tarea no la veig implementada