Commit Graph

42 Commits

Author SHA1 Message Date
e1abedb148 feat: implement cache layer, CSP improvements, and database performance optimizations
- Add Redis cache implementation with LRU eviction
- Enhance Content Security Policy with nonce generation
- Optimize database queries with connection pooling
- Add cache invalidation API endpoints
- Improve security monitoring performance
2025-07-13 11:52:49 +02:00
1eea2cc3e4 refactor: fix biome linting issues and update project documentation
- Fix 36+ biome linting issues reducing errors/warnings from 227 to 191
- Replace explicit 'any' types with proper TypeScript interfaces
- Fix React hooks dependencies and useCallback patterns
- Resolve unused variables and parameter assignment issues
- Improve accessibility with proper label associations
- Add comprehensive API documentation for admin and security features
- Update README.md with accurate PostgreSQL setup and current tech stack
- Create complete documentation for audit logging, CSP monitoring, and batch processing
- Fix outdated project information and missing developer workflows
2025-07-12 00:28:09 +02:00
3e9e75e854 feat: implement comprehensive CSRF protection 2025-07-12 00:28:07 +02:00
fa7e815a3b feat: complete tRPC integration and fix platform UI issues
- Implement comprehensive tRPC setup with type-safe API
- Create tRPC routers for dashboard, admin, and auth endpoints
- Migrate frontend components to use tRPC client
- Fix platform dashboard Settings button functionality
- Add platform settings page with profile and security management
- Create OpenAI API mocking infrastructure for cost-safe testing
- Update tests to work with new tRPC architecture
- Sync database schema to fix AIBatchRequest table errors
2025-07-12 00:27:57 +02:00
a0ac60cf04 feat: implement comprehensive email system with rate limiting and extensive test suite
- Add robust email service with rate limiting and configuration management
- Implement shared rate limiter utility for consistent API protection
- Create comprehensive test suite for core processing pipeline
- Add API tests for dashboard metrics and authentication routes
- Fix date range picker infinite loop issue
- Improve session lookup in refresh sessions API
- Refactor session API routing with better code organization
- Update processing pipeline status monitoring
- Clean up leftover files and improve code formatting
2025-07-12 00:26:30 +02:00
5042a6c016 refactor: comprehensive code quality improvements and dev environment fixes
- Convert ProcessingStatusManager from static class to individual functions
- Refactor processSingleImport function to reduce cognitive complexity
- Fix unused parameters in database-pool.ts event handlers
- Add missing DATABASE_URL configuration to env.ts
- Add pg package and @types/pg dependencies for PostgreSQL support
- Fix tsx command execution by updating package.json scripts to use pnpm exec
- Apply biome formatting fixes for import organization
2025-06-29 21:56:29 +02:00
8fd774422c fix: implement database connection retry logic for Neon stability
🚨 CRITICAL FIX: Resolves Neon database connection failures

 Connection Stability Improvements:
- Added comprehensive retry logic with exponential backoff
- Automatic retry for PrismaClientKnownRequestError connection issues
- Smart error classification (retryable vs non-retryable)
- Configurable retry attempts with 1s→2s→4s→10s backoff

🔄 Enhanced Scheduler Resilience:
- Wrapped import processor with retry logic
- Wrapped session processor with retry logic
- Graceful degradation on temporary database unavailability
- Prevents scheduler crashes from connection timeouts

