updatePNI: Cleanup only for obsolete PNI

This commit is contained in:
Scott Nonnenberg
2022-12-12 14:06:16 -08:00
committed by GitHub
parent a72a431e0f
commit f366454893
6 changed files with 132 additions and 45 deletions

View File

@@ -200,6 +200,7 @@ const dataInterface: ServerInterface = {
bulkAddSessions,
removeSessionById,
removeSessionsByConversation,
removeSessionsByUUID,
removeAllSessions,
getAllSessions,
@@ -1308,6 +1309,17 @@ async function removeSessionsByConversation(
conversationId,
});
}
async function removeSessionsByUUID(uuid: UUIDStringType): Promise<void> {
const db = getInstance();
db.prepare<Query>(
`
DELETE FROM sessions
WHERE uuid = $uuid;
`
).run({
uuid,
});
}
async function removeAllSessions(): Promise<void> {
return removeAllFromTable(getInstance(), SESSIONS_TABLE);
}