feat: complete onboarding flow
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { sql } from 'drizzle-orm';
|
||||
import * as z from 'zod';
|
||||
import { users } from '~~/drizzle/schema';
|
||||
import { INSTANCE_SETTINGS_ID, instanceSettings, users } from '~~/drizzle/schema';
|
||||
import { auth } from '~~/lib/auth';
|
||||
import { db } from '~~/server/lib/db';
|
||||
|
||||
@@ -59,6 +59,12 @@ export default defineEventHandler(async (event) => {
|
||||
role: 'admin',
|
||||
},
|
||||
});
|
||||
|
||||
// A new instance starts invite only. The next setup step lets the
|
||||
// admin pick, and if they never get there it is not left open.
|
||||
await tx.insert(instanceSettings)
|
||||
.values({ id: INSTANCE_SETTINGS_ID, registration: 'invite' })
|
||||
.onConflictDoNothing();
|
||||
});
|
||||
} catch (error: any) {
|
||||
const code = error?.body?.code as string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user