20 lines
531 B
TypeScript
20 lines
531 B
TypeScript
import useDatabase from '~/composables/useDatabase';
|
|
|
|
export default defineEventHandler(async (e) => {
|
|
const project = getRouterParam(e, "projectId");
|
|
|
|
const where = ["id = $id"];
|
|
const criteria: Record<string, any> = { $id: project };
|
|
|
|
if (!!project) {
|
|
const db = useDatabase();
|
|
|
|
const content = db.query(`SELECT * FROM explorer_projects WHERE ${where.join(" and ")}`).get(criteria) as Project;
|
|
|
|
if (content) {
|
|
return content;
|
|
}
|
|
}
|
|
|
|
setResponseStatus(e, 404);
|
|
}); |