fix: migration function

This commit is contained in:
prafull-opensignlabs
2024-07-17 15:13:14 +05:30
parent f7087dfb29
commit 1eafc113e6
6 changed files with 31 additions and 48 deletions
@@ -3,10 +3,10 @@ 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) {
const extAdminRes = await extClsQuery.find({ useMasterKey: true });
// must be only one admin
if (extAdminRes && extAdminRes.length === 1 && extAdminRes?.[0]?.get('OrganizationId')) {
return 'exist';
} else {
return 'not_exist';