Merge pull request #395 from OpenSignLabs/fix_dailyemailquota

fix: dailyemailquota not updating for user and default value not updating of checkbox in API
This commit is contained in:
prafull-opensignlabs
2025-03-19 15:08:50 +00:00
parent 22d27abb76
commit a3b2c797fb
40 changed files with 1601 additions and 1609 deletions
@@ -12,21 +12,18 @@ const eSignName = 'OpenSign';
const eSigncontact = 'hello@opensignlabs.com';
// `uploadFile` is used to create url in from pdfFile
async function uploadFile(
pdfName,
filepath,
) {
async function uploadFile(pdfName, filepath) {
try {
const filedata = fs.readFileSync(filepath);
let fileUrl;
const file = new Parse.File(pdfName, [...filedata], 'application/pdf');
await file.save({ useMasterKey: true });
const fileRes = getSecureUrl(file.url());
fileUrl = fileRes.url;
const file = new Parse.File(pdfName, [...filedata], 'application/pdf');
await file.save({ useMasterKey: true });
const fileRes = getSecureUrl(file.url());
fileUrl = fileRes.url;
return { imageUrl: fileUrl };
} catch (err) {
console.log('Err ', err);
// `unlinkCertificate` is used to remove exported signed pdf file from exports folder
// `unlinkCertificate` is used to remove exported certificate file from exports folder
unlinkCertificate(filepath);
}
}
@@ -86,10 +83,7 @@ export default async function generateCertificatebydocId(req) {
//below is used to save signed certificate in exports folder
fs.writeFileSync(certificatePath, signedCertificate);
const file = await uploadFile(
'certificate.pdf',
certificatePath,
);
const file = await uploadFile('certificate.pdf', certificatePath);
const updateDoc = new Parse.Object('contracts_Document');
updateDoc.id = doc.objectId;
updateDoc.set('CertificateUrl', file.imageUrl);