Implement server-side file caching with service principal auth

- Remove progress meter for faster perceived load times
- Fix async getGraphToken() calls with await
- Implement service principal (app-only) authentication for file caching
- Pre-cache jobs (2242 jobs) at startup via Redis
- Background file caching for first 300 jobs on continuous cycle
- Cache refreshes every 5 minutes to keep data current
- All caches served instantly from Redis for all users/devices
- No user authentication required for backend caching
- App token auto-refreshes every 55 minutes

Changes:
- backend/src/index.ts: Added service principal flow, startup cache warming, background file caching
- frontend/public/index.html: Removed progress bar, fixed getGraphToken() awaits
- .env.example: Added GRAPH_TOKEN documentation
This commit is contained in:
2026-01-01 18:49:02 +00:00
parent 5974606071
commit 16ed6e412f
3 changed files with 265 additions and 50 deletions
+5
View File
@@ -18,6 +18,11 @@ MICROSOFT_CLIENT_SECRET=
MICROSOFT_TENANT=common
MICROSOFT_REDIRECT_URI=http://localhost:3005/api/auth/callback
# Microsoft Graph API Token (for server-side file caching)
# This token is used by the backend to pre-cache SharePoint files
# Note: Graph tokens expire after ~60 minutes and need manual refresh
GRAPH_TOKEN=
# Logging
LOG_LEVEL=info
LOG_FILE=logs/app.log