feat: change manager role with editot, add admin panel for self-hosting

This commit is contained in:
prafull-opensignlabs
2024-07-12 19:07:27 +05:30
parent 1e04bb4dbe
commit 2604156c7f
30 changed files with 1404 additions and 204 deletions
@@ -0,0 +1,20 @@
// `CheckAdminExist` is used to check is admin with org exist or not in db
export default async function CheckAdminExist() {
try {
const extClsQuery = new Parse.Query('contracts_Users');
extClsQuery.equalTo('UserRole', 'contracts_Admin');
extClsQuery.exists('OrganizationId');
extClsQuery.notEqualTo('IsDisabled', true);
const extAdminRes = await extClsQuery.first({ useMasterKey: true });
if (extAdminRes) {
return 'exist';
} else {
return 'not_exist';
}
} catch (err) {
console.log('err in isAdminExist', err);
const code = err?.code || 400;
const msg = err?.message || 'something went wrong.';
throw new Parse.Error(code, msg);
}
}