Commit Graph
56 Commits
Author SHA1 Message Date
g-butandClaude Opus 4.6 deff58b6a1 feat(tasks): notify requester when task request is accepted or declined
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>
2026-02-19 08:41:19 +01:00
g-butandClaude Opus 4.6 0d24599db9 feat(notifications): add email delivery, config-driven navigation, and fix DB type constraint
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>
2026-02-18 22:08:42 +01:00
g-butandClaude Opus 4.6 a9c5db02b2 fix(workshops,approvals): add missing DB columns and scope approvals to workshops/posts/access
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>
2026-02-18 14:53:31 +01:00
g-butandClaude Opus 4.6 de97b600c2 feat(shop): connect inventory products to Medusa cart and order flow
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>
2026-02-18 10:05:45 +01:00
g-but a0e6d383d6 fix(ai): harden provider config path and restore admin key persistence
- make AI runtime config deterministic from DB (dedupe-safe ordering)\n- respect provider enabled flags in fallback runtime\n- improve protocol NO_PROVIDER UX copy with clear admin hint\n- extend admin hirn providers PATCH for apiKey persistence + enable toggle + guarded default switch\n- add DB migration 036 to dedupe/uniqueness-hardening for system providers\n- update hirn init insert conflict handling
2026-02-17 22:38:36 +01:00
g-butandClaude Sonnet 4.5 1f30c8efa2 feat(hirn): bake org knowledge into system prompt, remove RAG UI
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>
2026-02-16 21:38:45 +01:00
g-butandClaude Opus 4.6 2db4fd4e9d feat(data): consolidate org numbers into shared SSOT via Neon DB
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>
2026-02-16 17:33:26 +01:00
g-butandClaude Sonnet 4.5 64fb3126dc fix(types): resolve all TypeScript errors in admin edit system
- 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>
2026-02-13 13:41:39 +01:00
g-butandClaude Sonnet 4.5 bc7ad02094 feat(admin): Add edit-before-approve system for workshop proposals and blog submissions
- 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>
2026-02-13 12:42:03 +01:00
g-butandClaude Sonnet 4.5 17108b846c feat(navigation): restructure for Community positioning
BREAKING CHANGE: Navigation structure updated to separate B2C and C2C offerings

