feat: Add JWT auth and nomenclature sync to data-entry-app

Integrate shared JWT authentication into data-entry-app:
- Add Oracle pool initialization for auth service
- Add AuthenticationMiddleware to protect API routes
- Update all receipt endpoints to use CurrentUser from JWT
- Add shared auth router (/api/auth/login, /api/auth/refresh)

Add nomenclature synchronization feature:
- Create SQLite models for synced suppliers, local suppliers, and cash registers
- Add nomenclature router with sync triggers and CRUD endpoints
- Add sync service for Oracle → SQLite nomenclature data
- Update nomenclature_service to use synced SQLite data with fallbacks

Create shared frontend components:
- Add shared/frontend/ with LoginView.vue, auth store factory, login.css
- Integrate shared login and auth into data-entry-app frontend
- Add axios-based API service with token refresh interceptor

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-14 18:36:24 +02:00
parent 682a4b64b9
commit c5fde510a8
37 changed files with 28907 additions and 903 deletions

View File

@@ -342,8 +342,47 @@ trap cleanup SIGINT SIGTERM
print_message "Starting Data Entry Development Environment..."
echo
# Step 1: Start Backend
print_message "1. Starting Backend (FastAPI)..."
# Step 1: Start Frontend FIRST (for fast UI availability)
print_message "1. Starting Frontend (Vue.js)..."
cd data-entry-app/frontend/
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
print_message "Installing frontend dependencies..."
npm install
fi
# Check for WSL compatibility
if [ -f "node_modules/.bin/vite.cmd" ] && [ ! -f "node_modules/.bin/vite" ]; then
print_warning "Windows node_modules detected, reinstalling for WSL..."
rm -rf node_modules package-lock.json
npm install
fi
# Start frontend in background
print_message "Starting Vite development server..."
npm run dev -- --port 3010 > /tmp/data_entry_frontend.log 2>&1 &
FRONTEND_PID=$!
# Wait for frontend to start
sleep 3
for i in {1..10}; do
if check_port 3010; then
print_success "Frontend started on http://localhost:3010"
break
fi
if [ $i -eq 10 ]; then
print_error "Frontend failed to start after 10 attempts"
print_message "Check log at /tmp/data_entry_frontend.log"
cat /tmp/data_entry_frontend.log
cleanup
fi
sleep 1
done
# Step 2: Start Backend (with OCR loading in background)
print_message "2. Starting Backend (FastAPI + OCR)..."
# Check if backend port is already in use
if check_port 8003; then
@@ -355,7 +394,7 @@ if check_port 8003; then
fi
fi
cd data-entry-app/backend/
cd ../backend/
# Check if .env file exists
if [ ! -f ".env" ]; then
@@ -391,59 +430,22 @@ mkdir -p data/uploads
print_message "Running database migrations..."
alembic upgrade head 2>/dev/null || print_warning "Migration may have already been applied or first run"
# Start backend in background
print_message "Starting uvicorn server..."
uvicorn app.main:app --host 0.0.0.0 --port 8003 --reload &
# Start backend in background (OCR loads asynchronously)
print_message "Starting uvicorn server (OCR loads in background)..."
uvicorn app.main:app --host 0.0.0.0 --port 8003 --reload > /tmp/data_entry_backend.log 2>&1 &
BACKEND_PID=$!
# Wait for backend to start
sleep 2
for i in {1..10}; do
if check_port 8003; then
print_success "Backend started successfully on http://localhost:8003"
break
fi
if [ $i -eq 10 ]; then
print_error "Backend failed to start after 10 attempts"
cleanup
fi
sleep 1
done
# Step 2: Start Frontend
print_message "2. Starting Frontend (Vue.js)..."
cd ../frontend/
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
print_message "Installing frontend dependencies..."
npm install
fi
# Check for WSL compatibility
if [ -f "node_modules/.bin/vite.cmd" ] && [ ! -f "node_modules/.bin/vite" ]; then
print_warning "Windows node_modules detected, reinstalling for WSL..."
rm -rf node_modules package-lock.json
npm install
fi
# Start frontend in background
print_message "Starting Vite development server..."
npm run dev -- --port 3010 > /tmp/data_entry_frontend.log 2>&1 &
FRONTEND_PID=$!
# Wait for frontend to start
# Wait for backend to start (uvicorn --reload takes longer to bind)
sleep 3
for i in {1..10}; do
if check_port 3010; then
print_success "Frontend started successfully on http://localhost:3010"
for i in {1..20}; do
if check_port 8003; then
print_success "Backend started on http://localhost:8003"
print_message "Note: OCR engine loading in background (first OCR request may be slow)"
break
fi
if [ $i -eq 10 ]; then
print_error "Frontend failed to start after 10 attempts"
print_message "Check log at /tmp/data_entry_frontend.log"
cat /tmp/data_entry_frontend.log
if [ $i -eq 20 ]; then
print_error "Backend failed to start after 20 attempts"
cat /tmp/data_entry_backend.log
cleanup
fi
sleep 1