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

Closed
carlossa wants to merge 35 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 Outdated

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 = {}) => {
carlossa marked this conversation as resolved Outdated

ací es on dia que no cal pasar ctx, sino userId

ací es on dia que no cal pasar ctx, sino userId
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;