Progressing on profile edition and thumbnail cropping

This commit is contained in:
2024-09-11 17:47:04 +02:00
parent e904f28b3b
commit 6856d3b9af
25 changed files with 278 additions and 88 deletions

View File

@@ -63,10 +63,10 @@ export default defineEventHandler(async (e): Promise<Return> => {
return { success: false, error: new ZodError([{ code: 'custom', path: ['password'], message: 'Mot de passe incorrect' }]) };
}
logSession(e, await setUserSession(e, { user: getData(db, id.id) }) as UserSessionRequired);
const data = await logSession(e, await setUserSession(e, { user: getData(db, id.id) }) as UserSessionRequired);
setResponseStatus(e, 201);
return { success: true, session };
return { success: true, session: data };
}
catch(err: any)
{

View File

@@ -1,5 +1,5 @@
import useDatabase from "~/composables/useDatabase";
import type { Comment } from "~/types/auth";
import type { CommentSearch } from "~/types/api";
export default defineEventHandler((e) => {
const id = getRouterParam(e, 'id');
@@ -12,5 +12,5 @@ export default defineEventHandler((e) => {
const db = useDatabase();
return db.query(`SELECT * FROM explorer_comments WHERE user_id = ?1`).all(id) as Comment[];
return db.query(`SELECT * FROM explorer_comments WHERE user_id = ?1`).all(id) as CommentSearch[];
});

View File

@@ -1,5 +1,5 @@
import useDatabase from "~/composables/useDatabase";
import type { Project } from "~/types/api";
import type { ProjectSearch } from "~/types/api";
export default defineEventHandler((e) => {
const id = getRouterParam(e, 'id');
@@ -12,5 +12,5 @@ export default defineEventHandler((e) => {
const db = useDatabase();
return db.query(`SELECT * FROM explorer_projects WHERE owner = ?1`).all(id) as Project[];
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'>[];
});