fix: editing files that are owned by current user

This commit is contained in:
diced
2025-11-15 23:20:11 -08:00
parent d49afe60c8
commit b2db0c15a3

View File

@@ -39,7 +39,8 @@ export default fastifyPlugin(
}); });
if (!file) return res.notFound(); if (!file) return res.notFound();
if (!canInteract(req.user.role, file.User?.role ?? 'USER')) return res.notFound(); if (req.user.id !== file.User?.id && !canInteract(req.user.role, file.User?.role ?? 'USER'))
return res.notFound();
return res.send(file); return res.send(file);
}); });
@@ -56,7 +57,8 @@ export default fastifyPlugin(
}); });
if (!file) return res.notFound(); if (!file) return res.notFound();
if (!canInteract(req.user.role, file.User?.role ?? 'USER')) return res.notFound(); if (req.user.id !== file.User?.id && !canInteract(req.user.role, file.User?.role ?? 'USER'))
return res.notFound();
const data: Prisma.FileUpdateInput = {}; const data: Prisma.FileUpdateInput = {};