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[];
});