import { EntryFor, Schema, Store, } from "https://git.barnulf.net/mb/debilus/raw/commit/fc701bec680dd73be29c72164f47ee87fac540c7/mod.ts"; import { project_root } from "./utils.ts"; export const db = await Store.open( new Schema({ user: { username: "string", password: "string", upvoted_posts: ["many", "post"], upvoted_comments: ["many", "comment"], posts: ["many", "post"], }, post: { title: "string", content: "string", upvotes: "number", author: ["one", "user"], comments: ["many", "comment"], }, comment: { content: "string", upvotes: "number", author: ["one", "user"], post: ["one", "post"], }, }), `${project_root()}/local/db.kv`, ); export type User = EntryFor; export type Post = EntryFor; export type Comment = EntryFor;