mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat(pipeline): insert ditto_domains values inside the parseMetadata function
This commit is contained in:
parent
d26709e947
commit
16ea9de4c2
1 changed files with 9 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ import { updateStats } from '@/utils/stats.ts';
|
|||
import { getTagSet } from '@/utils/tags.ts';
|
||||
import { getAmount } from '@/utils/bolt11.ts';
|
||||
import { DittoTables } from '@/db/DittoTables.ts';
|
||||
import { fetchDittoDomain } from '@/utils/domains.ts';
|
||||
|
||||
const debug = Debug('ditto:pipeline');
|
||||
|
||||
|
|
@ -151,6 +152,14 @@ async function parseMetadata(event: NostrEvent, signal: AbortSignal): Promise<vo
|
|||
const { kysely } = await DittoDB.getInstance();
|
||||
const { domain } = parseNip05(nip05);
|
||||
|
||||
const dittoDomain = await fetchDittoDomain(domain);
|
||||
if (dittoDomain) {
|
||||
await kysely.insertInto('ditto_domains')
|
||||
.values(dittoDomain)
|
||||
.onConflict((oc) => oc.column('domain').doUpdateSet(dittoDomain))
|
||||
.execute();
|
||||
}
|
||||
|
||||
await sql`
|
||||
INSERT INTO pubkey_domains (pubkey, domain, last_updated_at)
|
||||
VALUES (${pubkey}, ${domain}, ${event.created_at})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue