| @@ -46,6 +46,7 @@ export async function savePostServer( | ||||
|     if (!post) { | ||||
|       throw new Error("Post not found"); | ||||
|     } | ||||
|     await prisma.post.delete({ where: { slug: existingSlug } }); | ||||
|     for (const tag of post.tags) { | ||||
|       const postsWithTag = await prisma.post.count({ | ||||
|         where: { tags: { some: { id: tag.id } } }, | ||||
| @@ -54,7 +55,6 @@ export async function savePostServer( | ||||
|         await prisma.tag.delete({ where: { id: tag.id } }); | ||||
|       } | ||||
|     } | ||||
|     await prisma.post.delete({ where: { slug: existingSlug } }); | ||||
|   } | ||||
|  | ||||
|   await prisma.post.create({ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user