mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
refactor code
This commit is contained in:
Generated
+4
-4
@@ -78,7 +78,7 @@
|
||||
"eslint-plugin-react": "^7.34.3",
|
||||
"lint-staged": "^15.2.8",
|
||||
"mini-css-extract-plugin": "^2.9.0",
|
||||
"postcss": "^8.4.40",
|
||||
"postcss": "^8.4.41",
|
||||
"prettier": "^3.3.3",
|
||||
"pretty-quick": "^4.0.0",
|
||||
"tailwindcss": "^3.4.7",
|
||||
@@ -18282,9 +18282,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.40",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz",
|
||||
"integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==",
|
||||
"version": "8.4.41",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.41.tgz",
|
||||
"integrity": "sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"eslint-plugin-react": "^7.34.3",
|
||||
"lint-staged": "^15.2.8",
|
||||
"mini-css-extract-plugin": "^2.9.0",
|
||||
"postcss": "^8.4.40",
|
||||
"postcss": "^8.4.41",
|
||||
"prettier": "^3.3.3",
|
||||
"pretty-quick": "^4.0.0",
|
||||
"tailwindcss": "^3.4.7",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -127,10 +127,10 @@ const AddTeam = (props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="shadow-md rounded-box my-[1px] p-3 bg-[#ffffff]">
|
||||
<div className="shadow-md rounded-box my-[1px] p-3 bg-base-100 relative">
|
||||
<Title title="Add Team" />
|
||||
{isLoader && (
|
||||
<div className="fixed inset-0 flex justify-center items-center bg-black bg-opacity-30 z-50 rounded-box">
|
||||
<div className="absolute w-full h-full inset-0 flex justify-center items-center bg-base-content/30 z-50">
|
||||
<Loader />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -50,9 +50,7 @@ const AddUser = (props) => {
|
||||
};
|
||||
const checkUserExist = async () => {
|
||||
try {
|
||||
const res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: formdata.email
|
||||
});
|
||||
const res = await Parse.Cloud.run("getUserDetails");
|
||||
if (res) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -25,17 +25,12 @@ const DashboardCard = (props) => {
|
||||
sessionToken: localStorage.getItem("accesstoken")
|
||||
};
|
||||
let body = {};
|
||||
let currentUser;
|
||||
let currentUser1 = Parse.User.current();
|
||||
currentUser = currentUser1.id;
|
||||
let res;
|
||||
if (localStorage.getItem("Extand_Class")) {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
res = await Parse.Cloud.run("getUserDetails");
|
||||
if (res) res = res.toJSON();
|
||||
}
|
||||
if (res) {
|
||||
@@ -96,9 +91,7 @@ const DashboardCard = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
resr = data[0];
|
||||
} else {
|
||||
resr = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
resr = await Parse.Cloud.run("getUserDetails");
|
||||
if (resr) resr = resr.toJSON();
|
||||
}
|
||||
|
||||
@@ -220,15 +213,12 @@ const DashboardCard = (props) => {
|
||||
|
||||
if (restr.includes("#")) {
|
||||
try {
|
||||
const currentUser = Parse.User.current();
|
||||
let res;
|
||||
if (localStorage.getItem("Extand_Class")) {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
let resr = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
let resr = await Parse.Cloud.run("getUserDetails");
|
||||
if (res) res = resr.toJSON();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import Parse from "parse";
|
||||
import { appInfo } from "./appinfo";
|
||||
import { saveAs } from "file-saver";
|
||||
import printModule from "print-js";
|
||||
import { validplan } from "../json/plansArr";
|
||||
|
||||
export const fontsizeArr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28];
|
||||
export const fontColorArr = ["red", "black", "blue", "yellow"];
|
||||
@@ -90,13 +91,7 @@ export async function checkIsSubscribedTeam() {
|
||||
if (res.plan === "freeplan") {
|
||||
return false;
|
||||
} else if (res.billingDate) {
|
||||
const plan =
|
||||
res.plan === "team-weekly" ||
|
||||
res.plan === "team-yearly" ||
|
||||
res.plan === "teams-monthly" ||
|
||||
res.plan === "teams-yearly" ||
|
||||
res.plan === "enterprise-monthly" ||
|
||||
res.plan === "enterprise-yearly";
|
||||
const plan = validplan[res.plan] || false;
|
||||
if (plan && new Date(res.billingDate) > new Date()) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -192,32 +187,19 @@ export const pdfNewWidthFun = (divRef) => {
|
||||
};
|
||||
|
||||
//`contractUsers` function is used to get contract_User details
|
||||
export const contractUsers = async (email) => {
|
||||
const data = {
|
||||
email: email
|
||||
};
|
||||
const userDetails = await axios
|
||||
.post(`${localStorage.getItem("baseUrl")}functions/getUserDetails`, data, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||
sessionToken: localStorage.getItem("accesstoken")
|
||||
}
|
||||
})
|
||||
.then((Listdata) => {
|
||||
const json = Listdata.data;
|
||||
let data = [];
|
||||
if (json && json.result) {
|
||||
data.push(json.result);
|
||||
}
|
||||
return data;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("Err in getUserDetails cloud function", err);
|
||||
return "Error: Something went wrong!";
|
||||
});
|
||||
|
||||
return userDetails;
|
||||
export const contractUsers = async () => {
|
||||
try {
|
||||
const userDetails = await Parse.Cloud.run("getUserDetails");
|
||||
let data = [];
|
||||
if (userDetails) {
|
||||
const json = JSON.parse(JSON.stringify(userDetails));
|
||||
data.push(json);
|
||||
}
|
||||
return data;
|
||||
} catch (err) {
|
||||
console.log("Err in getUserDetails cloud function", err);
|
||||
return "Error: Something went wrong!";
|
||||
}
|
||||
};
|
||||
|
||||
//function for resize image and update width and height for mulitisigners
|
||||
|
||||
@@ -163,4 +163,12 @@ const plans = [
|
||||
}
|
||||
];
|
||||
|
||||
export const validplan = {
|
||||
"team-weekly": true,
|
||||
"team-yearly": true,
|
||||
"teams-monthly": true,
|
||||
"teams-yearly": true,
|
||||
"enterprise-monthly": true,
|
||||
"enterprise-yearly": true
|
||||
};
|
||||
export default plans;
|
||||
|
||||
@@ -220,10 +220,7 @@ const HomeLayout = () => {
|
||||
};
|
||||
|
||||
async function checkTourStatus() {
|
||||
const currentUser = Parse.User.current();
|
||||
const cloudRes = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
const cloudRes = await Parse.Cloud.run("getUserDetails");
|
||||
const res = { data: cloudRes.toJSON() };
|
||||
if (res.data && res.data.TourStatus && res.data.TourStatus.length > 0) {
|
||||
const tourStatus = res.data.TourStatus;
|
||||
|
||||
@@ -172,10 +172,7 @@ const AddAdmin = () => {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
const userSettings = appInfo.settings;
|
||||
const currentUser = Parse.User.current();
|
||||
const extUser = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
const extUser = await Parse.Cloud.run("getUserDetails");
|
||||
if (extUser) {
|
||||
const IsDisabled = extUser?.get("IsDisabled") || false;
|
||||
if (!IsDisabled) {
|
||||
|
||||
@@ -132,8 +132,9 @@ function GuestLogin() {
|
||||
setLoading(false);
|
||||
} else {
|
||||
let _user = user.data.result;
|
||||
await Parse.User.become(_user.sessionToken);
|
||||
const parseId = localStorage.getItem("parseAppId");
|
||||
const contractUserDetails = await contractUsers(_user.email);
|
||||
const contractUserDetails = await contractUsers();
|
||||
localStorage.setItem("UserInformation", JSON.stringify(_user));
|
||||
localStorage.setItem(
|
||||
`Parse/${parseId}/currentUser`,
|
||||
|
||||
@@ -102,10 +102,7 @@ function Login() {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
const userSettings = appInfo.settings;
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
})
|
||||
await Parse.Cloud.run("getUserDetails")
|
||||
.then(async (extUser) => {
|
||||
if (extUser) {
|
||||
const IsDisabled = extUser?.get("IsDisabled") || false;
|
||||
@@ -294,10 +291,7 @@ function Login() {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
const userSettings = appInfo.settings;
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
})
|
||||
await Parse.Cloud.run("getUserDetails")
|
||||
.then(async (extUser) => {
|
||||
if (extUser) {
|
||||
const IsDisabled = extUser?.get("IsDisabled") || false;
|
||||
@@ -423,9 +417,7 @@ function Login() {
|
||||
localStorage.setItem("profileImg", "");
|
||||
}
|
||||
const userSettings = appInfo.settings;
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: _user.email
|
||||
}).then(async (extUser) => {
|
||||
await Parse.Cloud.run("getUserDetails").then(async (extUser) => {
|
||||
if (extUser) {
|
||||
const IsDisabled = extUser?.get("IsDisabled") || false;
|
||||
if (!IsDisabled) {
|
||||
|
||||
@@ -498,10 +498,7 @@ function Opensigndrive() {
|
||||
};
|
||||
//function to use check tour status of open sign drive
|
||||
async function checkTourStatus() {
|
||||
const currentUser = Parse.User.current();
|
||||
const cloudRes = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
const cloudRes = await Parse.Cloud.run("getUserDetails");
|
||||
const res = { data: cloudRes.toJSON() };
|
||||
if (res.data && res.data.TourStatus && res.data.TourStatus.length > 0) {
|
||||
const tourStatus = res.data.TourStatus;
|
||||
|
||||
@@ -553,13 +553,8 @@ function PdfRequestFiles(props) {
|
||||
setRequestSignTour(true);
|
||||
} else {
|
||||
//else condition to check current user exist in contracts_Users class and check tour message status
|
||||
//if not then check user exist in contracts_Contactbook class and check tour message status
|
||||
const localuser = localStorage.getItem(
|
||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||
);
|
||||
const currentUser = JSON.parse(localuser);
|
||||
const currentUserEmail = currentUser.email;
|
||||
const res = await contractUsers(currentUserEmail);
|
||||
//if not then check user exist in contracts_Contactbook class and check tour message statu
|
||||
const res = await contractUsers();
|
||||
if (res === "Error: Something went wrong!") {
|
||||
setHandleError(t("something-went-wrong-mssg"));
|
||||
} else if (res[0] && res?.length) {
|
||||
@@ -871,8 +866,7 @@ function PdfRequestFiles(props) {
|
||||
//get ExistUserPtr object id of user class to get tenantDetails
|
||||
const objectId = pdfDetails?.[0]?.ExtUserPtr?.UserId?.objectId;
|
||||
//get ExistUserPtr email to get userDetails
|
||||
const currentUserEmail = pdfDetails?.[0]?.ExtUserPtr?.Email;
|
||||
const res = await contractUsers(currentUserEmail);
|
||||
const res = await contractUsers();
|
||||
let activeMailAdapter = "";
|
||||
if (res === "Error: Something went wrong!") {
|
||||
setHandleError(t("something-went-wrong-mssg"));
|
||||
@@ -1548,7 +1542,8 @@ function PdfRequestFiles(props) {
|
||||
} else {
|
||||
let _user = user.data.result;
|
||||
const parseId = localStorage.getItem("parseAppId");
|
||||
const contractUserDetails = await contractUsers(_user.email);
|
||||
await Parse.User.become(_user.sessionToken);
|
||||
const contractUserDetails = await contractUsers();
|
||||
localStorage.setItem("UserInformation", JSON.stringify(_user));
|
||||
localStorage.setItem(
|
||||
`Parse/${parseId}/currentUser`,
|
||||
|
||||
@@ -73,9 +73,7 @@ const PgSignUp = () => {
|
||||
if (res) {
|
||||
localStorage.removeItem("userDetails");
|
||||
try {
|
||||
const extUser = await Parse.Cloud.run("getUserDetails", {
|
||||
email: userDetails.email
|
||||
});
|
||||
const extUser = await Parse.Cloud.run("getUserDetails");
|
||||
const userRole = extUser?.get("UserRole");
|
||||
const _currentRole = userRole;
|
||||
const _role = _currentRole.replace("contracts_", "");
|
||||
@@ -232,10 +230,7 @@ const PgSignUp = () => {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
const userSettings = appInfo.settings;
|
||||
const currentUser = Parse.User.current();
|
||||
const extUser = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
const extUser = await Parse.Cloud.run("getUserDetails");
|
||||
if (extUser) {
|
||||
const IsDisabled = extUser?.get("IsDisabled") || false;
|
||||
if (!IsDisabled) {
|
||||
|
||||
@@ -403,8 +403,7 @@ function PlaceHolderSign() {
|
||||
};
|
||||
setIsLoading(loadObj);
|
||||
}
|
||||
const currentUserEmail = documentData[0]?.ExtUserPtr?.Email;
|
||||
const res = await contractUsers(currentUserEmail);
|
||||
const res = await contractUsers();
|
||||
if (res === "Error: Something went wrong!") {
|
||||
const loadObj = {
|
||||
isLoad: false
|
||||
|
||||
@@ -151,10 +151,7 @@ const SSOVerify = () => {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
const userSettings = appInfo.settings;
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
})
|
||||
await Parse.Cloud.run("getUserDetails")
|
||||
.then(async (extUser) => {
|
||||
if (extUser) {
|
||||
const IsDisabled = extUser?.get("IsDisabled") || false;
|
||||
|
||||
@@ -197,10 +197,7 @@ const Signup = () => {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
const userSettings = appInfo.settings;
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
})
|
||||
await Parse.Cloud.run("getUserDetails")
|
||||
.then(async (extUser) => {
|
||||
if (extUser) {
|
||||
const IsDisabled = extUser?.get("IsDisabled") || false;
|
||||
|
||||
@@ -295,7 +295,7 @@ function SignYourSelf() {
|
||||
setHandleError(t("something-went-wrong-mssg"));
|
||||
setIsLoading(loadObj);
|
||||
});
|
||||
const contractUsersRes = await contractUsers(jsonSender.email);
|
||||
const contractUsersRes = await contractUsers();
|
||||
if (contractUsersRes === "Error: Something went wrong!") {
|
||||
const loadObj = {
|
||||
isLoad: false
|
||||
|
||||
@@ -155,14 +155,6 @@ const TemplatePlaceholder = () => {
|
||||
const [fontColor, setFontColor] = useState();
|
||||
const [zoomPercent, setZoomPercent] = useState(0);
|
||||
const [scale, setScale] = useState(1);
|
||||
const senderUser =
|
||||
localStorage.getItem(
|
||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||
) &&
|
||||
localStorage.getItem(
|
||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||
);
|
||||
const jsonSender = JSON.parse(senderUser);
|
||||
|
||||
useEffect(() => {
|
||||
fetchTemplate();
|
||||
@@ -319,7 +311,7 @@ const TemplatePlaceholder = () => {
|
||||
setHandleError(t("something-went-wrong-mssg"));
|
||||
}
|
||||
}
|
||||
const res = await contractUsers(jsonSender.email);
|
||||
const res = await contractUsers();
|
||||
if (res[0] && res.length) {
|
||||
setSignerUserId(res[0].objectId);
|
||||
setCurrentEmail(res[0].Email);
|
||||
@@ -1541,8 +1533,8 @@ const TemplatePlaceholder = () => {
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-[23%] bg-[#FFFFFF] min-h-screen overflow-y-auto hide-scrollbar">
|
||||
<div className={`max-h-screen`}>
|
||||
<div className="w-[23%] bg-base-100 min-h-screen overflow-y-auto hide-scrollbar">
|
||||
<div className="max-h-screen">
|
||||
<SignerListPlace
|
||||
isMailSend={isMailSend}
|
||||
signerPos={signerPos}
|
||||
|
||||
@@ -224,11 +224,9 @@ const UserList = () => {
|
||||
<thead className="text-[14px]">
|
||||
<tr className="border-y-[1px]">
|
||||
{heading?.map((item, index) => (
|
||||
<React.Fragment key={index}>
|
||||
<th className="px-4 py-2">
|
||||
{t(`report-heading.${item}`)}
|
||||
</th>
|
||||
</React.Fragment>
|
||||
<th key={index} className="px-4 py-2">
|
||||
{t(`report-heading.${item}`)}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -324,9 +324,7 @@ function UserProfile() {
|
||||
) : (
|
||||
<div className="flex justify-center items-center w-full relative">
|
||||
{userNameError && (
|
||||
<div
|
||||
className={`z-[1000] fixed top-[50%] transform border-[1px] text-sm border-[#f0a8a8] bg-[#f4bebe] text-[#c42121] rounded py-[.75rem] px-[1.25rem]`}
|
||||
>
|
||||
<div className="z-[1000] fixed top-[50%] transform border-[1px] text-sm border-[#f0a8a8] bg-[#f4bebe] text-[#c42121] rounded py-[.75rem] px-[1.25rem]">
|
||||
{userNameError}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -34,14 +34,12 @@ function Webhook() {
|
||||
}
|
||||
];
|
||||
const fetchWebhook = async () => {
|
||||
const email = Parse.User.current().getEmail();
|
||||
if (isEnableSubscription) {
|
||||
const getIsSubscribe = await checkIsSubscribed();
|
||||
setIsSubscribe(getIsSubscribe);
|
||||
}
|
||||
const params = { email: email };
|
||||
try {
|
||||
const extRes = await Parse.Cloud.run("getUserDetails", params);
|
||||
const extRes = await Parse.Cloud.run("getUserDetails");
|
||||
if (extRes) {
|
||||
setWebhook(extRes.get("Webhook"));
|
||||
}
|
||||
|
||||
@@ -528,10 +528,7 @@ const ReportTable = (props) => {
|
||||
};
|
||||
|
||||
async function checkTourStatus() {
|
||||
const currentUser = Parse.User.current();
|
||||
const cloudRes = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
const cloudRes = await Parse.Cloud.run("getUserDetails");
|
||||
const res = { data: cloudRes.toJSON() };
|
||||
if (res.data && res.data.TourStatus && res.data.TourStatus.length > 0) {
|
||||
const tourStatus = res.data.TourStatus;
|
||||
|
||||
@@ -22,11 +22,16 @@ async function GetPublicTemplate(request) {
|
||||
templatQuery.notEqualTo('IsArchive', true);
|
||||
const getTemplate = await templatQuery.find({ useMasterKey: true });
|
||||
|
||||
const extend_Res = await Parse.Cloud.run('getUserDetails', {
|
||||
email: user.get('email'),
|
||||
});
|
||||
if (extend_Res) {
|
||||
return { template: getTemplate, user: user, extend_User: extend_Res };
|
||||
const extcls = new Parse.Query('contracts_Users');
|
||||
extcls.equalTo('email', user.get('email'));
|
||||
const res = await extcls.first({ useMasterKey: true });
|
||||
if (res) {
|
||||
const _res = JSON.parse(JSON.stringify(_res));
|
||||
return {
|
||||
template: getTemplate,
|
||||
user: user,
|
||||
extend_User: { Tagline: _res?.Tagline || '', SearchIndex: _res?.SearchIndex || '' },
|
||||
};
|
||||
} else {
|
||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Template not found');
|
||||
}
|
||||
|
||||
@@ -1,19 +1,39 @@
|
||||
async function getUserDetails(request) {
|
||||
try {
|
||||
const userId = request.params.userId;
|
||||
const userQuery = new Parse.Query('contracts_Users');
|
||||
userQuery.equalTo('Email', request.params.email);
|
||||
userQuery.include('TenantId');
|
||||
userQuery.include('UserId');
|
||||
userQuery.exclude('google_refresh_token')
|
||||
if (userId) {
|
||||
userQuery.equalTo('CreatedBy', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||
const reqEmail = request.params.email;
|
||||
if (reqEmail || request.user) {
|
||||
try {
|
||||
const userId = request.params.userId;
|
||||
const userQuery = new Parse.Query('contracts_Users');
|
||||
if (request?.user) {
|
||||
const email = request.user.get('email');
|
||||
userQuery.equalTo('Email', email);
|
||||
} else {
|
||||
userQuery.equalTo('Email', reqEmail);
|
||||
}
|
||||
userQuery.include('TenantId');
|
||||
userQuery.include('UserId');
|
||||
userQuery.exclude('google_refresh_token');
|
||||
if (userId) {
|
||||
userQuery.equalTo('CreatedBy', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||
}
|
||||
const res = await userQuery.first({ useMasterKey: true });
|
||||
if (res) {
|
||||
if (reqEmail) {
|
||||
return { objectId: res.id };
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Err ', err);
|
||||
const code = err?.code || 400;
|
||||
const msg = err?.message || 'Something went wrong.';
|
||||
throw new Parse.Error(code, msg);
|
||||
}
|
||||
const res = await userQuery.first({ useMasterKey: true });
|
||||
return res;
|
||||
} catch (err) {
|
||||
console.log('Err ', err);
|
||||
return err;
|
||||
} else {
|
||||
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||
}
|
||||
}
|
||||
export default getUserDetails;
|
||||
|
||||
@@ -17,7 +17,7 @@ import { exec } from 'child_process';
|
||||
import { createTransport } from 'nodemailer';
|
||||
import { app as v1 } from './cloud/customRoute/v1/apiV1.js';
|
||||
import { PostHog } from 'posthog-node';
|
||||
import { smtpenable, smtpsecure, useLocal } from './Utils.js';
|
||||
import { cloudServerUrl, smtpenable, smtpsecure, useLocal } from './Utils.js';
|
||||
import { SSOAuth } from './auth/authadapter.js';
|
||||
let fsAdapter;
|
||||
if (useLocal !== 'true') {
|
||||
@@ -98,9 +98,9 @@ export const config = {
|
||||
maxUploadSize: '30mb',
|
||||
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
|
||||
masterKeyIps: ['0.0.0.0/0', '::/0'], // '::1'
|
||||
serverURL: 'http://localhost:8080/app', // Don't forget to change to https if needed
|
||||
serverURL: cloudServerUrl, // Don't forget to change to https if needed
|
||||
verifyUserEmails: false,
|
||||
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app',
|
||||
publicServerURL: process.env.SERVER_URL || cloudServerUrl,
|
||||
// Your apps name. This will appear in the subject and body of the emails that are sent.
|
||||
appName: 'Opensign',
|
||||
allowClientClassCreation: false,
|
||||
@@ -219,8 +219,8 @@ if (!process.env.TESTING) {
|
||||
// console.log('isWindows', isWindows);
|
||||
|
||||
const migrate = isWindows
|
||||
? `set APPLICATION_ID=${process.env.APP_ID}&& set SERVER_URL=http://localhost:8080/app&& set MASTER_KEY=${process.env.MASTER_KEY}&& npx parse-dbtool migrate`
|
||||
: `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=http://localhost:8080/app MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;
|
||||
? `set APPLICATION_ID=${process.env.APP_ID}&& set SERVER_URL=${cloudServerUrl}&& set MASTER_KEY=${process.env.MASTER_KEY}&& npx parse-dbtool migrate`
|
||||
: `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=${cloudServerUrl} MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;
|
||||
exec(migrate, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error(`Error: ${error.message}`);
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// 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