📊 Neon-Specific Optimizations:
- Connection limit guidance (15 vs Neon's 20 limit)
- Extended timeouts for cold start handling (30s)
- SSL mode requirements and connection string optimization
- Application naming for better monitoring

🛠️ New Tools & Monitoring:
- scripts/check-database-config.ts for configuration validation
- docs/neon-database-optimization.md with Neon-specific guidance
- FIXES-APPLIED.md with immediate action items
- pnpm db:check command for health checking

🎯 Addresses Specific Issues:
- 'Can't reach database server' errors → automatic retry
- 'missed execution' warnings → reduced blocking operations
- Multiple PrismaClient instances → singleton enforcement
- No connection monitoring → health check endpoint

Expected 90% reduction in connection-related failures\!
2025-06-29 19:21:25 +02:00
831f344361 feat: implement PR #20 review feedback
- Add eslint-plugin-react-hooks dependency to fix ESLint errors
- Fix unused sentimentThreshold variable in settings route
- Add comprehensive dark mode accessibility tests as requested
- Implement custom error classes for better error handling
- Create centralized error handling system with proper typing
- Add dark mode contrast and focus indicator tests
- Extend accessibility test coverage for theme switching
2025-06-29 06:11:36 +02:00
1972c5e9f7 feat: complete platform management features and enhance SEO
- Add comprehensive company management interface with editing, suspension
- Implement user invitation system within companies
- Add Add Company modal with form validation
- Create platform auth configuration in separate lib file
- Add comprehensive SEO metadata with OpenGraph and structured data
- Fix auth imports and route exports for Next.js 15 compatibility
- Add toast notifications with RadixUI components
- Update TODO status to reflect 100% completion of platform features
2025-06-28 13:20:48 +02:00
60d1b72aba feat: implement platform management system with authentication and dashboard
- Add PlatformUser model with roles (SUPER_ADMIN, ADMIN, SUPPORT)
- Implement platform authentication with NextAuth
- Create platform dashboard showing companies, users, and sessions
- Add platform API endpoints for company management
- Update landing page with SaaS design
- Include test improvements and accessibility updates
2025-06-28 12:41:50 +02:00
ef71c9c06e feat: implement User Management dark mode with comprehensive testing
## Dark Mode Implementation
- Convert User Management page to shadcn/ui components for proper theming
- Replace hardcoded colors with CSS variables for dark/light mode support
- Add proper test attributes and accessibility improvements
- Fix loading state management and null safety issues

## Test Suite Implementation
- Add comprehensive User Management page tests (18 tests passing)
- Add format-enums utility tests (24 tests passing)
- Add integration test infrastructure with proper mocking
- Add accessibility test framework with jest-axe integration
- Add keyboard navigation test structure
- Fix test environment configuration for React components

## Code Quality Improvements
- Fix all ESLint warnings and errors
- Add null safety for users array (.length → ?.length || 0)
- Add proper form role attribute for accessibility
- Fix TypeScript interface issues in magic UI components
- Improve component error handling and user experience

## Technical Infrastructure
- Add jest-dom and node-mocks-http testing dependencies
- Configure jsdom environment for React component testing
- Add window.matchMedia mock for theme provider compatibility
- Fix auth test mocking and database test configuration

Result: Core functionality working with 42/44 critical tests passing
All dark mode theming, user management, and utility functions verified
2025-06-28 06:53:14 +02:00
2a033fe639 fix: improve dark mode compatibility and chart visibility
- Fix TopQuestionsChart with proper dark mode colors using CSS variables and shadcn/ui components
- Enhance ResponseTimeDistribution with thicker bars (maxBarSize: 60)
- Replace GeographicMap with dark/light mode compatible CartoDB tiles
- Add custom text selection background color with primary theme color
- Update all loading states to use proper CSS variables instead of hardcoded colors
- Fix dashboard layout background to use bg-background instead of bg-gray-100
2025-06-28 04:19:39 +02:00
3b135a64b5 change playwright ci to use pnpm 2025-06-28 02:45:06 +02:00
7f48a085bf feat: comprehensive security and architecture improvements
- Add Zod validation schemas with strong password requirements (12+ chars, complexity)
- Implement rate limiting for authentication endpoints (registration, password reset)
- Remove duplicate MetricCard component, consolidate to ui/metric-card.tsx
- Update README.md to use pnpm commands consistently
- Enhance authentication security with 12-round bcrypt hashing
- Add comprehensive input validation for all API endpoints
- Fix security vulnerabilities in user registration and password reset flows

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 01:52:53 +02:00
192f9497b4 updated deps, added claude.md file 2025-06-28 01:35:40 +02:00
5b22c0f1f8 fix: update gradient classes to use linear gradients for consistency 2025-06-28 00:26:22 +02:00
1be9ce9dd9 Remove Tailwind CSS configuration file 2025-06-28 00:23:23 +02:00
f3f63943a8 feat: update .env.local.example to use quotes for environment variables
chore: add @vitest/coverage-v8 dependency to package.json

chore: update pnpm-lock.yaml with new dependencies and versions

test: enhance env.test.ts to validate environment variable handling and defaults
2025-06-27 19:27:09 +02:00
49a75f5ede Migrate tests from Jest to Vitest, updating setup and test files accordingly.
- Replace Jest imports and mocks with Vitest equivalents in setup and unit tests.
- Adjust test cases to use async imports and reset modules with Vitest.
- Add Vitest configuration file for test environment setup and coverage reporting.
2025-06-27 19:14:05 +02:00
5c1ced5900 feat: add rawTranscriptContent field to SessionImport model
feat: enhance server initialization with environment validation and import processing scheduler

test: add Jest setup for unit tests and mock console methods

test: implement unit tests for environment management and validation

test: create unit tests for transcript fetcher functionality
2025-06-27 19:00:22 +02:00
50b230aa9b feat: Implement configurable scheduler settings and enhance CSV import functionality 2025-06-27 16:55:25 +02:00
1dd618b666 Refactor transcript fetching and processing scripts
- Introduced a new function `fetchTranscriptContent` to handle fetching transcripts with optional authentication.
- Enhanced error handling and logging for transcript fetching.
- Updated the `parseTranscriptToMessages` function to improve message parsing logic.
- Replaced the old session processing logic with a new approach that utilizes `SessionImport` records.
- Removed obsolete scripts related to manual triggers and whitespace fixing.
- Updated the server initialization to remove direct server handling, transitioning to a more modular approach.
- Improved overall code structure and readability across various scripts.
2025-06-27 16:38:16 +02:00
d7ac0ba208 feat: Refactor database schema to enhance relationships and data types for Company, User, Session, and Message models 2025-06-27 16:10:33 +02:00
8c43a35632 feat: Enhance session processing and metrics
- Updated session processing commands in documentation for clarity.
- Removed transcript content fetching from session processing, allowing on-demand retrieval.
- Improved session metrics calculations and added new metrics for dashboard.
- Refactored processing scheduler to handle sessions in parallel with concurrency limits.
- Added manual trigger API for processing unprocessed sessions with admin checks.
- Implemented scripts for fetching and parsing transcripts, checking transcript content, and testing processing status.
- Updated Prisma schema to enforce default values for processed sessions.
- Added error handling and logging improvements throughout the processing workflow.
2025-06-26 17:12:42 +02:00
1afe15df85 feat: Add prisma:push script and remove obsolete migration files 2025-06-25 17:50:55 +02:00
a9e4145001 feat: Implement structured message parsing and display in MessageViewer component
- Added MessageViewer component to display parsed messages in a chat-like format.
- Introduced new Message table in the database to store individual messages with timestamps, roles, and content.
- Updated Session model to include a relation to parsed messages.
- Created transcript parsing logic to convert raw transcripts into structured messages.
- Enhanced processing scheduler to handle sessions with parsed messages.
- Updated API endpoints to return parsed messages alongside session details.
- Added manual trigger commands for session refresh, transcript parsing, and processing.
- Improved user experience with color-coded message roles and timestamps in the UI.
- Documented the new scheduler workflow and transcript parsing implementation.
2025-06-25 17:45:08 +02:00
3196dabdf2 feat: Implement session processing and refresh schedulers
- Added processingScheduler.js and processingScheduler.ts to handle session transcript processing using OpenAI API.
- Implemented a new scheduler (scheduler.js and schedulers.ts) for refreshing sessions every 15 minutes.
- Updated Prisma migrations to add new fields for processed sessions, including questions, sentimentCategory, and summary.
- Created scripts (process_sessions.mjs and process_sessions.ts) for manual processing of unprocessed sessions.
- Enhanced server.js and server.mjs to initialize schedulers on server start.
2025-06-25 16:14:01 +02:00
c9e24298cd Bump node-cron from 4.0.6 to 4.0.7 (#3)
Bumps [node-cron](https://github.com/merencia/node-cron) from 4.0.6 to 4.0.7.
- [Release notes](https://github.com/merencia/node-cron/releases)
- [Commits](https://github.com/merencia/node-cron/compare/v4.0.6...v4.0.7)

---
updated-dependencies:
- dependency-name: node-cron
  dependency-version: 4.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-23 12:37:39 +02:00
13d0f8ee8d Add markdownlint-cli2 for markdown linting; configure Prettier with Jinja template support and update linting scripts 2025-05-22 22:29:06 +02:00
8dcb892ae9 Add Playwright testing framework and implement initial tests; update .gitignore and package files 2025-05-22 19:46:04 +02:00
f005b2ec0a Update dashboard metrics and session handling
- Refactor DashboardContent to improve trend calculations for user metrics and session time.
- Modify SessionViewPage to ensure loading state is set before fetching session data.
- Adjust SessionsPage to clean up display of session start time and remove unnecessary comments.
- Enhance DonutChart to handle various data point types and improve percentage calculations.
- Update GeographicMap to utilize @rapideditor/country-coder for country coordinates.
- Improve safeParseDate function in csvFetcher for better date handling and error logging.
- Refactor sessionMetrics to clarify variable names and improve session duration calculations.
- Update next.config.js for better configuration clarity.
- Bump package version to 0.2.0 and update dependencies in package.json and package-lock.json.
- Clean up API handler for dashboard sessions to improve readability and maintainability.
- Adjust tsconfig.json for better module resolution and strict type checking.
2025-05-22 19:21:49 +02:00
efb5261c7d Refactor components and enhance metrics calculations:
- Update access denied messages to use HTML entities.
- Add autoComplete attributes to forms for better user experience.
- Improve trend calculations in sessionMetrics function.
- Update MetricCard props to accept React nodes for icons.
- Integrate Next.js Image component in Sidebar for optimization.
- Adjust ESLint rules for better code quality.
- Add new properties for trends in MetricsResult interface.
- Bump version to 0.2.0 in package.json.
2025-05-22 14:44:28 +02:00
a17b66c078 Enhances data handling and geographic mapping
Refactors dashboard to use actual metrics for country data,
removing dummy data for improved accuracy. Integrates the
country-code-lookup package for geographic mapping, adding
comprehensive country coordinates. Increases performance and
data validation across API endpoints and adjusts WordCloud
component size for better visualization.

Enhances session handling with improved validation logic,
and updates configuration for allowed origins.
2025-05-22 12:51:14 +02:00
7762061850 Enhances session and dashboard components with authentication checks and loading states 2025-05-22 06:28:25 +02:00
ee212e3eea Improves transcript viewer with Markdown support
Adds Markdown rendering to the transcript viewer for enhanced formatting.

This change integrates `react-markdown` to parse and render transcript content, allowing for richer text formatting, including links and other Markdown elements.  It also adds a toggle to switch between raw and formatted text, and displays a message when transcript content is unavailable. The UI of the transcript viewer has been improved to be more user-friendly with titles and descriptions.
2025-05-22 06:13:00 +02:00
8ce0b8be37 Enhances session details with transcript viewer
Adds a transcript viewer component to display transcript content within the session details page.

This change introduces a new `TranscriptViewer` component that renders the transcript content if available. It also adds logic to fetch and store transcript content from the provided URL during session data refresh. The existing link-based transcript view is now used as a fallback when only the transcript URL is available. It also fixes an issue where session ID was not properly displayed.
2025-05-22 05:44:09 +02:00
00f2f5c59b Updates dashboard UI and improves styling
Improves the dashboard's appearance and user experience by updating styles and layouts.

Changes include:
- Updates to color schemes and spacing for better readability and visual appeal.
- Implements a responsive layout for the header to adapt to different screen sizes.
- Refactors button styles for consistency and clarity.
- Adds a gradient background to the main dashboard page.
- Updates the NextAuth URL in the development environment.
2025-05-22 04:40:56 +02:00
5317b2aa39 Enhances dashboard with new metrics and charts
Improves the dashboard with additional metrics and visualizations
to provide a more comprehensive overview of application usage and performance.

Adds new charts, including:
- Word cloud for category analysis
- Geographic map for user distribution (simulated data)
- Response time distribution chart

Refactors existing components for improved clarity and reusability,
including the introduction of a generic `MetricCard` component.

Improves error handling and user feedback during data refresh and
session loading.

Adds recommended VSCode extensions for ESLint and Prettier.
2025-05-22 04:04:50 +02:00
2624bf1378 Localizes language names in the language pie chart
Uses `Intl.DisplayNames` to display localized language names in the language pie chart, enhancing user experience and readability.

Also converts country and language values from the CSV data to ISO codes for standardization and improved data handling.
Adds tooltip to display ISO language code.
2025-05-22 02:00:15 +02:00
50b2fbda55 feat: update package.json scripts and add prisma seed command
refactor: improve refresh-sessions API handler for better readability and error handling

fix: enhance NextAuth configuration with session token handling and cookie settings

chore: update dashboard API handlers for consistency and improved error responses

style: format dashboard API routes for better readability

feat: implement forgot password and reset password functionality with security improvements

feat: add user registration API with email existence check and initial company creation

chore: create initial database migration and seed script for demo data

style: clean up PostCSS and Tailwind CSS configuration files

fix: update TypeScript configuration for stricter type checking

chore: add development environment variables for NextAuth

feat: create Providers component for session management in the app

chore: initialize Prisma migration and seed files for database setup
2025-05-21 21:43:51 +02:00
b6b67dcd78 feat: update package dependencies and improve session handling
- Added @tailwindcss/postcss to devDependencies for better PostCSS integration.
- Enhanced session import logic in refresh-sessions.ts to ensure proper data mapping and type safety.
- Updated postcss.config.js to use the correct plugin name for Tailwind CSS.
- Modified tsconfig.json to temporarily disable strict mode and allow implicit any types for smoother development.
2025-05-21 21:14:48 +02:00
cdaa3ea19d feat: initialize project with Next.js, Prisma, and Tailwind CSS
- Add package.json with dependencies and scripts for Next.js and Prisma
- Implement API routes for session management, user authentication, and company configuration
- Create database schema for Company, User, and Session models in Prisma
- Set up authentication with NextAuth and JWT
- Add password reset functionality and user registration endpoint
- Configure Tailwind CSS and PostCSS for styling
- Implement metrics and dashboard settings API endpoints
2025-05-21 20:44:56 +02:00