Changes:
- Restructured main navigation (7 items):
  1. Über uns (includes Projekte)
  2. Dienstleistungen (professional services only)
  3. Shop (revamp-it's B2C shop)
  4. Community 🆕 (Marketplace + IT-Hilfe P2P platforms)
  5. Lernen (workshops, blog)
  6. Mitmachen (get involved)
  7. Kontakt (CTA)

- Homepage updates:
  * Added prominent Community section after hero
  * Features both Marketplace and IT-Hilfe with clear CTAs
  * Removed duplicate IT-Hilfe section
  * Added icons: Store, ShoppingBag, DollarSign, Users

- Strategic framing:
  * "Community" language resonates with team
  * Clearly separates B2C (Shop) from C2C (Community)
  * Marketplace + IT-Hilfe positioned as peer-to-peer ecosystem
  * Scalable platform architecture

Additional changes:
- Added config files for blog, marketplace status, refund, review status
- Added protocol import/process API routes
- Added date utilities
- Updated admin components for better status management
- Migration 027: protocol input method tracking

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 16:02:00 +01:00
g-butandClaude Sonnet 4.5 68b5d44dcf feat(marketplace): implement Phase 1 & 2 - P2P marketplace core and trust features
Implements comprehensive P2P marketplace with instant listing creation,
in-app messaging, seller profiles, reviews, and smart search.

**Phase 1: Core Marketplace MVP (Tasks 1-6)**

Database (Migration 031):
- listings table (SSOT for all products): seller_id, title, price, category, condition, delivery/payment options, German full-text search
- seller_profiles table (auto-created on first listing)
- listing_images table (up to 8 images per listing)
- listing_favorites table (wishlist functionality)
- marketplace_orders table (for Phase 3)

Config & Schemas:
- src/config/marketplace.ts: MARKETPLACE_CATEGORIES, LISTING_STATUSES, DELIVERY_OPTIONS, PAYMENT_MODES, SORT_OPTIONS, CONDITIONS, MARKETPLACE_LIMITS
- src/config/database.ts: Add TABLE_NAMES for new tables
- src/lib/schemas/marketplace.ts: ListingsQuerySchema, CreateListingSchema, UpdateListingSchema, ContactSellerSchema

API Routes:
- GET/POST /api/listings: Public browse with filters + create listing
- GET/PATCH/DELETE /api/listings/[id]: Detail, update, soft delete
- POST /api/listings/[id]/favorite: Toggle favorite
- GET /api/listings/mine: My listings with status filter

Pages:
- /marketplace: Browse with search, filters, pagination, grid layout
- /marketplace/[id]: Detail page with image gallery, seller info, actions
- /marketplace/sell: Create listing with two-step flow (form → preview)
- /dashboard/listings: My listings management

**Phase 2: Trust & Discovery (Tasks 7-16)**

Messaging Integration (Migration 032):
- POST /api/listings/[id]/contact: Create conversation tied to listing
- Updated conversation types to include 'marketplace'

Seller Profiles:
- GET /api/sellers/[id]: Public seller profile + active listings + reviews
- GET/PATCH /api/sellers/me: Own seller profile management
- /sellers/[id]: Public seller profile page
- /dashboard/profile/seller: Edit seller profile

Edit Flow:
- Updated /marketplace/sell to handle edit mode via ?edit=ID param

Reviews:
- ListingReviews component: Display reviews on listing detail
- ReviewForm component: Submit reviews with ratings
- Reuses existing review system with target_type='listing'

Meilisearch Integration:
- src/lib/search/meilisearch.ts: Client + index management
- POST /api/search/listings: Search with facets and filters
- scripts/reindex-listings.ts: One-time indexing script
- Auto-index on create/update/delete

Email Notifications:
- src/lib/email/templates/marketplace.ts: Listing published, new message, review notification, status updates

Image Optimization:
- Updated /api/uploads to generate thumbnail + medium sizes with sharp

Advanced Features:
- GET /api/listings/similar: Similar listings suggestions
- GET /api/listings/favorites: User's favorited listings
- /dashboard/favorites: Favorites dashboard

**Key Architecture:**
- No seller approval gate - instant listing creation
- Two payment modes: 'secure' (Stripe escrow, 5% commission) or 'direct' (contact seller)
- Delivery options: 'pickup', 'shipping', or 'both'
- In-app messaging (no mailto links)
- Meilisearch for fast, typo-tolerant search with facets
- Image optimization with sharp (thumbnail + medium sizes)
- Swiss German UI throughout

**Cleanup:**
- Add "Verkaufen" to main navigation
- Add /dashboard/listings to dashboard sidebar
- Deprecate old /api/marketplace/products routes
- Remove requireSeller() gate

Verified: tsc --noEmit (zero errors), npm run lint (zero errors)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 21:23:39 +01:00
g-butandClaude Opus 4.6 4cc678234a fix(it-hilfe): fix admin queries, multi-skill filter, and migration cleanup
- 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>
2026-02-11 11:46:04 +01:00
g-butandClaude Opus 4.6 157fc50f78 fix(protocols): rename decision tables to avoid collision with standalone decisions
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>
2026-02-10 18:39:53 +01:00
g-butandClaude Opus 4.6 e8c2e24568 merge: resolve conflict in protocols service
Keep both linkActionItemToDecision (pipeline) and decision voting
functions from main branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:01:25 +01:00
g-butandClaude Opus 4.6 bc2d770638 feat(protocols): wire up decisions-tasks pipeline
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>
2026-02-10 17:44:46 +01:00
g-butandClaude Opus 4.6 0f6ff7dc3d feat(protocols): add decision voting, AI task proposals, and bulk task creation
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>
2026-02-10 17:26:38 +01:00
g-butandClaude Opus 4.6 744471be06 feat(decisions): add team decisions and voting system
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>
2026-02-10 17:11:42 +01:00
g-butandClaude Opus 4.6 25684446ea feat: add Teamsitzung protocols, helper map, AI diagnosis, tests
- Meeting protocols: migration, API routes (CRUD, actions, finalize, templates),
  admin UI page, config for sections/activity/database/errors
- IT-Hilfe: TechnicianMapList with Leaflet, AIDiagnosisCard, AI diagnosis
  migration + extraction support, canton coordinates config
- Tests: auth (password, permissions, rate-limiter), erfassung (bulk-extraction,
  file-parser), payments (currency, tax-compliance, payment-flow), order-service
- Dependencies: leaflet, react-leaflet, @types/leaflet

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 14:36:20 +01:00
g-butandClaude Opus 4.6 2a71f61d2f feat(validation): add Zod schemas to ~25 API routes with tests
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>
2026-02-10 06:21:58 +01:00
g-butandClaude Opus 4.6 d1a63c7f55 fix: replace ASCII umlaut "enthaelt" with proper "enthält"
- Fix "enthaelt" → "enthält" in bulk-upload error message
- Add 16 new patterns to lint-umlauts.sh (enthält, erhält, verfügbar,
  überprüf, fällt, lässt, nächst, gewählt, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 18:11:18 +01:00
g-butandClaude Opus 4.6 aefe1fac1d feat(erfassung): add bulk product erfassung and fix umlaut violations
Implement bulk product entry system (Phases 1-7):
- Shared product creation logic (create-product.ts) and form component (ProductForm.tsx)
- Multi-product AI extraction from text input (bulk-extraction.ts)
- Bulk review table, detail panel, action bar, and success screen
- CSV file upload with auto-column detection (file-parser.ts)
- AI enrichment API for CSV data (bulk-enrich)
- Bulk save API with per-product transaction isolation
- Future-proof tabs for speech/image bulk input

Fix ASCII umlaut violations across entire codebase:
- Replace "fuer" → "für", "koennen" → "können", "Ungueltig" → "Ungültig",
  "Waehlen" → "Wählen", "Laenge" → "Länge", "Hoehe" → "Höhe", etc.
- Affected: erfassung, schemas, donations, services, auth routes
- Add npm run lint:umlauts script to catch future violations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:13:54 +01:00
g-butandClaude Opus 4.5 8364906681 feat(team): implement activity stream with current focus, updates, and help requests
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>
2026-02-05 16:59:32 +01:00
g-butandClaude Opus 4.5 280a749db4 fix(tasks): add type assertions to all API route query results
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>
2026-02-05 14:20:56 +01:00
g-butandClaude Opus 4.5 8eca53c33c feat(tasks): implement task management system for staff
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>
2026-02-05 13:58:26 +01:00
g-butandClaude Opus 4.5 aaff2ad83d fix(auth): resolve database schema conflict and add staff email templates
- 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>
2026-02-05 13:24:34 +01:00
g-butandClaude Opus 4.5 7f310a4140 fix(donations): add missing thank_you_sent_at column to migration
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>
2026-02-05 07:42:44 +01:00
g-butandClaude Opus 4.5 b4d5b493ef feat(admin): add Team & HR management with profiles and enhanced users
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>
2026-02-05 07:37:25 +01:00
g-butandClaude Opus 4.5 c4c9ba33a4 feat(donations): add unified donations system for monetary and device donations
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>
2026-02-05 07:34:12 +01:00
g-butandClaude Opus 4.5 69b9880c0f feat(medusa): add production deployment configuration
- Add comprehensive deployment guide (docs/MEDUSA_PRODUCTION.md)
- Add Railway deployment config (railway.json)
- Add Vercel configuration script (scripts/configure-medusa-vercel.sh)
- Document deployment options: Railway, Render, self-hosted

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:14:39 +01:00
g-butandClaude Opus 4.5 70c41f4c4d feat(blog): Add complete blog submission workflow
- 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>
2026-02-02 14:18:05 +01:00
g-butandClaude Opus 4.5 ee3f92d602 feat(admin): enable admin editing of service presentation content
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>
2026-02-02 14:11:00 +01:00
g-butandClaude Opus 4.5 da9351f6f4 feat(services): unify admin and public services with SSOT architecture
- 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>
2026-02-02 12:29:35 +01:00
g-butandClaude Opus 4.5 8766e1d65b fix(admin): standardize API responses and fix admin-to-public data flow
- 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>
2026-01-28 23:59:02 +01:00
g-butandClaude Opus 4.5 2f61495a3d feat(content): add blog admin CRUD and simplify Hirn providers
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>
2026-01-28 20:24:44 +01:00
g-butandClaude Opus 4.5 f7cc0c43d5 feat: IT-Hilfe system, voice erfassung, product management, and various improvements
- 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>
2026-01-27 18:30:38 +01:00
g-butandClaude Opus 4.5 f5c2e84d9b feat(infra): add unified startup scripts and graceful service degradation
- 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>
2026-01-27 17:07:30 +01:00
g-butandClaude Opus 4.5 1754cd85c0 feat(admin): Improve admin password security and permission system
- 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>
2026-01-23 10:41:39 +01:00
g-butandClaude Opus 4.5 ba9970d23c feat: Add HIRN AI RAG system with multi-provider support
Implements a complete RAG (Retrieval-Augmented Generation) system for
the admin dashboard with:

Core RAG Engine:
- Document ingestion with smart chunking (preserves complete functions/classes)
- pgvector-based semantic search with HNSW index
- Ollama embeddings (nomic-embed-text, 768 dimensions)
- Automatic content hashing for change detection

Multi-Provider AI Support:
- Ollama (local, default)
- Groq, OpenAI, Anthropic, Google, xAI, OpenRouter
- Per-user provider preferences stored in database
- Fallback chain for reliability

Auto-Documentation:
- Database schema extraction and indexing (62 tables)
- API route auto-documentation (116 endpoints)
- Generated docs stored in docs/ for reference

Admin Interface:
- Chat UI with context display
- Provider selector with API key management
- Document browser and stats
- Conversation history

Scripts:
- hirn-ingest.ts: Main document ingestion
- hirn-ingest-schema.ts: Database schema ingestion
- hirn-ingest-api-routes.ts: API documentation generator
- test-hirn-retrieval.ts: Retrieval testing
- test-hirn-chat.ts: Chat pipeline testing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 01:50:20 +01:00
g-butandClaude Opus 4.5 2913b4d0e7 feat: Add product intake (Erfassung) system with shop integration
- 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>
2026-01-21 00:53:34 +01:00
g-butandClaude Opus 4.5 cd82be787c Add super admin management and database-backed super admin status
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>
2026-01-20 14:57:32 +01:00
g-butandClaude Opus 4.5 abdd215728 Add staff permission request system
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>
2026-01-20 14:32:52 +01:00
g-butandClaude Opus 4.5 9f31b17b60 feat: Implement simplified permission system replacing 15+ roles
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>
2026-01-20 11:23:39 +01:00
g-butandClaude Opus 4.5 0608f3dc38 feat: Add peer repair marketplace and HIRN admin dashboard
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>
2026-01-20 02:01:27 +01:00
g-butandClaude Opus 4.5 7c9ab61531 feat(workshops): Complete workshop system with payments, emails, reviews and materials
- 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>
2026-01-20 01:56:59 +01:00
g-but 92161d2d30 Fix password validation to use AUTH_CONFIG (8 chars, no complexity) 2026-01-19 18:24:14 +01:00
g-butandClaude Opus 4.5 77aedf7893 feat(repairers): Add booking flow - Phase 2
- 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>
2026-01-14 10:02:31 +01:00
g-butandClaude Opus 4.5 2b4510b189 chore: fix security vulnerabilities
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>
2026-01-07 19:57:05 +01:00
Your Name 5a6f84b63d fix: improve auth system reliability and UI responsiveness
- 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
2026-01-05 15:21:38 +01:00
Your Name 148d91a1b7 Update Dockerfile and TypeScript definitions; enhance health check and user role management
- 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.
2025-12-16 16:11:35 +01:00
Your Name 3b77a536ed refactor: improve product owner identification and email function type safety
- 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.
2025-12-16 16:09:48 +01:00