Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-07-12 08:32:11 +02:00
commit c0d75e20d8
1 changed files with 14 additions and 12 deletions

View File

@ -91,6 +91,7 @@ module.exports = function(Self) {
} }
}); });
const provinceId = args.provinceFk || address.provinceFk; const provinceId = args.provinceFk || address.provinceFk;
if (provinceId) {
const province = await models.Province.findById(provinceId, { const province = await models.Province.findById(provinceId, {
include: { include: {
relation: 'country' relation: 'country'
@ -105,6 +106,7 @@ module.exports = function(Self) {
const customsAgentId = args.customsAgentFk || address.customsAgentFk; const customsAgentId = args.customsAgentFk || address.customsAgentFk;
if (!isUeeMember && !customsAgentId) if (!isUeeMember && !customsAgentId)
throw new UserError(`Customs agent is required for a non UEE member`); throw new UserError(`Customs agent is required for a non UEE member`);
}
delete args.ctx; // Remove unwanted properties delete args.ctx; // Remove unwanted properties
const updatedAddress = await address.updateAttributes(ctx.args, options); const updatedAddress = await address.updateAttributes(ctx.args, options);