Overhaul settings and implement user preferences. Also implements dark theme toggle as part of the user settings.

This commit is contained in:
Cameron Redmore 2025-04-25 17:32:33 +01:00
parent b84f0907a8
commit 727746030c
17 changed files with 760 additions and 378 deletions

View file

@ -4,4 +4,16 @@ import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
// Export the Prisma Client instance for use in other modules
export default prisma;
export default prisma;
// Helper function for consistent error handling
export const handlePrismaError = (res, err, context) =>
{
console.error(`Error ${context}:`, err.message);
// Basic error handling, can be expanded (e.g., check for Prisma-specific error codes)
if (err.code === 'P2025')
{ // Prisma code for record not found
return res.status(404).json({ error: `${context}: Record not found` });
}
res.status(500).json({ error: `Failed to ${context}: ${err.message}` });
};