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

Draft
carlossa wants to merge 9 commits from 7917-freelancerRoute into dev
1 changed files with 1 additions and 2 deletions
Showing only changes of commit bbe62ece6e - Show all commits

View File

@ -164,8 +164,7 @@ module.exports = Self => {
throw new UserError('The social name has an invalid format');
});
carlossa marked this conversation as resolved
Review

aci es mes sencill que pases el userId directament

aci es mes sencill que pases el userId directament
Self.isSupplier = async(ctx, options = {}) => {
const userId = ctx.req.accessToken.userId;
Self.isSupplier = async(userId, options = {}) => {
const client = await Self.app.models.Client.findById(userId, options);
const supplier = await Self.app.models.Supplier.findOne({where: {nif: client.fi}}, options);
return supplier;