diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index 0acb36341..86f124d88 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -164,8 +164,7 @@ module.exports = Self => { throw new UserError('The social name has an invalid format'); }); - 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;