Refactoring search, navigation, canvas and others to fit the new data model

This commit is contained in:
2024-08-06 00:15:09 +02:00
parent e28d72fd1b
commit a3d0b3b5bd
26 changed files with 409 additions and 253 deletions

View File

@@ -1,39 +0,0 @@
import useDatabase from '~/composables/useDatabase';
export interface Comment
{
file: number;
user_id: number;
sequence: number;
position: number;
length: number;
content: string;
}
export default defineEventHandler(async (e) => {
const project = getRouterParam(e, "projectId");
const file = getRouterParam(e, "fileId");
const query = getQuery(e);
if(!project)
{
setResponseStatus(e, 404);
return;
}
const where = ["project = $project", "file = $file"];
const criteria: Record<string, any> = { $project: project, $file: file };
if(where.length > 1)
{
const db = useDatabase();
const content = db.query(`SELECT * FROM explorer_comments WHERE ${where.join(" and ")}`).all(criteria) as Comment[];
if(content.length > 0)
{
return content;
}
}
setResponseStatus(e, 404);
});