2023-07-09 17:27:10 +00:00
|
|
|
import { createPentagon, z } from '@/deps.ts';
|
2023-07-09 16:47:19 +00:00
|
|
|
|
2023-07-09 17:27:10 +00:00
|
|
|
const kv = await Deno.openKv();
|
2023-07-09 16:47:19 +00:00
|
|
|
|
2023-07-09 17:27:10 +00:00
|
|
|
const userSchema = z.object({
|
|
|
|
pubkey: z.string().regex(/^[0-9a-f]{64}$/).describe('primary'),
|
|
|
|
username: z.string().regex(/^[\w_]+$/).describe('unique'),
|
|
|
|
createdAt: z.date(),
|
2023-07-09 16:47:19 +00:00
|
|
|
});
|
|
|
|
|
2023-07-09 17:27:10 +00:00
|
|
|
const db = createPentagon(kv, {
|
|
|
|
users: {
|
|
|
|
schema: userSchema,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export { db };
|