Added comment about loop
This commit is contained in:
parent
2ace10c058
commit
58e2fb22c9
|
@ -1,11 +1,11 @@
|
||||||
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
||||||
import updateLinkById from "../linkId/updateLinkById";
|
import updateLinkById from "../linkId/updateLinkById";
|
||||||
|
|
||||||
// Need to fix this
|
|
||||||
export default async function updateLinks(userId: number, links: LinkIncludingShortenedCollectionAndTags[], newData: Pick<LinkIncludingShortenedCollectionAndTags, "tags" | "collectionId">) {
|
export default async function updateLinks(userId: number, links: LinkIncludingShortenedCollectionAndTags[], newData: Pick<LinkIncludingShortenedCollectionAndTags, "tags" | "collectionId">) {
|
||||||
let allUpdatesSuccessful = true;
|
let allUpdatesSuccessful = true;
|
||||||
console.log(newData)
|
|
||||||
|
|
||||||
|
// Have to use a loop here rather than updateMany, see the following:
|
||||||
|
// https://github.com/prisma/prisma/issues/3143
|
||||||
for (const link of links) {
|
for (const link of links) {
|
||||||
const updatedData: LinkIncludingShortenedCollectionAndTags = {
|
const updatedData: LinkIncludingShortenedCollectionAndTags = {
|
||||||
...link,
|
...link,
|
||||||
|
|
Ŝarĝante…
Reference in New Issue