diff --git a/src/consts.ts b/src/consts.ts index 0a75bcf0ce5d611d161cf5c2adde828a1302cedd..39de441af2f8e2c9433d7b9094163b5e63736d0d 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -19,3 +19,4 @@ export const EMPTY_NODE_CID = CID.parse('bafyreicvlp2p65agkxpzcboedba7zit55us4zv // document kind of old cesium plus profile imported in the indexer export const CESIUM_PLUS_PROFILE_IMPORT = CID.parse('bafkreiawtammeqc55cssr2zepfpaxbmp7kquhikkagipvtefeadsw4mqvq') export const CESIUM_PLUS_PROFILE_INSERT = CID.parse('bafkreigi5phtqpo6a2f3tx4obaja4fzevy3nyvnl4bnkcxylyqnfeowzbm') +export const CESIUM_PLUS_PROFILE_DELETE = CID.parse('bafkreic5bv5ytl7zv5rh5j2bd5mw6nfrn33mxhiobgmpsiu65yjw3eeduu') diff --git a/src/indexer/database.ts b/src/indexer/database.ts index 5e81020ef2377b2dbbc5bd6c0288e9c3297eec20..b796caf2c1e421731b318882054da66cdf515572 100644 --- a/src/indexer/database.ts +++ b/src/indexer/database.ts @@ -1,4 +1,4 @@ -import { CESIUM_PLUS_PROFILE_IMPORT, CESIUM_PLUS_PROFILE_INSERT } from '../consts' +import { CESIUM_PLUS_PROFILE_IMPORT, CESIUM_PLUS_PROFILE_INSERT, CESIUM_PLUS_PROFILE_DELETE } from '../consts' import type { IndexRequest } from '../types' import { CID } from 'multiformats' import pg from 'pg' @@ -127,6 +127,12 @@ export async function handleInsertRequest(irCID: CID, ir: IndexRequest) { break } + // delete + case CESIUM_PLUS_PROFILE_DELETE.toString(): { + await client.query(`DELETE FROM profiles WHERE pubkey = $1;`, [ir.pubk]) + break + } + // unimplemented default: console.log('🔴 unimplemented kind ' + ir.kind)