mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-25 17:24:25 +01:00
19 lines
380 B
TypeScript
19 lines
380 B
TypeScript
import { createPentagon, z } from '@/deps.ts';
|
|
import { hexIdSchema } from '@/schema.ts';
|
|
|
|
const kv = await Deno.openKv();
|
|
|
|
const userSchema = z.object({
|
|
pubkey: hexIdSchema.describe('primary'),
|
|
username: z.string().regex(/^\w{1,30}$/).describe('unique'),
|
|
createdAt: z.date(),
|
|
});
|
|
|
|
const db = createPentagon(kv, {
|
|
users: {
|
|
schema: userSchema,
|
|
},
|
|
});
|
|
|
|
export { db };
|