13 lines
403 B
TypeScript
13 lines
403 B
TypeScript
import { users } from '../../drizzle/schema';
|
|
import { db } from '../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;
|
|
};
|