const serverActor = await getServerActor()
for (const file of filesToDuplicate) {
- const existing = await VideoRedundancyModel.loadByFileId(file.id)
+ const existing = await VideoRedundancyModel.loadLocalByFileId(file.id)
if (existing) {
await this.extendsExpirationOf(existing, redundancy.minLifetime)
if (!videoFile) return res.status(404).json({ error: 'Video file not found.' })
res.locals.videoFile = videoFile
- const videoRedundancy = await VideoRedundancyModel.loadByFileId(videoFile.id)
+ const videoRedundancy = await VideoRedundancyModel.loadLocalByFileId(videoFile.id)
if (!videoRedundancy)return res.status(404).json({ error: 'Video redundancy not found.' })
res.locals.videoRedundancy = videoRedundancy
return instance.VideoFile.Video.removeFile(instance.VideoFile)
}
- static loadByFileId (videoFileId: number) {
+ static async loadLocalByFileId (videoFileId: number) {
+ const actor = await getServerActor()
+
const query = {
where: {
+ actorId: actor.id,
videoFileId
}
}