DittoDB.getInstance() -> Storages.kysely()

This commit is contained in:
Alex Gleason
2024-09-11 13:23:06 -05:00
parent d2fb3fd253
commit ebc0250d81
12 changed files with 35 additions and 37 deletions

View File

@@ -6,7 +6,6 @@ import { z } from 'zod';
import { AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { DittoDB } from '@/db/DittoDB.ts';
import { nostrNow } from '@/utils.ts';
import { parseBody } from '@/utils/api.ts';
import { Storages } from '@/storages.ts';
@@ -82,7 +81,7 @@ const createTokenController: AppController = async (c) => {
async function getToken(
{ pubkey, secret, relays = [] }: { pubkey: string; secret?: string; relays?: string[] },
): Promise<`token1${string}`> {
const { kysely } = await DittoDB.getInstance();
const kysely = await Storages.kysely();
const token = generateToken();
const serverSeckey = generateSecretKey();

View File

@@ -8,7 +8,6 @@ import { z } from 'zod';
import { type AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { DittoDB } from '@/db/DittoDB.ts';
import { DittoUpload, dittoUploads } from '@/DittoUploads.ts';
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
import { getAncestors, getAuthor, getDescendants, getEvent } from '@/queries.ts';
@@ -579,7 +578,7 @@ const zappedByController: AppController = async (c) => {
const id = c.req.param('id');
const params = c.get('listPagination');
const store = await Storages.db();
const { kysely } = await DittoDB.getInstance();
const kysely = await Storages.kysely();
const zaps = await kysely.selectFrom('event_zaps')
.selectAll()

View File

@@ -4,7 +4,6 @@ import { z } from 'zod';
import { type AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { DittoDB } from '@/db/DittoDB.ts';
import { streamingConnectionsGauge } from '@/metrics.ts';
import { MuteListPolicy } from '@/policies/MuteListPolicy.ts';
import { getFeedPubkeys } from '@/queries.ts';
@@ -222,7 +221,7 @@ async function topicToFilter(
async function getTokenPubkey(token: string): Promise<string | undefined> {
if (token.startsWith('token1')) {
const { kysely } = await DittoDB.getInstance();
const kysely = await Storages.kysely();
const { user_pubkey } = await kysely
.selectFrom('nip46_tokens')