20 lines
546 B
TypeScript
20 lines
546 B
TypeScript
import useDatabase from '~/composables/useDatabase';
|
|
|
|
export default defineEventHandler(async (e) => {
|
|
const project = getRouterParam(e, "projectId");
|
|
|
|
const where = ["project = $project"];
|
|
const criteria: Record<string, any> = { $project: 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);
|
|
}); |