User-approved 1-commit scope to finish the schema cleanups that
previously shipped at the TS layer only. Two distinct removals batched
in migration 073 because both are pure deletion + were verified
non-consumer in prior commits:
1. helper_profiles table + helper_profiles_v view. TS declaration
removed in 0b410106 after Phase 2 migration 061 unified into
repairer_profiles (profile_tier='community'). Verified zero
production consumers at TS-removal time; the DB column stayed
until now for historical preservation.
2. Five Medusa integration columns. TS declarations removed in
6f0852d8 after grep verified zero consumers anywhere in src/
(Medusa was an e-commerce framework integration that never
shipped):
- ai_extracted_products.medusa_product_id
- inventory_items.medusa_product_id
- inventory_items.medusa_variant_id
- orders.medusa_order_id
- orders.medusa_cart_id
- order_items.medusa_variant_id
Migration uses DROP IF EXISTS for both view and columns so it's
idempotent — safe to re-run if a prior partial application happened.
Also removed the now-obsolete tombstone comments that explained the
"TS removed but DB column still present" half-state:
- src/db/schema/inventory.ts: 3 medusa tombstones, 1 platform-values
aspirational note
- src/db/schema/payments.ts: 2 medusa tombstones (orders + order_items)
- src/db/schema/itHilfe.ts: HELPER PROFILES header block
Migration 073's commit message + git history serve as documentation
of what was dropped; tombstone comments in the live schema added
noise. The two remaining helper_profiles mentions in the codebase
(services.ts:197 "merged from helper_profiles", technicians/[id]/route.ts:5
"formerly helper_profiles") are past-tense historical context and
useful — they stay.
After migration 073 runs:
- schema, TS code, and DB are all consistent
- helper_profiles, helper_profiles_v, and the 5 Medusa columns are
fully gone
- no behavior change (already verified zero consumers)
59 tests pass across schema-touched suites (db, admin/inventory,
payment-webhook, marketplace); tsc clean.
The 072 migration (token_version add) and 073 migration (this commit's
drops) should both run as part of the same deploy window — 072 is
required for the JWT-stale-permissions code added in commits
ae52f739 / 0be0f55f / 85f6a1f2 to function, and 073 is safe to run
any time since prior commits already removed the TS references.
31 commits this thread. Roadmap's dead-code-deletes section is now
truly complete: 8 false-positives audited, 2 real-positives shipped
(helperProfiles + Medusa), 1 verified-orphan-kept (jobRuns), and the
DB layer now matches.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User-approved scope-expansion for the JWT-stale-permissions security
fix. Auth.js v5 with JWT session strategy holds is_staff /
staff_permissions / is_super_admin in the signed token. The jwt
callback populates these on initial sign-in (auth.ts:233 `if (user)`
guard) and never re-fetches from the DB until the token's 30-day
maxAge expires.
Effect: an admin demotes a colleague's staff permissions via
/admin/users/[id] PATCH or /api/admin/users/[id]/permissions, but the
demoted user keeps their old token's staff_permissions until they
log out + back in. Real security gap — the platform thinks the user
is still an admin for up to 30 days.
Fix design (3 commits):
1/3 (this commit): Schema + migration. Add token_version column
to users with default 0. The default-0 baseline matches a
freshly-issued token's "no tokenVersion seen yet → treat as 0"
semantics, so existing rows are equivalent to tokenVersion=0.
2/3 (next commit): Admin permission-change routes bump
users.token_version when relevant fields change.
3/3 (next commit): jwt callback compares token.tokenVersion against
users.token_version on each refresh; re-fetches permissions
when they diverge. Token is otherwise reused unchanged so
perf impact is one indexed-PK lookup per token refresh (~24h
cycle per Auth.js updateAge).
Migration is non-breaking: ADD COLUMN with NOT NULL DEFAULT 0
backfills atomically. Drizzle schema declaration matches. No code
yet reads or writes token_version — that arrives in commits 2/3
and 3/3. Splitting the commits this way means each individually
deploys safely:
- This commit alone: column exists but unused → no behavior change.
- + bump commit: token_version increments on admin change → still
no behavior change because jwt doesn't check it yet.
- + jwt commit: full enforcement → demoted users get fresh
permissions on next token refresh.
tsc clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Second commit toward killing IN_DISCUSSION (after e5a92e94 stopped
creating new ones). Pure data update — status column is VARCHAR(30)
with no CHECK constraint, so this is a one-line UPDATE with no schema
change.
After this migration runs, the next code commit can simplify all
`status === OPEN || status === IN_DISCUSSION` filter checks in
requests/[id]/route.ts, offers/route.ts, accept/route.ts, and
admin/it-hilfe/stats/route.ts to just `OPEN`, then drop IN_DISCUSSION
from config/it-hilfe.ts's REQUEST_STATUS / VALID_REQUEST_TRANSITIONS
/ REQUEST_STATUSES / isRequestAcceptingOffers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds MEMBERSHIP_APPROVED, WORKSHOP_PROPOSAL_APPROVED, LISTING_SOLD,
SERVICE_APPOINTMENT_ASSIGNED, SERVICE_APPOINTMENT_COMPLETED to NOTIFICATION_TYPES.
Adds WORKSHOP, WORKSHOP_PROPOSAL, MEMBERSHIP, LISTING to RELATED_TYPES and hrefs.
Migrations 068/069 add workshops.proposal_id FK and extend the notifications CHECK constraint
to cover all new and previously-missing IT-Hilfe/decision-deadline types.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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>
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>
- 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>
- 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>
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>
- 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>
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>
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>
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>
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>
- 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>
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>
- 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>
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
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>
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>
- 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>
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>
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>
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>
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>