mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
feat: create duplicate template functionality feat: add support of csv and xlsx for bulk contacts import feat: add info text for forms and dashboard button feat: implement functionality to delete a PDF page while editing the document feat: show completed documents in which signers included but not owner in completed reports feat: add delete folder button in opensign drive feat: introduce Bcc email support for sending completed documents feat: allow merging multiple pdf while drafting document and template feat: add 'My Initials' tab for auto-signing in request-sign flow feat: add support for redirect URL to navigate after document completion feat: introduce privacy policy and digital signature terms before signing documents. feat: add feature to allow adding new pages to existing document feat: add save signature, initials, stamp functionality in sign pad for logged in user feat: add preferences menu feat: add save custom email template, notifyonsignature, set timezone, allow signature types in preferences feat: secure local url feat: implement Italian language translation feat: implement German language translation feat: update menu name from report to documents and shift contactbook in main menu feat: provide edit contact functionality fix: unable to delete folder when all its documents are deleted fix: fields.push is not function fix: document loading issue in opensign drive fix: adjust the guest signature flow to display the document in full screen, eliminating any blank space which is displayed below the place holder in mobile view fix: resolve issue of instance of pdfdict or pdfstream but got undefined build(deps): update dependencies refactor: change note text from add contact form
57 lines
2.2 KiB
JavaScript
57 lines
2.2 KiB
JavaScript
import axios from 'axios';
|
|
import { cloudServerUrl } from '../../Utils.js';
|
|
const appId = process.env.APP_ID;
|
|
const masterkey = process.env.MASTER_KEY;
|
|
export default async function createBatchContact(req) {
|
|
if (!req?.user) {
|
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
|
}
|
|
if (!req.params?.contacts) {
|
|
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Please provide parameter.');
|
|
}
|
|
const contactData = JSON.parse(req.params.contacts);
|
|
if (contactData?.length > 0) {
|
|
try {
|
|
const requests = contactData.map(x => {
|
|
return {
|
|
method: 'POST',
|
|
path: '/app/classes/contracts_Contactbook',
|
|
body: {
|
|
UserRole: 'contracts_Guest',
|
|
TenantId: { __type: 'Pointer', className: 'partners_Tenant', objectId: x.TenantId },
|
|
CreatedBy: { __type: 'Pointer', className: '_User', objectId: req.user.id },
|
|
Name: x.Name,
|
|
Email: x.Email,
|
|
IsDeleted: false,
|
|
IsImported: true,
|
|
...(x?.Phone ? { Phone: `${x?.Phone}` } : {}),
|
|
ACL: { [req.user.id]: { read: true, write: true } },
|
|
},
|
|
};
|
|
});
|
|
const parseConfig = {
|
|
baseURL: cloudServerUrl,
|
|
headers: {
|
|
'X-Parse-Application-Id': appId,
|
|
'X-Parse-Master-Key': masterkey,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
};
|
|
const response = await axios.post('batch', { requests: requests }, parseConfig);
|
|
// Handle the batch query response
|
|
// console.info('createbatchcontact ', response.data);
|
|
const successCount = response?.data?.filter(item => item.success).length;
|
|
const failedCount = requests.length - successCount;
|
|
console.log(
|
|
`createbatchcontact query response: success: ${successCount}, failed: ${failedCount}`
|
|
);
|
|
return { success: successCount, failed: failedCount };
|
|
} catch (err) {
|
|
console.log('err while create batch contact', err);
|
|
throw new Parse.Error(400, 'Something went wrong, please try again later');
|
|
}
|
|
} else {
|
|
throw new Parse.Error(Parse.Error.INVALID_CONTENT_LENGTH, 'Please provide parameter');
|
|
}
|
|
}
|