commit
ebb2016915
|
@ -86,6 +86,8 @@ export default async function postLink(
|
||||||
else if (contentType === "image/png") imageExtension = "png";
|
else if (contentType === "image/png") imageExtension = "png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!link.tags) link.tags = [];
|
||||||
|
|
||||||
const newLink = await prisma.link.create({
|
const newLink = await prisma.link.create({
|
||||||
data: {
|
data: {
|
||||||
url: link.url?.trim().replace(/\/+$/, "") || null,
|
url: link.url?.trim().replace(/\/+$/, "") || null,
|
||||||
|
@ -98,7 +100,7 @@ export default async function postLink(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tags: {
|
tags: {
|
||||||
connectOrCreate: link.tags.map((tag) => ({
|
connectOrCreate: link.tags?.map((tag) => ({
|
||||||
where: {
|
where: {
|
||||||
name_ownerId: {
|
name_ownerId: {
|
||||||
name: tag.name.trim(),
|
name: tag.name.trim(),
|
||||||
|
|
Ŝarĝante…
Reference in New Issue