🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
feat: add migration code for contracts_users class
prafull-opensignlabs93a891c8b680
diff --git a/apps/OpenSignServer/cloud/parsefunction/ZohoDetails.js b/apps/OpenSignServer/cloud/parsefunction/ZohoDetails.jsindex f3d14c616..f2249e53b 100644--- a/apps/OpenSignServer/cloud/parsefunction/ZohoDetails.js+++ b/apps/OpenSignServer/cloud/parsefunction/ZohoDetails.js@@ -50,7 +50,7 @@ export default async function ZohoDetails(request) {phone: userData.data.data.subscription.contactpersons[0].mobile,name: first_name + ' ' + last_name,email: userData.data.data.subscription.contactpersons[0].email,- nextBillingDate: userData.data.expiring_time,+ nextBillingDate: userData.data.data.subscription.next_billing_at,company: company_name,plan: userData.data.data.subscription.plan,customer_id: userData.data.data.subscription.customer_id,diff --git a/apps/OpenSignServer/databases/migrations/20231110174122-create_setclp.cjs b/apps/OpenSignServer/databases/migrations/20231110174122-create_setclp.cjsnew file mode 100644index 000000000..b3a670318--- /dev/null+++ b/apps/OpenSignServer/databases/migrations/20231110174122-create_setclp.cjs@@ -0,0 +1,60 @@+/**+ *+ * @param {Parse} Parse+ */+exports.up = async Parse => {+ // TODO: set className here+ const className = 'Contracts_Users';+ const schema = new Parse.Schema(className);+ schema.addString('Name');+ schema.addString('Phone');+ schema.addString('JobTitle');+ schema.addString('Email');+ schema.addString('Company');+ schema.addString('UserRole');+ schema.addObject('Plan');+ schema.addString('Customer_id');+ schema.addString('Subscription_id');+ schema.addString('Next_billing_date');+ schema.addBoolean('IsContactEntry');+ schema.addBoolean('ShareWithTeam');+ schema.addPointer('TenantId', "partners_Tenant")+ schema.addPointer('UserId', "_User")+ schema.addPointer("CreatedBy", "_User")+ schema.setCLP({+ get: {},+ find: {},+ count: {},+ create: {},+ update: {},+ delete: {},+ addField: {},+ });++ return schema.save();+++ // const config = new Config(process.env.APP_ID, process.env.PARSE_MOUNT);+ // const schema = await config.database.loadSchema();+ // await schema.setPermissions('myclass', {+ // get: { requiresAuthentication: true },+ // find: { requiresAuthentication: true },+ // count: { requiresAuthentication: true },+ // create: { requiresAuthentication: true },+ // update: { requiresAuthentication: true },+ // delete: { requiresAuthentication: true },+ // addField: {},+ // });+};++/**+ *+ * @param {Parse} Parse+ */+exports.down = async Parse => {+ // TODO: set className here+ const className = 'Contracts_Users';+ const schema = new Parse.Schema(className);++ return schema.purge().then(() => schema.delete());+};diff --git a/apps/OpenSignServer/index.js b/apps/OpenSignServer/index.jsindex 814d9cf58..b60238cf7 100644--- a/apps/OpenSignServer/index.js+++ b/apps/OpenSignServer/index.js@@ -17,10 +17,11 @@ import S3Adapter from 'parse-server-s3-adapter';import FSFilesAdapter from 'parse-server-fs-adapter';import AWS from 'aws-sdk';import { app as customRoute } from './cloud/customRoute/customApp.js';+import { exec } from 'child_process';const spacesEndpoint = new AWS.Endpoint(process.env.DO_ENDPOINT);// console.log("configuration ", configuration);-if (process.env.USE_LOCAL !== "TRUE") {+if (process.env.USE_LOCAL !== 'TRUE') {const s3Options = {bucket: process.env.DO_SPACE, // globalConfig.S3FilesAdapter.bucket,baseUrl: process.env.DO_BASEURL,@@ -36,7 +37,7 @@ if (process.env.USE_LOCAL !== "TRUE") {var fsAdapter = new S3Adapter(s3Options);} else {var fsAdapter = new FSFilesAdapter({- "filesSubDirectory": "files" // optional, defaults to ./files+ filesSubDirectory: 'files', // optional, defaults to ./files});}@@ -167,4 +168,22 @@ if (!process.env.TESTING) {});// This will enable the Live Query real-time serverawait ParseServer.createLiveQueryServer(httpServer);++ const migrate =+ 'APPLICATION_ID=legadranaxn SERVER_URL=http://localhost:8080/app MASTER_KEY=XnAwPDRQQyMr npx parse-dbtool migrate';+ // `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=${process.env.SERVER_URL} MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;++ exec(migrate, (error, stdout, stderr) => {+ if (error) {+ console.error(`Error: ${error.message}`);+ return;+ }++ if (stderr) {+ console.error(`Error: ${stderr}`);+ return;+ }++ console.log(`Command output: ${stdout}`);+ });}diff --git a/apps/OpenSignServer/runmigrate.js b/apps/OpenSignServer/runmigrate.jsnew file mode 100644index 000000000..1757b0e1b--- /dev/null+++ b/apps/OpenSignServer/runmigrate.js@@ -0,0 +1,37 @@+// const { exec } = require('child_process');+import { exec } from 'child_process';++const migrate =+ 'APPLICATION_ID=legadranaxn SERVER_URL=http://localhost:8080/app MASTER_KEY=XnAwPDRQQyMr npx parse-dbtool migrate';+// `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=${process.env.SERVER_URL} MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;++exec(migrate, (error, stdout, stderr) => {+ if (error) {+ console.error(`Error: ${error.message}`);+ return;+ }++ if (stderr) {+ console.error(`Error: ${stderr}`);+ return;+ }++ console.log(`Command output: ${stdout}`);+});++// const seeder =+// 'APPLICATION_ID=legadranaxn SERVER_URL=http://localhost:8080/app MASTER_KEY=XnAwPDRQQyMr npx parse-dbtool seed';++// exec(seeder, (error, stdout, stderr) => {+// if (error) {+// console.error(`Error: ${error.message}`);+// return;+// }++// if (stderr) {+// console.error(`Error: ${stderr}`);+// return;+// }++// console.log(`Command output: ${stdout}`);+// });