Commit Graph
86 Commits
Author SHA1 Message Date
g-butandClaude Sonnet 4.6 6e92b316ba chore: add compliance audit scripts, simplify ship.sh, fix i18n badge key
- npm run compliance:ssot / compliance:i18n — new audit scripts that detect
  SSOT and i18n violations in CI or local runs
- scripts/baselines/ — snapshot files for the audits
- ship.sh simplified to a minimal quality gate (lint, typecheck, test)
- services/data.ts: badgeKey replaces hardcoded badge string so the 'soon'
  label is driven by translations (messages/*.json services.badges.soon)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 10:31:49 +02:00
g-butandClaude Sonnet 4.6 e94435f45a fix(migration): drop constraint instead of index in migration 066
ALTER TABLE ... DROP CONSTRAINT is required when the unique index
backs a named constraint; DROP INDEX fails with a hint in that case.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 08:48:32 +02:00
g-butandClaude Sonnet 4.6 390709b48c feat: anonymous public voting with post-vote registration gate
- Allow decisions to be shared publicly via link; anyone can vote with
  email-only identity (no account required) when allow_public_voting=true
- decision_votes.user_id is now nullable; voter_email added for anonymous
  identity; DB-level check ensures at least one is present
- Partial unique indexes replace the old unique constraint to deduplicate
  registered votes by (decision_id, user_id) and anonymous by
  (decision_id, voter_email) independently
- POST /api/vote/[id] accepts {email, voteData} without auth; validates
  the email is on the invited list unless allow_public_voting is enabled
- Admin form: AdvancedSettings gains "Öffentliche Abstimmung" toggle;
  DecisionDetailClient shows allow_public_voting badge and shareable link
- After submitting a vote, anonymous visitors see a registration gate CTA
  with register + login links pointing back to the vote page
- Migration: 066_anonymous_public_voting.sql (apply to Neon DB)
- Translation keys added in all 7 locales (de/en/fr/es/it/ja/ko)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 08:47:34 +02:00
g-butandClaude Sonnet 4.6 d85f75c026 feat: add marketplace, ai-cms, services pages and UI component updates
New components and pages:
- src/components/dashboard/OnboardingChecklist: role-aware onboarding steps
- src/components/marketplace/{hooks,sections,modals}: full marketplace UI layer
  including useAISearch hook, listing sections, and marketplace index exports
- src/app/ai-cms/: marketing page for the contextual website improvement system
  (9 section components: Hero, Problem, Workflow, AccessControl, Features,
  SuggestionTypes, Comparison, Status, CTA)
- src/app/services/: service pages (individual service routes)
- src/app/about/: about page
- scripts/db/migrations/004_ai_inventory_system.sql
- scripts/db/migrations/005_messaging_system.sql

Bug fixes:
- src/lib/constants.ts: restore SSOT imports from @/config/org instead of
  inlining values (prior change had wrong SUPPORT_EMAIL fallback)

UI updates:
- Dashboard pages (main, seller, workshops): integrate OnboardingChecklist
- Admin layout/services: permission-gated service management
- MainLayout, ResponsiveHero: layout consistency improvements
- Service components (AppointmentBookingForm, ServiceCTA, ServiceFeatures,
  ServicePricing, ServiceProcess): UI refinements
- ProjectCallToAction, ProjectHero, ProjectSection: project page components
- ProductManagement: admin product management improvements

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:14:37 +02:00
g-butandClaude Sonnet 4.6 e4de077a16 feat(decisions): fix creation bug + add public share/vote link
- Migration 065: ADD COLUMN background to decisions (was in Drizzle only,
  never applied to Neon — caused 'Fehler beim Erstellen der Entscheidung')
- decisions-crud.ts: add null guard on INSERT result row
- DecisionDetailClient: 'Link teilen' button copies /vote/<id> to clipboard
  when decision is in discussion or voting phase
- GET /api/vote/[id]: public endpoint returning decision data (no auth)
- POST /api/vote/[id]: submit vote by email lookup — resolves to DB user ID
  then delegates to existing submitVote() with full eligibility checks
- /vote/[id]: public page (no auth required) — shows decision context,
  collapsible background, options, and reuses existing ballot components

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 08:55:10 +02:00
g-butandClaude Sonnet 4.6 32f400b940 fix: add canton filter to unified technician API and replace legacy proxy routes
Migration 064 adds the missing `canton` column to `repairer_profiles` (omitted
in 061 when helper_profiles was merged in), backfills from helper_profiles, and
rebuilds helper_profiles_v to expose the real column instead of NULL.

The canton filter in /api/technicians was silently ignored since 061 — any
frontend filter by Swiss canton returned all results. Now wired up.

Legacy routes /api/repairers and /api/it-hilfe/helpers reduced from 150-230
lines of duplicated query logic each to 30-line thin proxies that delegate to
/api/technicians and remap the response shape for backwards compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 13:26:00 +02:00
g-butandClaude Sonnet 4.6 8284cbf887 feat: add next-intl i18n — 7 locales (de/fr/en/it/es/ja/ko)
- Add next-intl v4.9.1 with App Router [locale] directory pattern
- German is SSOT; other locales fall back to German for missing keys
- All public pages moved to src/app/[locale]/ for locale-aware routing
- Non-locale routes (admin, auth, dashboard, profil) use AppShell for providers
- Root layout stripped to html/body shell; locale layout owns providers
- Middleware merges next-intl locale routing with existing CSRF/auth logic
- LocaleSwitcher added to desktop header; MobileMenu updated
- CommunityStats, NewsletterSignup, Header, MobileMenu use useTranslations
- 57 partial message files merged into de/fr/en locale JSONs
- Fix react-hooks/immutability in DecisionFormClient (setInitialStatus)
- TypeScript: 0 errors — ESLint: 0 errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 12:32:31 +02:00
g-butandClaude Sonnet 4.6 0184238649 refactor: split god components + fix remaining hardcoded strings
## VotingPanel split (615 → ~160 lines)
Extract 6 voting method sections into focused components:
- voting/ConsentVote.tsx — consent response + rationale
- voting/ApprovalVote.tsx — approval (gallery + list modes)
- voting/DotVote.tsx — dot allocation (gallery + list modes)
- voting/ScoreVote.tsx — star scoring (gallery + list modes)
- voting/RankedChoiceVote.tsx — drag-to-rank ordering
- voting/SimpleMajorityVote.tsx — yes/no/abstain
- voting/DeadlineCountdown.tsx — countdown timer
- voting/OptionCard.tsx — shared gallery card
VotingPanel.tsx is now a pure orchestrator (~160 lines)

## DecisionFormClient split (746 → ~190 lines)
Extract form state and UI sections:
- useDecisionForm.ts — all state, handlers, API submit logic
- DecisionTypeSelector.tsx — decision type card grid
- DecisionOptionsEditor.tsx — option add/edit/remove
- ParticipantSelector.tsx — scope selector + invite list
- AdvancedSettings.tsx — voting method, quorum, blind voting
DecisionFormClient.tsx composes the above cleanly

## API route fixes
- locations/route.ts: migrate from manual auth() to withAuth middleware (GET + POST)
- listings/[id]/duplicate: use LISTING_STATUS.REMOVED constant (was 'removed')
- admin/listings/[id]/verify: use LISTING_STATUS.REMOVED constant (was 'removed')

## Lint
- scripts/lint-umlauts.sh: exclude 'statutenaenderung' (known DB slug, legitimate false positive)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 16:33:43 +02:00
g-butandClaude Sonnet 4.6 cd942f2387 feat: ranked-choice voting, AI decision recommendations, membership dashboard
- VotingPanel/ResultsPanel: Borda ranked-choice voting method with drag-free
  reordering (move up/down arrows), Borda point calculation and results display
- AI prompts: decision assistant now recommends optimal voting method, type,
  participant scope, quorum, and category with reason field
- dashboard/membership: complete membership status page (type, payment status,
  benefits, member-since date, payment deadline countdown)
- migration 063: add participant_scope and ai_outcome_narrative to decisions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 15:29:18 +02:00
g-butandClaude Sonnet 4.6 fce743b182 feat: real membership application system (replaces email-only flow)
Architecture:
- User ≠ Member: users are accounts, members are users with is_member=true
- Migration 062: adds is_member/member_since/member_type/member_paid_until
  to users + creates membership_applications table
- Fixed misleading "Mitglieder" stat label (now "Nutzer:innen")

New membership flow:
- /mitglied-werden now has a real form (not mailto: link)
- Works both for logged-in and anonymous users
- Logged-in: pre-fills name/email, links application to user_id
- Anonymous: accepts application, admin manually links later
- Shows 3 states: form, pending application, already a member
- Member type selection: Regular CHF 50 / Reduced CHF 20

API:
- POST /api/membership/apply — validated, rate-limited
- Prevents duplicate pending applications from same user
- Stores in membership_applications with pending status

FAQ updated to clarify:
- Difference between user account and Verein membership
- How application process works
- How to pay annual dues

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 17:12:35 +02:00
g-butandClaude Sonnet 4.6 12a23fbc70 feat: unify technician profiles — Phase 1+2 (DB migration + API)
Phase 1 — Database:
- Migration 061: adds community columns to repairer_profiles
  (accepts_gratis, accepts_kulturlegi, max_travel_km, service_delivery_types,
  profile_tier), migrates helper_profiles data, creates compat view
- Schema updated in services.ts and itHilfe.ts

Phase 2 — Unified API:
- New GET /api/technicians — unified list with tier/skills/gratis filters
- New GET /api/technicians/[id] — unified detail with skills + services
- Updated PUT /api/user/technician-profile to write to repairer_profiles
  with profile_tier='community'
- Old endpoints marked as legacy proxies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 13:09:13 +02:00
g-butandClaude Opus 4.6 f29dfcf411 feat: close the loop — IT-Hilfe completion, order flow, blog status
IT-Hilfe completion flow (migration 059):
- Helper marks request as completed (verifies accepted offer ownership)
- Requester confirms + submits 5-star rating with optional review text
- Creates review in reviews table (target_type='it_hilfe')
- Updates helper's average rating + total helps counter
- Email notifications: itHilfeCompleted, itHilfeReviewReceived
- New UI cards: MarkCompletedCard (helper), ConfirmReviewCard (requester)

Marketplace order completion (migration 060):
- Buyer confirm-receipt endpoint (captures escrow, transitions to completed)
- Order review endpoint (1-5 stars, optional content, recommend toggle)
- Updates seller's averageRating from all listing reviews
- OrderStatusTimeline component (5 steps: Bestellt→Bezahlt→Versandt→Erhalten→Bewertet)
- OrderReviewForm inline on buyer's order detail page
- Email templates: orderReceiptConfirmed, orderReviewPrompt, orderReviewReceived

Blog submitter status (migration 058):
- New /dashboard/blog-submissions page with status badges + stats
- Inline rejection reason display, revise-and-resubmit editor
- API: /api/blog/my-submissions and /api/blog/submissions/[id]/resubmit
- In-app notifications on admin status changes (previously email only)
- FIX: requestChanges() was setting status to 'pending' instead of
  'requires_changes' — now correctly uses APPROVAL_STATUS.REQUIRES_CHANGES

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 10:40:02 +02:00
g-butandClaude Opus 4.6 c447f748ec feat: upgrade decision tool for Swiss Verein compliance
Decision categories:
- 6 Verein categories: Vorstandsbeschluss, Mitgliederbeschluss,
  Ratifizierung, Statutenänderung, Budget, Operative Entscheidung
- Category dropdown in creation form + displayed in detail header

Deadlines:
- Discussion + voting deadline date pickers in creation form
- Countdown timer in voting UI (red <24h, amber <3 days)
- Helper text about auto-close behavior

Participant selector:
- Team member picker with search in creation form
- "Abstimmungsberechtigt" section with checkboxes
- Empty = all staff can vote, selected = restricted

Quorum enforcement:
- Blocks closing decisions that don't meet quorum threshold
- Shows quorum progress with green/red indicator
- Warning message when quorum not yet met

Email notifications:
- New templates: decisionVotingOpened, decisionDeadlineReminder
- Email sent when voting opens (with deadline info)
- 24h deadline reminder via daily cron job
- Migration 057 adds category column

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 00:59:04 +02:00
g-butandClaude Opus 4.6 bcc2a9bd48 feat: task assignment + protocol attendees UX improvements
Task assignment:
- Add assigned_to column to tasks table (migration 056)
- Team member dropdown in create/edit forms ("Zuweisen an")
- Show assignee in task list + detail page
- Notification sent to assignee on create/reassign

Protocol attendees:
- Search input in attendee picker ("Teilnehmer suchen...")
- Attendees column in protocol list (name badges, +N overflow)
- Edit attendees in review phase (checkbox picker + save)
- Attendee filter dropdown in protocol list
- Resolve attendee UUIDs to names in list + detail sidebar
- Attendee section open by default in creation form

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 00:18:26 +02:00
g-butandClaude Opus 4.6 4c6f6d0086 fix: database SSOT violations — migrations, TABLE_NAMES, transactions, indexes
- Renumber 8 duplicate migration files (002, 004, 005, 008, 020, 027, 040)
  that caused silent skipping during execution
- Clean TABLE_NAMES: add 12 missing schema tables, keep legacy raw-SQL
  tables with clear comments, remove truly phantom entries
- Wrap bulk import product+inventory in transaction (was 2 separate writes)
- Wrap marketplace conversation+message+metadata in transaction (race fix)
- Add missing indexes: listings(verifiedAt), listings(priceChf),
  users(isStaff, createdAt) + migration 055
- Sync Drizzle schema with new indexes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 21:02:36 +02:00
g-butandClaude Opus 4.6 a8d97a56e4 feat: add due dates to tasks
- Migration 054 adds due_date column to tasks table
- Schema updated with dueDate field
- Task create/edit forms include date picker
- Task detail shows due date with overdue highlighting
- Task list shows Fällig column with red overdue indicator
- API accepts due_date in POST/PATCH

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 12:58:52 +02:00
g-butandClaude Opus 4.6 ceb469a553 fix: locations page crash — add missing DB columns and fix key casing
The locations Drizzle schema defined 8 columns (accessibility_info,
approval_status, approved_by, approved_at, rejection_reason,
usage_count, last_used_at, created_by) that didn't exist in the DB,
causing db.select().from(locations) to 500.

Migration 053 adds all missing columns and backfills approval_status
from the existing is_approved boolean.

Also fixed the admin locations page which used snake_case property
names (created_at, approval_status, etc.) but the Drizzle API returns
camelCase (createdAt, approvalStatus). Added null guard on date
formatting to prevent toLocaleDateString crash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:22:50 +02:00
g-butandClaude Opus 4.6 5f86a414db fix: resolve critical DB status mismatches in payment workflows
- Add migration 052 to update marketplace_orders CHECK constraint:
  'pending' → 'pending_payment' (matches ORDER_STATUS config)
- Fix Payrexx webhook setting invalid 'paid' status on service
  appointments — use APPOINTMENT_STATUS.CONFIRMED instead
- Fix appointment pay route referencing non-existent 'approved' status
  and setting invalid 'paid' — use APPOINTMENT_STATUS.COMPLETED
- Use APPOINTMENT_STATUS constants instead of PAYMENT_STATUS for
  appointment status updates (type safety)

These mismatches would cause CHECK constraint violations at runtime
when creating marketplace orders or processing payment webhooks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:08:12 +02:00
g-but 2823e25dca feat: connect IT-Hilfe and Repairers, audit Erfassung/Intake
Phase 1 — IT-Hilfe ↔ Repairer unification:
- Add repairer_profile_id to it_hilfe_offers (soft FK to repairer_profiles)
- New API: GET /api/repairers/[id]/matching-requests (skill-based matching)
- New MatchingRequestsTab component on repairer detail pages
- IT-Hilfe offers now display repairer profile info (verified badge, rating)
- Repairers can see and respond to matching IT-Hilfe requests

Phase 2 — Erfassung vs Intake audit:
- docs/ERFASSUNG_INTAKE_AUDIT.md: full overlap analysis and consolidation plan
- Erfassung = AI-powered capture, Intake = checklist pipeline
- Recommended: merge into single pipeline with AI as optional first step
2026-03-23 14:09:46 +01:00
g-but 19e6be6d19 debug: test all listings route imports individually 2026-03-23 13:12:59 +01:00
g-butandClaude Opus 4.6 15f30bda2e feat(it-hilfe): comprehensive IT-Hilfe product improvements
- Fix offer_count never incrementing on new offers (critical bug)
- Add VALID_REQUEST_TRANSITIONS config + deriveBudgetType() helper (SSOT)
- Add IT-Hilfe notification types to config
- Add decline offer endpoint with email + in-app notifications
- Add in-app notifications for offer accept/reject/complete lifecycle
- Add helper profile detail page at /it-hilfe/helfer/[id]
- Add helpers directory pagination (20 per page)
- Store budgetTier on request creation + use in matching
- Add request edit page at /it-hilfe/[id]/edit
- Add decline button UI in OffersList
- Replace alert() with inline success states in HelperCard + detail page
- Add expiry badges to RequestCard + countdown in RequestSidebar
- Add admin status transition validation
- Update tests for new functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:22:56 +01:00
g-butandClaude Opus 4.6 f893115ad7 feat: complete all remaining audit items (12 items across 9 batches)
Accessibility:
- Add skip-to-content link in root layout
- Fix 125 gray-400 contrast violations across 92 files (→ gray-500)
- Fix 13 undersized admin touch targets (p-1 → p-2, w-8 → w-10)

Performance:
- Fix workshops N+1 waterfall: single ?include=instances API call
  replaces O(W×I) client-side fetch loops

Architecture:
- Remove legacy admin-auth.ts dual auth system
- Migrate 4 routes from CMS JWT to Auth.js/withAdmin

Responsive:
- Add mobile-first breakpoints to 5 components (sell page,
  bookings, decisions, product tables, filter bars)

Mission features:
- Public financial transparency page at /about/finances
- Per-listing CO2 impact badge on marketplace (Fraunhofer IZM 2023)
- Subscription exchange design spec + draft migration

0 TypeScript errors, 0 ESLint errors, 362/362 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 16:30:01 +01:00
g-butandClaude Opus 4.6 25723a7d75 refactor: apply Zod validation to remaining routes, update audit report
Apply Zod validation imports and status config imports across
remaining page components (admin approvals, decisions, locations,
protocols, workshops, blog, dashboard, IT-Hilfe, marketplace).
Delete unused MarketplaceCheckoutForm. Update audit report with
current findings and scores.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 15:16:46 +01:00
g-butandClaude Opus 4.6 45bd7832fe feat: unified intake system, marketplace admin, IT-Hilfe, sidebar cleanup
Major features:
- Unified Device Intake system with AI text/voice extraction, checklist-gated
  publishing, tier change with checklist reset, and audit timeline
- Marketplace admin panel with stats, listing moderation, reports, orders
- IT-Hilfe admin for managing community tech help requests
- Marketplace sell form: AI-assisted listing creation with image upload

Fixes:
- Marketplace image URL validation: accept relative /uploads/ paths (was
  rejecting valid uploads with z.string().url())
- Admin marketplace stats/orders: fix column name mismatch (amount_chf
  not total_cents)
- Metadata title dedup: skip brand prefix when title already contains it
- Remove "Produkte" from admin sidebar (replaced by Geräte-Eingang +
  Marketplace flow)
- Dashboard quick action: "Neues Produkt" → "Neues Gerät" → /admin/intake

Cleanup:
- Delete unused modules: labels.ts, newsletter-status.ts, sensitive-areas.ts,
  role-checks.ts, unified-permissions.ts, mappers.ts, number-sources.ts,
  admin-access.ts, auth middleware, unused hooks
- SSOT consolidation across API routes and config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 18:56:42 +01:00
g-butandClaude Opus 4.6 5ed9e62e38 feat: replace Stripe with Payrexx for marketplace escrow, reorganize navigation
Marketplace payments now use Payrexx reservation-based escrow instead of
Stripe manual capture. Checkout redirects to Payrexx hosted payment page
rather than rendering inline Stripe Elements. Dev mock mode enables full
E2E testing without Payrexx credentials.

Navigation reorganized: merged standalone Shop into "Marktplatz" mega-menu
alongside Marketplace and IT-Hilfe (7→6 nav items). Homepage hero CTA now
points to /marketplace. Removed 10 unused TABLE_NAMES constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 15:02:41 +01:00
g-butandClaude Opus 4.6 c720d2ad93 feat: marketplace Phase 2 — messaging UI, share, report, duplicate, SEO
- Messages dashboard: split-panel conversation list + thread view with
  mobile-responsive layout, deep-linking via ?conversation= param
- Share listing: Web Share API with clipboard fallback + "Kopiert!" toast
- Report listing: modal with reason radio buttons, DB migration, API route
- Duplicate listing: copy fields + specs as draft, redirect to edit
- JSON-LD Product schema on listing detail pages (Schema.org structured data)
- Dynamic sitemap for active marketplace listings (/marketplace/sitemap.xml)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:32:38 +01:00
g-butandClaude Opus 4.6 cb734980f1 feat: marketplace Phase 1 — specs, verification, gratis, seller toggle, condition criteria
Implement all 6 Phase 1 features for the marketplace competitive roadmap:

1.1 Seller type toggle (RevampIT Geräte / Community Inserate) on browse page
1.2 RevampIT verified badge with admin verify endpoint and verification details
1.3 Categories migrated to KATEGORIEN SSOT (numeric IDs) + structured tech specs
    (listing_specs table, spec filters on browse, spec tags on cards, spec table on detail)
1.4 Category-specific condition criteria checklists in sell form and detail page
1.5 Gratis listings (price=0) with badge + zero commission (COMMISSION_RATE=0)
1.6 AI spec extraction — enhanced marketplace AI prompt to extract specs from text

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 14:18:22 +01:00
g-butandClaude Opus 4.6 3419caaa69 docs: update all documentation and configuration for post-Medusa architecture
Remove all Medusa-specific documentation (MEDUSA_*.md, SETUP_*.md,
README_MEDUSA.md, AI_AGENT_QUICK_REFERENCE.md, REVAMPIT_SHOP_*.md).
Update remaining docs, README, AGENTS.md, CLAUDE.md, env examples,
sitemap, and agent config files to reflect the simplified architecture
without Medusa dependency. Replace Medusa.js with WooCommerce in
service offerings documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 11:44:25 +01:00
g-butandClaude Opus 4.6 b21a680a4b refactor: remove Medusa e-commerce backend and all related infrastructure
Remove the entire Medusa integration that was replaced by native database
queries for product management. This includes the medusa-backend directory,
all Medusa API routes (cart, orders, products, regions, health), Medusa
client library and React hooks, StripeCheckout component, publish service,
Docker services (medusa, medusa_db, medusa_redis), CI/CD workflow, and
all Medusa references from config files, scripts, and docker-compose.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 11:43:11 +01:00
g-butandClaude Opus 4.6 44c9e374df fix: security hardening, newsletter DB migration, and search reliability
- CSV import: add 5MB schema limit, 1000 row cap, rate limiting (5/hr)
- Newsletter: migrate from file I/O to newsletter_subscriptions table
  (eliminates race condition on concurrent writes)
- Database: add 9 performance indexes for marketplace queries
- Marketplace: add OG images to listing detail metadata
- Meilisearch: add retry logic (2 retries with backoff) for write ops

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:51:12 +01:00
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