You've already forked obsidian-visualiser
Update DB schema to include an ID and split overview and content. Progressing on ContentEditor with the ID fixing many issues. Adding modal and sync features.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { eq, sql } from 'drizzle-orm';
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { projectFilesTable } from '~/db/schema';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const path = decodeURIComponent(getRouterParam(e, "path") ?? '');
|
||||
export default defineCachedEventHandler(async (e) => {
|
||||
const id = getRouterParam(e, "id") ?? '';
|
||||
|
||||
if(!path)
|
||||
if(!id)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
@@ -14,13 +14,14 @@ export default defineEventHandler(async (e) => {
|
||||
const db = useDatabase();
|
||||
|
||||
const content = db.select({
|
||||
'path': explorerContentTable.path,
|
||||
'owner': explorerContentTable.owner,
|
||||
'title': explorerContentTable.title,
|
||||
'type': explorerContentTable.type,
|
||||
'navigable': explorerContentTable.navigable,
|
||||
'private': explorerContentTable.private,
|
||||
}).from(explorerContentTable).where(eq(explorerContentTable.path, sql.placeholder('path'))).prepare().get({ path });
|
||||
'id': projectFilesTable.id,
|
||||
'path': projectFilesTable.path,
|
||||
'owner': projectFilesTable.owner,
|
||||
'title': projectFilesTable.title,
|
||||
'type': projectFilesTable.type,
|
||||
'navigable': projectFilesTable.navigable,
|
||||
'private': projectFilesTable.private,
|
||||
}).from(projectFilesTable).where(eq(projectFilesTable.id, sql.placeholder('id'))).prepare().get({ id });
|
||||
|
||||
if(content !== undefined)
|
||||
{
|
||||
@@ -47,4 +48,4 @@ export default defineEventHandler(async (e) => {
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
});
|
||||
}, { getKey: (e) => getRouterParam(e, "id") ?? '', });
|
||||
Reference in New Issue
Block a user