fix: refs #7917 fix methods, tests, acls #3085

Closed
carlossa wants to merge 35 commits from 7917-freelancerRoute into dev
4 changed files with 6 additions and 12 deletions
Showing only changes of commit ab536a2ec0 - Show all commits

View File

@ -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

crear acl getRouteByAgency, comprobar los acl de mas a menos permisivo.

esta part de la tarea no la veig implementada

`crear acl getRouteByAgency, comprobar los acl de mas a menos permisivo.` esta part de la tarea no la veig implementada
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);

View File

@ -28,6 +28,7 @@ module.exports = Self => {
const myOptions = {};
console.log('filter.where', filter.where);
if (typeof options == 'object')
Object.assign(myOptions, options);

View File

@ -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;
};

View File

@ -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;
};
};