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:
2025-03-31 01:19:58 +02:00
parent 227d7224e5
commit 1d41514b26
48 changed files with 922 additions and 1156 deletions

View File

@@ -1,16 +0,0 @@
import { z } from "zod";
export const fileType = z.enum(['folder', 'file', 'markdown', 'canvas', 'map']);
export const schema = z.object({
path: z.string(),
owner: z.number().finite(),
title: z.string(),
type: fileType,
content: z.string(),
navigable: z.boolean(),
private: z.boolean(),
order: z.number().finite(),
});
export type FileType = z.infer<typeof fileType>;
export type File = z.infer<typeof schema>;

View File

@@ -1,16 +0,0 @@
import { z } from "zod";
import { fileType } from "./file";
export const single = z.object({
path: z.string(),
owner: z.number().finite(),
title: z.string(),
type: fileType,
navigable: z.boolean(),
private: z.boolean(),
order: z.number().finite(),
});
export const table = z.array(single);
export type Navigation = z.infer<typeof table>;
export type NavigationItem = z.infer<typeof single>;

View File

@@ -1,22 +1,16 @@
import { z } from "zod";
import { fileType } from "./file";
import { projectFilesTable } from "~/db/schema";
const baseItem = z.object({
export const Project = z.array(z.object({
id: z.string(),
path: z.string(),
parent: z.string(),
name: z.string(),
title: z.string(),
type: fileType,
type: z.enum(projectFilesTable.type.enumValues),
navigable: z.boolean(),
private: z.boolean(),
order: z.number().finite(),
content: z.string().optional().or(z.null()),
});
export const item: z.ZodType<ProjectItem> = baseItem.extend({
children: z.lazy(() => item.array().optional()),
});
export const project = z.array(item);
timestamp: z.string(),
}));
export type ProjectItem = z.infer<typeof baseItem> & {
children?: ProjectItem[]
};
export type ProjectType = z.infer<typeof Project>;
export type ProjectItemType = ProjectType[number];