feat: handle undefine username/password for SMTP

This commit is contained in:
prafull-opensignlabs
2025-11-01 11:53:04 +00:00
parent e8b3c7fed8
commit 0b4548130d
11 changed files with 318 additions and 112 deletions
@@ -0,0 +1,18 @@
export default async function getSignature(request) {
const { userId } = request.params;
if (!userId) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Missing userId parameter.');
}
if (userId !== request.user?.id) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.');
}
try {
const query = new Parse.Query('contracts_Signature');
query.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
const result = await query.first({ useMasterKey: true });
return result;
} catch (err) {
console.error('Error fetching signature:', err);
throw err;
}
}