chore: snapshot before performance optimization

This commit is contained in:
Sepehr Ramezani
2026-04-17 21:14:43 +02:00
parent b6a548acd8
commit 2eceb32fd4
95 changed files with 4357 additions and 1942 deletions

View File

@@ -114,7 +114,7 @@ export async function PUT(
for (const note of allNotes) {
if (note.labels) {
try {
const noteLabels: string[] = JSON.parse(note.labels)
const noteLabels: string[] = Array.isArray(note.labels) ? (note.labels as string[]) : []
const updatedLabels = noteLabels.map(l =>
l.toLowerCase() === currentLabel.name.toLowerCase() ? newName : l
)
@@ -123,7 +123,7 @@ export async function PUT(
await prisma.note.update({
where: { id: note.id },
data: {
labels: JSON.stringify(updatedLabels)
labels: updatedLabels as any
}
})
}
@@ -211,7 +211,7 @@ export async function DELETE(
for (const note of allNotes) {
if (note.labels) {
try {
const noteLabels: string[] = JSON.parse(note.labels)
const noteLabels: string[] = Array.isArray(note.labels) ? (note.labels as string[]) : []
const filteredLabels = noteLabels.filter(
l => l.toLowerCase() !== label.name.toLowerCase()
)
@@ -220,7 +220,7 @@ export async function DELETE(
await prisma.note.update({
where: { id: note.id },
data: {
labels: filteredLabels.length > 0 ? JSON.stringify(filteredLabels) : null
labels: (filteredLabels.length > 0 ? filteredLabels : null) as any
}
})
}