upload preview functionality

This commit is contained in:
daniel31x13
2024-09-04 22:19:40 -04:00
parent e9072bba51
commit 3de8872f26
12 changed files with 301 additions and 212 deletions
@@ -25,15 +25,15 @@ export default async function updateLinkById(
(e: UsersAndCollections) => e.userId === userId
);
// If the user is able to create a link, they can pin it to their dashboard only.
if (canPinPermission) {
// If the user is part of a collection, they can pin it to their dashboard
if (canPinPermission && data.pinnedBy && data.pinnedBy[0]) {
const updatedLink = await prisma.link.update({
where: {
id: linkId,
},
data: {
pinnedBy:
data?.pinnedBy && data.pinnedBy[0]
data?.pinnedBy && data.pinnedBy[0].id === userId
? { connect: { id: userId } }
: { disconnect: { id: userId } },
},
@@ -48,7 +48,7 @@ export default async function updateLinkById(
},
});
// return { response: updatedLink, status: 200 };
return { response: updatedLink, status: 200 };
}
const targetCollectionIsAccessible = await getPermission({