feat: setup and roles
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { users } from '~~/drizzle/schema';
|
||||
import { db } from '~~/server/lib/db';
|
||||
|
||||
/**
|
||||
* An instance needs setting up for as long as it has no accounts. The first
|
||||
* account is created by the setup page and becomes the admin.
|
||||
*/
|
||||
export const isSetupNeeded = async (): Promise<boolean> => {
|
||||
const existing = await db.select({ id: users.id }).from(users).limit(1);
|
||||
|
||||
return existing.length === 0;
|
||||
};
|
||||
Reference in New Issue
Block a user