Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-11-27 23:47:33 +00:00
parent ab88ac896f
commit 9f5e7e2558
23 changed files with 13024 additions and 109 deletions

View File

@@ -61,7 +61,17 @@ export class AuthService {
});
// Find user by email
const user = await User.findByEmail(email);
let user: User | null = null;
try {
user = await User.findByEmail(email);
} catch (err) {
console.error('[AuthService] Database error finding user:', err);
return {
success: false,
errorCode: 'DATABASE_ERROR',
errorMessage: 'Unable to verify credentials. Please try again.',
};
}
if (!user) {
await auditContext.logUserLogin('', false, 'User not found');
return {