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

Closed
carlossa wants to merge 35 commits from 7917-freelancerRoute into dev
1 changed files with 3 additions and 1 deletions
Showing only changes of commit c59a68ae1f - Show all commits

View File

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