Starting to put back the server part. Currently the registration and login are almost ready.

This commit is contained in:
2024-11-05 18:09:42 +01:00
parent e8b521f122
commit 83ddaf19d4
52 changed files with 2022 additions and 118 deletions

View File

@@ -0,0 +1,16 @@
import useDatabase from "~/composables/useDatabase";
import type { CommentSearch } 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 * FROM explorer_comments WHERE user_id = ?1`).all(id) as CommentSearch[];
});

View File

@@ -0,0 +1,16 @@
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'>[];
});