Fix 'something went wrong' error when non-existing signer attempts to sign the document

This commit is contained in:
prafull-opensignlabs
2024-10-10 17:13:22 +05:30
parent 19d96230cd
commit 51031878eb
11 changed files with 31 additions and 253633 deletions
@@ -29,7 +29,13 @@ const saveRoleContact = async contact => {
contactQuery.set('CreatedBy', contact.CreatedBy);
contactQuery.set('UserId', contact.UserId);
contactQuery.set('UserRole', 'contracts_Guest');
contactQuery.set('TenantId', contact.TenantId);
if (contact?.TenantId) {
contactQuery.set('TenantId', {
__type: 'Pointer',
className: 'partners_Tenant',
objectId: contact.TenantId,
});
}
contactQuery.set('IsDeleted', false);
const acl = new Parse.ACL();
acl.setReadAccess(contact.CreatedBy.objectId, true);
@@ -125,7 +131,7 @@ export default async function linkContactToDoc(req) {
Email: email,
Phone: _extUser?.Phone ? _extUser.Phone : '',
CreatedBy: _docRes.CreatedBy,
TenantId: _docRes.ExtUserPtr.TenantId,
TenantId: _docRes.ExtUserPtr?.TenantId?.objectId,
};
// if user present on platform create contact on the basis of extended user details
const contactRes = await saveRoleContact(contact);
@@ -177,7 +183,7 @@ export default async function linkContactToDoc(req) {
Email: email,
Phone: phone,
CreatedBy: _docRes.CreatedBy,
TenantId: _docRes.ExtUserPtr.TenantId,
TenantId: _docRes.ExtUserPtr?.TenantId?.objectId,
};
// Create new contract on the basis provided contact details by user and userId from _User class
const contactRes = await saveRoleContact(contact);
@@ -234,7 +240,7 @@ export default async function linkContactToDoc(req) {
Email: email,
Phone: phone,
CreatedBy: _docRes.CreatedBy,
TenantId: _docRes.ExtUserPtr.TenantId,
TenantId: _docRes.ExtUserPtr?.TenantId?.objectId,
};
// Create new contract on the basis provided contact details by user and userId from _User class
const contactRes = await saveRoleContact(contact);
@@ -274,7 +280,7 @@ export default async function linkContactToDoc(req) {
}
}
} catch (err) {
console.log('Err', err);
console.log('Err while creating contact link to doc', err);
}
} else {
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found.');