refactored Authentication
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { createRouter } from '../../create-router';
|
||||
import { officerdb, count, Users } from 'officerdb';
|
||||
|
||||
export const landingPageDataRouter = createRouter();
|
||||
|
||||
landingPageDataRouter.get('/', async (ctx) => {
|
||||
const result = await officerdb.select({ count: count() }).from(Users);
|
||||
const userCount = result[0]?.count ?? 0;
|
||||
return ctx.json({ registrationOpen: userCount === 0 });
|
||||
});
|
||||
Reference in New Issue
Block a user