refactor: standardize quotation marks across all files and improve code consistency

This commit is contained in:
Julien Froidefond
2025-11-27 11:40:30 +01:00
parent cc1e8c20a6
commit b2efade4d5
107 changed files with 9471 additions and 5952 deletions

View File

@@ -1,10 +1,10 @@
import { prisma } from "@/lib/prisma"
import type { Folder } from "@/lib/types"
import { prisma } from "@/lib/prisma";
import type { Folder } from "@/lib/types";
export class FolderNotFoundError extends Error {
constructor(id: string) {
super(`Folder not found: ${id}`)
this.name = "FolderNotFoundError"
super(`Folder not found: ${id}`);
this.name = "FolderNotFoundError";
}
}
@@ -17,7 +17,7 @@ export const folderService = {
color: data.color,
icon: data.icon,
},
})
});
return {
id: created.id,
@@ -25,7 +25,7 @@ export const folderService = {
parentId: created.parentId,
color: created.color,
icon: created.icon,
}
};
},
async update(id: string, data: Partial<Omit<Folder, "id">>): Promise<Folder> {
@@ -37,7 +37,7 @@ export const folderService = {
color: data.color,
icon: data.icon,
},
})
});
return {
id: updated.id,
@@ -45,34 +45,33 @@ export const folderService = {
parentId: updated.parentId,
color: updated.color,
icon: updated.icon,
}
};
},
async delete(id: string): Promise<void> {
const folder = await prisma.folder.findUnique({
where: { id },
include: { children: true },
})
});
if (!folder) {
throw new FolderNotFoundError(id)
throw new FolderNotFoundError(id);
}
// Business rule: Move accounts to root (null folderId)
await prisma.account.updateMany({
where: { folderId: id },
data: { folderId: null },
})
});
// Business rule: Move subfolders to parent (or root if no parent)
await prisma.folder.updateMany({
where: { parentId: id },
data: { parentId: folder.parentId },
})
});
await prisma.folder.delete({
where: { id },
})
});
},
}
};