Remove 4 unused database functions

This commit is contained in:
Evan Hahn 2021-05-27 11:45:45 -04:00 committed by GitHub
parent 05f9224273
commit 20e501d9f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 77 deletions

View file

@ -135,8 +135,6 @@ const dataInterface: ServerInterface = {
createOrUpdateSession,
createOrUpdateSessions,
commitSessionsAndUnprocessed,
getSessionById,
getSessionsById,
bulkAddSessions,
removeSessionById,
removeSessionsByConversation,
@ -191,12 +189,10 @@ const dataInterface: ServerInterface = {
getUnprocessedCount,
getAllUnprocessed,
saveUnprocessed,
updateUnprocessedAttempts,
updateUnprocessedWithData,
updateUnprocessedsWithData,
getUnprocessedById,
saveUnprocesseds,
removeUnprocessed,
removeAllUnprocessed,
@ -2291,27 +2287,6 @@ async function commitSessionsAndUnprocessed({
})();
}
async function getSessionById(id: string): Promise<SessionType | undefined> {
return getById(SESSIONS_TABLE, id);
}
async function getSessionsById(
conversationId: string
): Promise<Array<SessionType>> {
const db = getInstance();
const rows: JSONRows = db
.prepare<Query>(
`
SELECT json
FROM sessions
WHERE conversationId = $conversationId;
`
)
.all({
conversationId,
});
return rows.map(row => jsonToObject(row.json));
}
function bulkAddSessions(array: Array<SessionType>): Promise<void> {
return bulkAdd(SESSIONS_TABLE, array);
}
@ -4041,7 +4016,7 @@ function saveUnprocessedSync(data: UnprocessedType): string {
decrypted,
} = data;
if (!id) {
throw new Error('saveUnprocessed: id was falsey');
throw new Error('saveUnprocessedSync: id was falsey');
}
prepare(
@ -4087,22 +4062,6 @@ function saveUnprocessedSync(data: UnprocessedType): string {
return id;
}
async function saveUnprocessed(data: UnprocessedType): Promise<string> {
return saveUnprocessedSync(data);
}
async function saveUnprocesseds(
arrayOfUnprocessed: Array<UnprocessedType>
): Promise<void> {
const db = getInstance();
db.transaction(() => {
for (const unprocessed of arrayOfUnprocessed) {
assertSync(saveUnprocessedSync(unprocessed));
}
})();
}
async function updateUnprocessedAttempts(
id: string,
attempts: number