mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-02 05:04:28 +01:00
Insert media URL into text
This commit is contained in:
@@ -51,11 +51,17 @@ async function deleteUnattachedMediaByUrl(url: string) {
|
||||
}
|
||||
|
||||
/** Get unattached media by IDs. */
|
||||
async function getUnattachedMediaByIds(kysely: Kysely<DittoTables>, ids: string[]) {
|
||||
async function getUnattachedMediaByIds(kysely: Kysely<DittoTables>, ids: string[]): Promise<UnattachedMedia[]> {
|
||||
if (!ids.length) return [];
|
||||
return await selectUnattachedMediaQuery(kysely)
|
||||
|
||||
const results = await selectUnattachedMediaQuery(kysely)
|
||||
.where('id', 'in', ids)
|
||||
.execute();
|
||||
|
||||
return results.map((row) => ({
|
||||
...row,
|
||||
data: JSON.parse(row.data),
|
||||
}));
|
||||
}
|
||||
|
||||
/** Delete rows as an event with media is being created. */
|
||||
|
||||
Reference in New Issue
Block a user