mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-30 03:39:40 +02:00
feat: add migration code for contracts_users class
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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());
|
||||
};
|
||||
@@ -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 server
|
||||
await 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}`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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}`);
|
||||
// });
|
||||
Reference in New Issue
Block a user