Revert "undo commit"

This reverts commit 9103f67db5.
This commit is contained in:
daniel31x13
2024-11-03 03:27:52 -05:00
parent e37702aa14
commit dbd096ab76
176 changed files with 2362 additions and 9401 deletions
+7 -6
View File
@@ -1,10 +1,13 @@
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
import { prisma } from "./db";
import getPermission from "./getPermission";
import { UsersAndCollections } from "@prisma/client";
import { PostLinkSchemaType } from "../shared/schemaValidation";
const setLinkCollection = async (link: PostLinkSchemaType, userId: number) => {
if (link.collection?.id && typeof link.collection?.id === "number") {
const setLinkCollection = async (
link: LinkIncludingShortenedCollectionAndTags,
userId: number
) => {
if (link?.collection?.id && typeof link?.collection?.id === "number") {
const existingCollection = await prisma.collection.findUnique({
where: {
id: link.collection.id,
@@ -26,7 +29,7 @@ const setLinkCollection = async (link: PostLinkSchemaType, userId: number) => {
return null;
return existingCollection;
} else if (link.collection?.name) {
} else if (link?.collection?.name) {
if (link.collection.name === "Unorganized") {
const firstTopLevelUnorganizedCollection =
await prisma.collection.findFirst({
@@ -45,7 +48,6 @@ const setLinkCollection = async (link: PostLinkSchemaType, userId: number) => {
data: {
name: link.collection.name.trim(),
ownerId: userId,
createdById: userId,
},
});
@@ -79,7 +81,6 @@ const setLinkCollection = async (link: PostLinkSchemaType, userId: number) => {
name: "Unorganized",
ownerId: userId,
parentId: null,
createdById: userId,
},
});
}