mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 09:36:08 +00:00
feat(video-assets): add full video asset system (uploads, downloads, @mentions, and cleanup/billing integration)
This commit is contained in:
@@ -142,16 +142,28 @@ async function findReferencedVideoIds(videoIds: string[]): Promise<Set<string>>
|
||||
const referenced = new Set<string>();
|
||||
|
||||
for (const group of chunk(videoIds, CHUNK_SIZE)) {
|
||||
const rows = await db.videoVersion.findMany({
|
||||
where: {
|
||||
providerId: 'bunny',
|
||||
videoId: { in: group },
|
||||
},
|
||||
select: { videoId: true },
|
||||
});
|
||||
rows.forEach((row) => {
|
||||
const [versionRows, assetRows] = await Promise.all([
|
||||
db.videoVersion.findMany({
|
||||
where: {
|
||||
providerId: 'bunny',
|
||||
videoId: { in: group },
|
||||
},
|
||||
select: { videoId: true },
|
||||
}),
|
||||
db.videoAsset.findMany({
|
||||
where: {
|
||||
provider: 'BUNNY',
|
||||
providerVideoId: { in: group },
|
||||
},
|
||||
select: { providerVideoId: true },
|
||||
}),
|
||||
]);
|
||||
versionRows.forEach((row) => {
|
||||
if (row.videoId) referenced.add(row.videoId);
|
||||
});
|
||||
assetRows.forEach((row) => {
|
||||
if (row.providerVideoId) referenced.add(row.providerVideoId);
|
||||
});
|
||||
}
|
||||
|
||||
return referenced;
|
||||
|
||||
@@ -79,7 +79,7 @@ async function findReferencedUrls(urls: string[]): Promise<Set<string>> {
|
||||
}).userFeedbackScreenshot;
|
||||
|
||||
for (const group of chunk(urls, CHUNK_SIZE)) {
|
||||
const [commentRows, feedbackRows, feedbackAttachmentRows] = await Promise.all([
|
||||
const [commentRows, feedbackRows, feedbackAttachmentRows, assetRows] = await Promise.all([
|
||||
db.comment.findMany({
|
||||
where: {
|
||||
OR: [{ voiceUrl: { in: group } }, { imageUrl: { in: group } }],
|
||||
@@ -99,6 +99,10 @@ async function findReferencedUrls(urls: string[]): Promise<Set<string>> {
|
||||
select: { url: true },
|
||||
})
|
||||
: Promise.resolve([] as Array<{ url: string }>),
|
||||
db.videoAsset.findMany({
|
||||
where: { sourceUrl: { in: group } },
|
||||
select: { sourceUrl: true },
|
||||
}),
|
||||
]);
|
||||
|
||||
for (const row of commentRows) {
|
||||
@@ -111,6 +115,9 @@ async function findReferencedUrls(urls: string[]): Promise<Set<string>> {
|
||||
for (const row of feedbackAttachmentRows) {
|
||||
if (row.url) referenced.add(row.url);
|
||||
}
|
||||
for (const row of assetRows) {
|
||||
if (row.sourceUrl) referenced.add(row.sourceUrl);
|
||||
}
|
||||
}
|
||||
|
||||
return referenced;
|
||||
|
||||
Reference in New Issue
Block a user