Add structured logging, navigation bar, and code cleanup
## Backend - Add Pino logging framework with timestamps and structured output - Replace all console.error statements (49+) with proper logging levels - Fix Drizzle ORM bug: replace invalid .get() calls with .limit(1) - Remove unused auth routes file (already in index.js) - Make internal functions private (remove unnecessary exports) - Simplify code by removing excessive debug logging ## Frontend - Add navigation bar to layout with: - User's callsign display - Navigation links (Dashboard, QSOs, Settings) - Logout button with red color distinction - Navigation only shows when user is logged in - Dark themed design matching footer ## Documentation - Update README.md with new project structure - Update docs/DOCUMENTATION.md with logging and nav bar info - Add logger.js to configuration section Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ const SALT_ROUNDS = 10;
|
||||
* @param {string} password - Plain text password
|
||||
* @returns {Promise<string>} Hashed password
|
||||
*/
|
||||
export async function hashPassword(password) {
|
||||
async function hashPassword(password) {
|
||||
return bcrypt.hash(password, SALT_ROUNDS);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function hashPassword(password) {
|
||||
* @param {string} hash - Hashed password
|
||||
* @returns {Promise<boolean>} True if password matches
|
||||
*/
|
||||
export async function verifyPassword(password, hash) {
|
||||
async function verifyPassword(password, hash) {
|
||||
return bcrypt.compare(password, hash);
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@ export async function verifyPassword(password, hash) {
|
||||
*/
|
||||
export async function registerUser({ email, password, callsign }) {
|
||||
// Check if user already exists
|
||||
const existingUser = await db
|
||||
const [existingUser] = await db
|
||||
.select()
|
||||
.from(users)
|
||||
.where(eq(users.email, email))
|
||||
.get();
|
||||
.limit(1);
|
||||
|
||||
if (existingUser) {
|
||||
throw new Error('Email already registered');
|
||||
@@ -72,11 +72,11 @@ export async function registerUser({ email, password, callsign }) {
|
||||
*/
|
||||
export async function authenticateUser(email, password) {
|
||||
// Find user by email
|
||||
const user = await db
|
||||
const [user] = await db
|
||||
.select()
|
||||
.from(users)
|
||||
.where(eq(users.email, email))
|
||||
.get();
|
||||
.limit(1);
|
||||
|
||||
if (!user) {
|
||||
throw new Error('Invalid email or password');
|
||||
@@ -99,11 +99,11 @@ export async function authenticateUser(email, password) {
|
||||
* @returns {Promise<Object|null>} User object (without password) or null
|
||||
*/
|
||||
export async function getUserById(userId) {
|
||||
const user = await db
|
||||
const [user] = await db
|
||||
.select()
|
||||
.from(users)
|
||||
.where(eq(users.id, userId))
|
||||
.get();
|
||||
.limit(1);
|
||||
|
||||
if (!user) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user