🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
add migration script for update menu & add IsArchive field in document cls
prafull-opensignlabs9cb0ced4f67e
diff --git a/apps/OpenSignServer/cloud/parsefunction/getDocument.js b/apps/OpenSignServer/cloud/parsefunction/getDocument.jsindex 8666cafdf..a88a97cf4 100644--- a/apps/OpenSignServer/cloud/parsefunction/getDocument.js+++ b/apps/OpenSignServer/cloud/parsefunction/getDocument.js@@ -21,6 +21,7 @@ export default async function getDocument(request) {query.include('Signers');query.include('AuditTrail.UserPtr');query.include('Placeholders');+ query.notEqualTo('IsArchive', true)const res = await query.first({ useMasterKey: true });if (res) {const acl = res.getACL();diff --git a/apps/OpenSignServer/cloud/parsefunction/reportsJson.js b/apps/OpenSignServer/cloud/parsefunction/reportsJson.jsindex 12adf13a8..1ee858372 100644--- a/apps/OpenSignServer/cloud/parsefunction/reportsJson.js+++ b/apps/OpenSignServer/cloud/parsefunction/reportsJson.js@@ -7,11 +7,11 @@ export default function reportJson(id, userId) {return {reportName: 'Draft Documents',params: {- Type: null,- $or: [- { Signers: null, SignedUrl: null },- { Signers: { $exists: true }, Placeholders: null },- ],+ Type: { $ne: 'Folder' },+ IsCompleted: { $ne: true },+ IsDeclined: { $ne: true },+ IsArchive: { $ne: true },+ $or: [{ Signers: null }, { Signers: { $exists: true }, Placeholders: null }],CreatedBy: {__type: 'Pointer',className: '_User',@@ -28,6 +28,7 @@ export default function reportJson(id, userId) {Type: { $ne: 'Folder' },IsCompleted: { $ne: true },IsDeclined: { $ne: true },+ IsArchive: { $ne: true },ExpiryDate: {$gt: { __type: 'Date', iso: new Date().toISOString() },},@@ -66,6 +67,7 @@ export default function reportJson(id, userId) {Placeholders: { $ne: null },IsCompleted: { $ne: true },IsDeclined: { $ne: true },+ IsArchive: { $ne: true },CreatedBy: {__type: 'Pointer',className: '_User',@@ -82,7 +84,7 @@ export default function reportJson(id, userId) {return {reportName: 'Completed Documents',params: {- Type: null,+ Type: { $ne: 'Folder' },IsCompleted: true,CreatedBy: {__type: 'Pointer',@@ -90,6 +92,7 @@ export default function reportJson(id, userId) {objectId: currentUserId,},IsDeclined: { $ne: true },+ IsArchive: { $ne: true },},keys: ['Name',@@ -108,6 +111,7 @@ export default function reportJson(id, userId) {reportName: 'Declined Documents',params: {Type: null,+ IsArchive: { $ne: true },IsDeclined: true,CreatedBy: {__type: 'Pointer',@@ -125,6 +129,7 @@ export default function reportJson(id, userId) {params: {IsCompleted: { $ne: true },IsDeclined: { $ne: true },+ IsArchive: { $ne: true },Type: { $ne: 'Folder' },$and: [{@@ -157,6 +162,7 @@ export default function reportJson(id, userId) {Placeholders: { $ne: null },IsCompleted: { $ne: true },IsDeclined: { $ne: true },+ IsArchive: { $ne: true },CreatedBy: {__type: 'Pointer',className: '_User',@@ -176,6 +182,7 @@ export default function reportJson(id, userId) {Type: { $ne: 'Folder' },IsCompleted: { $ne: true },IsDeclined: { $ne: true },+ IsArchive: { $ne: true },ExpiryDate: {$gt: { __type: 'Date', iso: new Date().toISOString() },},@@ -200,11 +207,11 @@ export default function reportJson(id, userId) {return {reportName: 'Drafts',params: {- Type: null,- $or: [- { Signers: null, SignedUrl: null },- { Signers: { $exists: true }, Placeholders: null },- ],+ Type: { $ne: 'Folder' },+ IsCompleted: { $ne: true },+ IsDeclined: { $ne: true },+ IsArchive: { $ne: true },+ $or: [{ Signers: null }, { Signers: { $exists: true }, Placeholders: null }],CreatedBy: {__type: 'Pointer',className: '_User',@@ -235,6 +242,7 @@ export default function reportJson(id, userId) {reportClass: 'contracts_Template',params: {Type: { $ne: 'Folder' },+ IsArchive: { $ne: true },CreatedBy: {__type: 'Pointer',className: '_User',diff --git a/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs b/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjsindex 774855dc6..e092c2db5 100644--- a/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs+++ b/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs@@ -59,7 +59,7 @@ exports.up = async Parse => {},{icon: 'fas fa-folder',- title: 'OpenSignDriveâ„¢',+ title: 'OpenSignâ„¢ Drive',target: '_self',pageType: 'mf',description: '',@@ -206,6 +206,15 @@ exports.up = async Parse => {description: '',objectId: '6TeaPr321t',},+ {+ icon: 'fas fa-folder',+ title: 'OpenSignâ„¢ Drive',+ target: '_self',+ pageType: 'mf',+ description: '',+ objectId:+ 'remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9TaWduLU1pY3JvYXBwVjIvcmVtb3RlRW50cnkuanM=&moduleToLoad=AppRoutes&remoteName=signmicroapp/legadrive',+ },{icon: 'fas fa-address-card',title: 'Reports',@@ -576,4 +585,4 @@ exports.down = async Parse => {// schema.addString('name').addNumber('cash');const batch = [revertUserMenu, revertAdminMenu];return Parse.Object.saveAll(batch, { useMasterKey: true });-};+};\ No newline at end of filediff --git a/apps/OpenSignServer/databases/migrations/20240110100110-update_document_cls_cjs.cjs b/apps/OpenSignServer/databases/migrations/20240110100110-update_document_cls_cjs.cjsnew file mode 100644index 000000000..1a95b4f46--- /dev/null+++ b/apps/OpenSignServer/databases/migrations/20240110100110-update_document_cls_cjs.cjs@@ -0,0 +1,23 @@+/**+ *+ * @param {Parse} Parse+ */+exports.up = async Parse => {+ // TODO: set className here+ const className = 'contracts_Document';+ const schema = new Parse.Schema(className);+ schema.addBoolean('IsArchive');+ return schema.update();+ };++ /**+ *+ * @param {Parse} Parse+ */+ exports.down = async Parse => {+ // TODO: set className here+ const className = 'contracts_Document';+ const schema = new Parse.Schema(className);+ schema.deleteField('IsArchive');+ return schema.update();+ };\ No newline at end of file