fix company creation for admin and inviting of new employees

This commit is contained in:
Danel Kungla
2025-07-31 12:27:30 +03:00
parent 87363051cd
commit a39c21e4e7
18 changed files with 496 additions and 57 deletions

View File

@@ -239,7 +239,7 @@ export const resetPasswordAction = adminAction(
);
export const createCompanyAccountAction = enhanceAction(
async ({ name }, user) => {
async ({ name, ownerPersonalCode }, user) => {
const logger = await getLogger();
const client = getSupabaseServerClient();
const service = createCreateCompanyAccountService(client);
@@ -254,7 +254,7 @@ export const createCompanyAccountAction = enhanceAction(
const { data, error } = await service.createNewOrganizationAccount({
name,
userId: user.id,
ownerPersonalCode,
});
if (error) {
@@ -266,8 +266,7 @@ export const createCompanyAccountAction = enhanceAction(
}
logger.info(ctx, `Company account created`);
redirect(`/home/${data.slug}/settings`);
redirect(`/admin/accounts/${data.id}`);
},
{
schema: CreateCompanySchema,