undo commit

This commit is contained in:
daniel31x13
2024-11-03 03:25:01 -05:00
parent aeafe6e15d
commit 9103f67db5
176 changed files with 9406 additions and 2367 deletions
+6 -7
View File
@@ -1,13 +1,10 @@
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: LinkIncludingShortenedCollectionAndTags,
userId: number
) => {
if (link?.collection?.id && typeof link?.collection?.id === "number") {
const setLinkCollection = async (link: PostLinkSchemaType, userId: number) => {
if (link.collection?.id && typeof link.collection?.id === "number") {
const existingCollection = await prisma.collection.findUnique({
where: {
id: link.collection.id,
@@ -29,7 +26,7 @@ const setLinkCollection = async (
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({
@@ -48,6 +45,7 @@ const setLinkCollection = async (
data: {
name: link.collection.name.trim(),
ownerId: userId,
createdById: userId,
},
});
@@ -81,6 +79,7 @@ const setLinkCollection = async (
name: "Unorganized",
ownerId: userId,
parentId: null,
createdById: userId,
},
});
}