Trying to add site provider

This commit is contained in:
Owen Schwartz
2024-10-13 22:45:48 -04:00
parent 2d754c4279
commit 892dd39e6d
14 changed files with 138 additions and 52 deletions

View File

@@ -54,13 +54,14 @@ export async function createSuperuserRole(orgId: number) {
const roleId = insertedRole.roleId;
// Add all current actions to the new Default role
const actionIds = Object.values(ActionsEnum);
const actionIds = await db.select().from(actions).execute();
if (actionIds.length === 0) {
logger.info('No actions to assign to the Superuser role');
return;
}
await db.insert(roleActions)
.values(actionIds.map(actionId => ({
roleId,
actionId: actionId,
orgId
})))
.values(actionIds.map(action => ({ roleId, actionId: action.actionId, orgId })))
.execute();
}