forked from Wroclaw/WorkshopTasker
Initial commit
This commit is contained in:
commit
1e63e008af
48 changed files with 12715 additions and 0 deletions
12
server/api/clients/count.get.ts
Normal file
12
server/api/clients/count.get.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* global defineEventHandler, createError */
|
||||
|
||||
import { database, data } from "~/server/utils/database";
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const [[data]] = await database.query(
|
||||
"SELECT COUNT(*) as `count` FROM `clients`",
|
||||
) as unknown as data<{count: number}>;
|
||||
|
||||
if (!data) throw createError("Database returned no rows");
|
||||
return data;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue