From 3d1d56355d9b511be1031a136d5c90989db12df2 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 14 May 2024 18:51:35 -0500 Subject: [PATCH] Update scripts for async db --- scripts/admin-event.ts | 5 +++-- scripts/admin-role.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/admin-event.ts b/scripts/admin-event.ts index a9939adf..29d3ae2e 100644 --- a/scripts/admin-event.ts +++ b/scripts/admin-event.ts @@ -1,7 +1,7 @@ import { JsonParseStream } from '@std/json/json-parse-stream'; import { TextLineStream } from '@std/streams/text-line-stream'; -import { db } from '@/db.ts'; +import { DittoDB } from '@/db/DittoDB.ts'; import { AdminSigner } from '@/signers/AdminSigner.ts'; import { EventsDB } from '@/storages/events-db.ts'; import { type EventStub } from '@/utils/api.ts'; @@ -9,7 +9,8 @@ import { nostrNow } from '@/utils.ts'; const signer = new AdminSigner(); -const eventsDB = new EventsDB(db); +const kysely = await DittoDB.getInstance(); +const eventsDB = new EventsDB(kysely); const readable = Deno.stdin.readable .pipeThrough(new TextDecoderStream()) diff --git a/scripts/admin-role.ts b/scripts/admin-role.ts index 4fa212e7..57a17e37 100644 --- a/scripts/admin-role.ts +++ b/scripts/admin-role.ts @@ -1,12 +1,13 @@ import { NSchema } from '@nostrify/nostrify'; -import { db } from '@/db.ts'; +import { DittoDB } from '@/db/DittoDB.ts'; import { Conf } from '@/config.ts'; import { AdminSigner } from '@/signers/AdminSigner.ts'; import { EventsDB } from '@/storages/events-db.ts'; import { nostrNow } from '@/utils.ts'; -const eventsDB = new EventsDB(db); +const kysely = await DittoDB.getInstance(); +const eventsDB = new EventsDB(kysely); const [pubkey, role] = Deno.args;