Sends in-app + email notification to the person who created a task request
when someone responds to it, closing the feedback loop in the request flow.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Connect notification service to email infrastructure — each notification
now sends an email when user has email_notifications enabled (default).
Replace hardcoded navigation in NotificationBell with SSOT config lookup.
Fix CHECK constraint to include decision_voting, decision_closed, and
protocol_finalized types that the codebase actually inserts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migration 038 adds 12 columns to workshops and 2 to workshop_instances so
the proposal approve route no longer crashes with 500. Approvals page now
only shows workshop proposals and blog posts (products/services are
admin-only), and surfaces permission requests for super admins. Removed
dead Medusa product-publish logic from the approval API route.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously inventory products showed "Anfrage senden" because they had
no Medusa variant ID, and the order service used hardcoded placeholder
data. This wires up the full end-to-end flow:
- Add medusa_variant_id column to inventory_items (migration 037)
- Extract Medusa publish logic into medusa-publish-service.ts
- Auto-publish to Medusa on product publish (fire-and-forget)
- Return Medusa IDs from inventory detail API
- Enable "In den Warenkorb" when variant ID exists on product page
- Rewrite order service to fetch real cart data from Medusa
- Make paymentIntentId optional (payments deferred)
- Update order-service tests for new Medusa cart integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace RAG-based document retrieval with a rich system prompt containing
all organizational knowledge derived from SSOT sources. The Llama 3.3 70B
model (128k context) handles it easily without needing vector search.
- Create system-prompt.ts deriving all numbers from org-numbers.defaults
- Remove RAG retrieval (searchSimilar, formatContext, contextUsed)
- Remove chunks UI (sources panel, similarity scores) from HirnChat
- Add input validation for temperature/maxTokens at API boundary
- Scope history queries by user_id for defense in depth
- Update welcome text to reflect baked-in knowledge
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
All organizational numbers now flow from a single `org_numbers` table
in the shared Neon database, resolving contradictions across 6+ files
(e.g. internship success 40% vs 90%, devices 150 vs 1000, CO₂ 300kg
vs 350kg). Numbers reconciled against audited revamp-info registry.
Key corrections: CO₂ production 300→350kg (Fraunhofer IZM 2023),
refurbishment 15→65kg, annual CO₂ saved ~43t (not 285t), internship
success ~40% (not 90%), people helped 100+ (not 347), team ~20 (not 23).
Also fixes German language consistency in services.ts (Linux & Web
pricing/features were in English).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add EditHistoryEntry type and edit tracking fields to WorkshopProposal
- Add reviewer_name and editor_name to WorkshopProposalWithProposer
- Fix type assertions in API routes (currentProposal as WorkshopProposal)
- Fix optional property access in EditProposalModal and EditSubmissionModal
- Fix Heading import (default vs named export)
- Add null checks in test file
- All typechecks now pass
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add database migration (034) for edit tracking columns
- Implement edit history with JSONB audit trail
- Create workshop proposal detail page with edit modal
- Add blog submission edit functionality
- Display edit history with timestamps and field changes
- Show 'Von Admin bearbeitet' badges in list views
- Full API endpoints for edit operations
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fix 3 admin pages querying dead technician_profiles table instead of
helper_profiles (IT_HILFE_TECHNICIAN_PROFILES)
- Replace dynamic require() with static import in technician-profile API
- Fix multi-skill filter: frontend now sends comma-separated skills,
API parses as array with ANY() SQL matching
- Make FK migration 028 idempotent with DO $$ guard
- Rename duplicate 028_ migration to 029_
- Add seed migration 030 for 3 IT-Hilfe technician profiles
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Protocol-level voting tables renamed from decision_votes/decision_outcomes
to protocol_decision_votes/protocol_decision_outcomes to avoid naming
conflict with the standalone team decisions system (027).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enable creating decisions from protocol action items by adding FK
constraint, decision_data schema field, and linkActionItemToDecision
service function. Remove placeholder guard in actions API route.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Complete decision lifecycle for protocol action items with item_type 'decision':
team voting (thumbs up/down with toggle), auto/manual close, AI-generated task
proposals for approved decisions, and one-click bulk task creation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add full decisions/voting feature for team governance — proposals,
discussion threads, multiple voting methods, and result tracking.
- Add migration 027 for decisions, votes, and comments tables
- Add decisions config, Zod schemas, and service layer
- Add admin UI: list, detail, create, edit pages
- Add API routes for CRUD, voting, comments, and status transitions
- Add TABLE_NAMES, error/success messages, and admin section config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive input validation across all high-priority API routes:
- Create 12 domain-specific schema files (payments, appointments, reviews,
workshops, messages, user, repairer, seller, blog, ai, inventory, common)
- Add validateBody/validateQuery helpers with structured German error responses
- Wire validation into 20+ route files replacing manual field-presence checks
- Add discriminated union schema for appointment PATCH actions
- Standardize payment route error messages to German
- Fix lint errors in CategoryForm and RegistrationWizard (setState in useEffect)
- Extract thick route handlers to service layer (seller, inventory, orders)
- Add loading states to admin and dashboard pages
- Add 67 unit tests covering all schemas with valid/invalid/default cases
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive activity tracking for team profiles:
- Current focus status on profile detail page
- Manual activity updates (accomplishments, milestones, notes, announcements)
- Help request system (broadcast or targeted)
- Unified activity feed aggregating all sources
- Weekly digest for management with stats and top contributors
Also includes code quality fixes:
- Fix SQL injection vulnerabilities in activity and digest routes
- Extract shared formatRelativeTime utility to reduce duplication
- Fix TypeScript type errors in ActivityCard and focus route
- Fix lint errors in CurrentFocusInput (replace useEffect with useMemo)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix TypeScript errors by properly typing database query results
throughout the task management API routes.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a complete task management system for team coordination including:
- Database migration with tasks, completions, attention flags, requests, and projects tables
- Full CRUD API endpoints for tasks, projects, and task requests
- Analytics endpoint for task metrics
- Admin UI pages: task list with filters, task detail, create/edit forms
- Task completion tracking with optional photo proof
- Attention flag system for urgent tasks
- Project-based task organization
- Zod schemas for validation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix Listmonk/CMS users table conflict by using separate listmonk_db database
- Fix migration errors: index column names, conditional index creation,
seller_profiles missing columns, immutable function in unique index
- Add staffVerificationCode and staffWelcome email templates for @revamp-it.ch
- Update registerUser() to select template based on staff status
- Add Listmonk service to docker-compose with Mailpit for local testing
- Add email provider abstraction supporting both Listmonk and direct SMTP
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The original donations table migration didn't include thank_you_sent_at,
causing PATCH requests to fail when marking donations as thanked.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement comprehensive team profile system for staff management:
- Database migration for team_profiles table with talent development fields
- Team profile CRUD API with permission-based HR notes visibility
- Team components: cards, filters, form with progressive disclosure, detail view
- Team pages: overview with PermissionRequestsManager, detail, edit, create
- Enhanced users API with search, filter, and pagination
- User detail page with link to team profile
- Config-driven labels and options (SSOT principle)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements Phase 1 of donations feature enabling staff to record donations
against user accounts and users to view their donation history.
- Add config SSOT for donation types, device categories, conditions, statuses
- Extend donations table with device fields via migration
- Add DbDonation interface and Zod validation schemas
- Create user API to fetch donation history
- Create admin API for CRUD operations with filtering/pagination
- Add user dashboard page showing donation history
- Add admin page with stats, filters, and donation recording form
- Register donations sections in admin sidebar and user dashboard
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create blog_submissions table for unified storage (migration 019)
- Add public submission endpoint at /api/public/blog/submit (CSRF-exempt)
- Add admin API at /api/admin/blog/submissions/[id] for approve/reject/publish
- Add admin UI at /admin/content/submissions for reviewing submissions
- Add public categories API at /api/blog/categories
- Update submission form to fetch categories from database
- Fix CSRF validation issue by using /api/public/ path
Flow: User submits → Admin reviews → Approve/Reject/Publish
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add database fields and admin UI for editing all service content:
- Migration 018 adds presentation columns (icon, hero, features, process, pricing)
- Service icons config with curated Lucide icons for selection
- Category styling config for visual consistency
- IconPicker and ServiceForm admin components
- API routes for CRUD operations on services
- Edit page at /admin/services/[id]/edit
- Updated services list with edit links and category display
DB content now takes priority over presentation.ts with fallback support.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create unified service layer merging DB operational data with presentation config
- Add migration 017 to align service_types slugs with marketing data
- Refactor service detail pages to use getService() from unified layer
- Update API route to use getFeaturedServices/getBookableServices
- Add SERVICE_CATEGORIES and FEATURED_SERVICE_SLUGS constants
- Update service components to import types from @/lib/services
- Fix Next.js 16 params handling (await params)
- Mark src/data/services.ts as deprecated
Architecture:
- Database (service_types) = SSOT for operational data (prices, availability)
- Presentation config = rich display data (icons, features, process steps)
- Unified layer merges both for components to consume
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix services admin: use correct column name (price_cents not base_price_cents)
- Fix workshops public page: handle consistent API response format
- Fix workshop proposals API: use staff-based permissions, return items array
- Standardize API pattern: arrays returned directly, not wrapped in named objects
- Add PROPOSAL_STATUS constants to workshops config (SSOT)
- Add workshop error messages to error-messages config
- Document API response pattern in lib/api/helpers.ts
- Add migration 016 for workshop_proposals and locations tables
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Blog Admin System:
- Add BlogPostForm component for create/edit
- Add /admin/content/blog/new and [id] pages
- Add /api/admin/blog CRUD endpoints
- Add /api/services public endpoint
- Add blog-db.ts and services-db.ts utilities
- Add 015_content_management.sql migration
- Update blog pages to use database with file fallback
Hirn Provider Simplification:
- Remove premium providers (Anthropic, OpenAI, Google, xAI)
- Keep only Ollama, Groq, OpenRouter
- Update HirnProviderSelector to show only free/local options
- Fix provider type definitions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename peer-repairs to it-hilfe with enhanced matching system
- Add voice input for product data entry (erfassung)
- Add product management components for admin
- Add user helper profile and skills management
- Simplify registration flow (remove role selection)
- Add new migrations for it-hilfe user skills
- Update navigation and config files
- Various bug fixes and improvements
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add scripts/start-all.sh: orchestrated startup with health checks for all
services (Docker, Medusa, Next.js) in correct dependency order
- Add scripts/stop-all.sh: graceful shutdown of application services
- Update package.json with cleaner commands (npm run d, start:all, stop:all)
- Enhance /api/health endpoint to check all services (database, Medusa,
Meilisearch) with latency metrics and overall status
- Add graceful degradation to shop API: returns empty products instead of
crashing when Medusa backend is unavailable
- Fix inventory API: remove references to non-existent item_uuid column
This makes the system more resilient - the frontend continues working even
when optional services (Medusa) are temporarily down.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add lazy validation for admin password config (prevents build failures)
- Create modular sensitive areas config in src/config/sensitive-areas.ts
- Add visual indicator (shield icon) for sensitive sections in admin sidebar
- Add "Admin" link in UserMenu for staff members
- Add "Website" button in admin header for easy site switching
- Fix LogOut icon → User icon for "Mein Bereich" in admin sidebar
- Add npm script to generate bcrypt hashes: npm run generate:admin-hash
Admin password configuration:
- Production requires ADMIN_PASSWORD_HASH (bcrypt)
- Development allows ADMIN_PASSWORD (plain text, with warning)
- Validation now runs lazily at first use, not during build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Erfassung form page for capturing product data with optional AI assist
- Create database schema for inventory items and customer profiles
- Add factsheet/label printing page for products
- Add inventory management tab in admin products view
- Create public shop API for published inventory products
- Update shop page to display inventory products with search and profile filters
- Update product detail page to support both inventory and Medusa products
- Add customer profile badges and condition labels to product display
- Add technical specifications display for inventory products
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Database Changes:
- Migration 004: Add is_super_admin column to users table
- Sync existing super admins from SUPER_ADMIN_EMAILS list
Auth Updates:
- auth.ts: Add is_super_admin to User and Session types
- auth.ts: Pass is_super_admin through JWT to session
- db.ts: Add is_super_admin to DbUser interface
- permissions.ts: Update isSuperAdmin() to check both email list and DB flag
- permissions.ts: Add is_super_admin to StaffUser interface
API Endpoints:
- PATCH /api/admin/users/[id]/permissions
- Super admins can update staff permissions directly
- Super admins can promote/demote other super admins
- Cannot demote users in hardcoded SUPER_ADMIN_EMAILS list
- Cannot demote yourself
UI Components:
- UserPermissionsEditor: Modal for managing user permissions
- Toggle super admin status
- Toggle full access
- Select individual section permissions
- Visual distinction for sensitive sections
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Features:
- staff_permission_requests table (migration 003)
- API endpoints:
- POST /api/admin/permissions/request - Staff submits access request
- GET /api/admin/permissions/requests - Super admin lists pending requests
- POST /api/admin/permissions/requests/[id] - Super admin approves/rejects
UI Components:
- PermissionRequestForm - Staff can select sections and provide reason
- PermissionRequestsManager - Super admin sees and handles pending requests
- RequestAccessSection - Shows on dashboard for staff without full access
Workflow:
1. Staff sees sections they can't access on dashboard
2. Staff clicks "Request Access" and fills form
3. Super admin sees request in dashboard
4. Super admin approves/rejects
5. If approved, permissions are added to user's staff_permissions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace complex role-based auth with simple staff/permission model:
- Staff detected by @revamp-it.ch email domain
- Super admins (allowlist) get full access to sensitive sections
- Regular staff get configurable permissions via staff_permissions[]
- Admin layout shows only accessible sections in sidebar
Also adds:
- Space page showing physical location needs and donation CTA
- Database migration for is_staff, staff_permissions columns
- technician_profiles table (replaces repairer)
- Content approval workflow tables
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Peer Repair Marketplace ("Uber for repairs"):
- Create database migration for peer_repair_requests and peer_repair_offers tables
- Add API routes for requests, offers, and acceptance flow
- Build browse, create, and detail pages for repair requests
- Implement my-requests and my-offers dashboard pages
- Add peer-repairs config with categories, skills, and budget types
HIRN Admin Dashboard:
- Add financial data visualization with yearly income charts
- Create kennzahlen (KPIs), transparenz, and wirkung pages
- Implement data loading utilities and TypeScript types
- Add comprehensive documentation and presentation materials
Supporting changes:
- Update navigation config with new routes
- Add useMediaQuery hook for responsive layouts
- Extend constants with new configuration values
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Stripe payment integration to WorkshopRegistrationForm
- Create admin UI for workshop instance management with registrations
- Implement email notifications for registration, reminders, and feedback
- Add reviews display component with ratings and feedback submission
- Add workshop materials management with access control (public/registered/attended)
- Create migration for workshop_materials table
- Add API endpoints for admin and public material access
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add GET /api/repairers/[id]/availability endpoint for slot fetching
- Add POST /api/repairers/[id]/book endpoint for appointment booking
- Add /repairers/[id]/book booking page with 3-step wizard
- Add database migration for booking enhancements
- Support home visits with address fields
- Integrate with service_appointments table
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated vulnerable packages where possible.
Some vulnerabilities remain due to next-contentlayer peer dependency conflicts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix UserMenu buttons to show immediately without waiting for session check
- Update password validation to enforce 12 character minimum
- Add database connection error handling in auth routes
- Improve session provider configuration for non-blocking session checks
- Add graceful error handling for slow local database connections
- Added curl to Dockerfile for health check improvements.
- Modified npm install commands to build TypeScript and prune unnecessary packages.
- Updated health check command to use curl for better reliability.
- Adjusted TypeScript definitions for user-related functions to return more specific response types.
- Changed user role options from 'viewer' to 'user' in multiple places for consistency.
- Updated package.json dependencies, including downgrading jsonwebtoken types and switching bcrypt to bcryptjs for compatibility.
- Added new environment variables for email configuration in the env.template file.
- Cleaned up various files by removing unnecessary newlines and ensuring consistent formatting.
- Updated the product owner identification in the POST request to use a fallback for the owner's name.
- Enhanced the type safety of the sendEmail function by specifying argument types as unknown.
- Adjusted the email template retrieval to ensure proper typing for email templates.
These changes improve code clarity and maintainability across the application.