Fix uploading (almost)

This commit is contained in:
Alex Gleason
2024-05-18 14:32:50 -05:00
parent 7d34b9401e
commit 611a94bdcf
6 changed files with 38 additions and 28 deletions

View File

@@ -64,6 +64,14 @@ async function getUnattachedMediaByIds(kysely: Kysely<DittoTables>, ids: string[
.execute();
}
/** Get unattached media by URLs. */
async function getUnattachedMediaByUrls(kysely: Kysely<DittoTables>, urls: string[]) {
if (!urls.length) return [];
return await selectUnattachedMediaQuery(kysely)
.where('url', 'in', urls)
.execute();
}
/** Delete rows as an event with media is being created. */
async function deleteAttachedMedia(pubkey: string, urls: string[]): Promise<void> {
if (!urls.length) return;
@@ -79,6 +87,7 @@ export {
deleteUnattachedMediaByUrl,
getUnattachedMedia,
getUnattachedMediaByIds,
getUnattachedMediaByUrls,
insertUnattachedMedia,
type UnattachedMedia,
};