refactor: simplify codebase and replace external dependencies with Bun built-ins
Backend changes: - Merge duplicate award logic (calculatePointsAwardProgress + getPointsAwardEntityBreakdown) - Simplify LoTW service (merge syncQSOs functions, simplify polling) - Remove job queue abstraction (hardcode LoTW sync, remove processor registry) - Consolidate config files (database.js, logger.js, jwt.js → single config.js) - Replace bcrypt with Bun.password.hash/verify - Replace Pino logger with console-based logger - Fix: export syncQSOs and getLastLoTWQSLDate for job queue imports - Fix: correct database path resolution using new URL() Frontend changes: - Simplify auth store (remove localStorage wrappers, reduce from 222→109 lines) - Consolidate API layer (remove verbose JSDoc, 180→80 lines) - Add shared UI components (Loading, ErrorDisplay, BackButton) Dependencies: - Remove bcrypt (replaced with Bun.password) - Remove pino and pino-pretty (replaced with console logger) Total: ~445 lines removed (net), 3 dependencies removed Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Elysia, t } from 'elysia';
|
||||
import { cors } from '@elysiajs/cors';
|
||||
import { jwt } from '@elysiajs/jwt';
|
||||
import { JWT_SECRET } from './config/jwt.js';
|
||||
import logger from './config/logger.js';
|
||||
import { JWT_SECRET, logger } from './config.js';
|
||||
import {
|
||||
registerUser,
|
||||
authenticateUser,
|
||||
@@ -249,21 +248,7 @@ const app = new Elysia()
|
||||
}
|
||||
|
||||
try {
|
||||
const userData = await getUserById(user.id);
|
||||
|
||||
if (!userData || !userData.lotwUsername || !userData.lotwPassword) {
|
||||
logger.debug('/api/lotw/sync: Missing LoTW credentials', { userId: user.id });
|
||||
set.status = 400;
|
||||
return {
|
||||
success: false,
|
||||
error: 'LoTW credentials not configured. Please add them in Settings.',
|
||||
};
|
||||
}
|
||||
|
||||
const result = await enqueueJob(user.id, 'lotw_sync', {
|
||||
lotwUsername: userData.lotwUsername,
|
||||
lotwPassword: userData.lotwPassword,
|
||||
});
|
||||
const result = await enqueueJob(user.id);
|
||||
|
||||
if (!result.success && result.existingJob) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user