Refactor: code quality improvements

- Extract admin.service.js from admin.controller.js (proper layering)
- Remove console.log statements from todo.controller.js
- Fix inconsistent error handling in auth.controller.js (return next)
- Remove logger.debug calls from contact.controller.js
- Add transaction management to contact.service.js addContact()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
richardtekula
2025-12-05 07:25:49 +01:00
parent ad93b3b2a9
commit 81f75d285e
6 changed files with 303 additions and 263 deletions

View File

@@ -57,7 +57,7 @@ export const login = async (req, res, next) => {
// Log failed login
await logLoginAttempt(username, false, ipAddress, userAgent, error.message);
next(error);
return next(error);
}
};
@@ -84,7 +84,7 @@ export const setPassword = async (req, res, next) => {
message: 'Heslo úspešne nastavené',
});
} catch (error) {
next(error);
return next(error);
}
};
@@ -114,7 +114,7 @@ export const linkEmail = async (req, res, next) => {
message: 'Email účet úspešne pripojený a overený',
});
} catch (error) {
next(error);
return next(error);
}
};
@@ -135,7 +135,7 @@ export const skipEmail = async (req, res, next) => {
message: 'Email setup preskočený',
});
} catch (error) {
next(error);
return next(error);
}
};
@@ -164,7 +164,7 @@ export const logout = async (req, res, next) => {
message: result.message,
});
} catch (error) {
next(error);
return next(error);
}
};
@@ -183,7 +183,7 @@ export const getSession = async (req, res, next) => {
},
});
} catch (error) {
next(error);
return next(error);
}
};
@@ -201,6 +201,6 @@ export const getMe = async (req, res, next) => {
},
});
} catch (error) {
next(error);
return next(error);
}
};