fix: refs #7917 model
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2024-11-18 08:46:48 +01:00
parent 5e7dea94b1
commit bbe62ece6e
1 changed files with 1 additions and 2 deletions

View File

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