16 lines
497 B
TypeScript
16 lines
497 B
TypeScript
import useDatabase from "~/composables/useDatabase";
|
|
import type { ProjectSearch } from "~/types/api";
|
|
|
|
export default defineEventHandler((e) => {
|
|
const id = getRouterParam(e, 'id');
|
|
|
|
if(!id)
|
|
{
|
|
setResponseStatus(e, 400);
|
|
return;
|
|
}
|
|
|
|
const db = useDatabase();
|
|
|
|
return db.query(`SELECT p.*, count(f.path) as pages FROM explorer_projects p LEFT JOIN explorer_files f ON p.id = f.project WHERE p.owner = ?1`).all(id) as Omit<ProjectSearch, 'username'>[];
|
|
}); |