Commit Graph
471 Commits
Author SHA1 Message Date
g-butandClaude Opus 4.6 872d7649c1 fix(i18n): translate English messages in org-numbers and workshop routes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 16:03:09 +01:00
g-butandClaude Opus 4.6 2b40b9c14b fix(i18n): translate remaining English error messages in appointments and invoices
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:57:19 +01:00
g-butandClaude Opus 4.6 1e00849bae fix(i18n): translate English error messages to German in 15 API routes
Shop, invoices, inventory, workshops, AI, appointments, and newsletter
routes now return German error messages consistent with the rest of the
codebase.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:46:19 +01:00
g-butandClaude Opus 4.6 fd41e162c4 chore(formatting): remove trailing blank lines from 15 API route files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:39:55 +01:00
g-butandClaude Opus 4.6 fefc9284f2 fix(logging): replace remaining silent catch blocks with logger.warn in client pages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:34:52 +01:00
g-butandClaude Opus 4.6 b48c1a6948 refactor(imports): remove unused NextResponse imports from 10 API routes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:27:05 +01:00
g-butandClaude Opus 4.6 bfbed88040 fix(logging): replace silent catch blocks with logger.error in API routes
Fire-and-forget operations (notifications, Meilisearch indexing, view
count increments) now log errors instead of silently swallowing them.
This enables debugging of notification delivery failures and search
index sync issues in production.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:17:44 +01:00
g-butandClaude Opus 4.6 1eb8d602d0 fix(fetch): add missing response.ok checks to 11 fetch calls
Add HTTP status validation before parsing JSON in 8 files. Without
these checks, non-2xx responses (502 gateway errors, 500s) could cause
silent failures or crash on non-JSON response bodies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:08:40 +01:00
g-butandClaude Opus 4.6 c587305083 fix(robustness): add missing response.ok check and error logging
- StripeCheckout: add response.ok check before reading payment intent
  JSON to prevent silent failures on 4xx/5xx responses
- HirnSidebar: replace silent catch blocks with logger.error calls
  for better debugging of session/stats loading failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:00:27 +01:00
g-butandClaude Opus 4.6 191d656e0f feat(error-boundaries): add error boundaries for 5 critical route segments
Add section-level error boundaries for services, workshops, profil,
inventory, and blog routes. Each provides context-specific error
messages in Swiss German with retry and back navigation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:55:27 +01:00
g-butandClaude Opus 4.6 f878728149 refactor(dry): remove duplicate cn utility and inline formatDate wrappers
- Delete unused lib/hirn/utils.ts (duplicate cn, zero importers)
- Remove formatDate wrappers in admin/content/pages and blog pages,
  use formatDateNumeric from SSOT directly
- Replace HirnSidebar custom relative time with formatRelativeTime
  from lib/utils.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:50:16 +01:00
g-butandClaude Opus 4.6 4161f0e525 refactor(api): replace raw NextResponse.json with standardized helpers
Converts remaining routes using raw NextResponse.json error responses to
use centralized apiSuccess/apiError/apiNotFound helpers for consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:38:59 +01:00
g-butandClaude Opus 4.6 9013eb2ac1 perf(repairers): fix N+1 queries in repairers API
- GET /api/repairers: Replace 100 per-request queries (2 per repairer)
  with 2 batch queries using WHERE repairer_id = ANY($1)
- GET /api/repairers/[id]: Parallelize independent rating distribution
  and review summary queries with Promise.all

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:28:45 +01:00
g-butandClaude Opus 4.6 8f3150accb refactor(status): replace hardcoded status strings with centralized constants
- ProductManagement: use MARKETPLACE_STATUS and PRODUCT_STATUS constants
- Blog submissions: use APPROVAL_STATUS for filter counts and status checks
- Repairer applications: use APPROVAL_STATUS for filters, cards, and docs
- Update Submission.status type to use ApprovalStatus from config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 13:32:41 +01:00
g-butandClaude Opus 4.6 2bf18482bf refactor(api): add apiRateLimited helper and standardize 429 responses
- Add apiRateLimited() to lib/api/helpers with Retry-After and
  X-RateLimit-* header support
- Update 7 routes (auth + newsletter + admin) to use the helper
- Remove unused NextResponse imports where possible

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 13:19:57 +01:00
g-butandClaude Opus 4.6 d5b2cffc72 refactor(web-design): decompose 550-line page into 8 sections, fix ai-capture DRY
- Extract web-design-development page into 8 section components
- Move interactive filter to self-contained TechnologiesSection client component
- Convert page to server component, restoring metadata export (SEO win)
- Replace duplicate condition helpers in ai-capture with centralized getConditionBadge
- Remove trailing blank lines from ai-capture

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 13:08:02 +01:00
g-butandClaude Opus 4.6 d843a9f940 feat(error-boundaries): add error.tsx to 6 critical page routes
Add error boundaries for checkout, order detail, appointments,
marketplace listing detail, reviews, and admin task detail pages.
Follows existing codebase pattern with logger, retry button,
back link, and accessible markup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:42:06 +01:00
g-butandClaude Opus 4.6 a3c349e5ec refactor(ai-cms): decompose 766-line page into 9 section components
Split monolithic marketing page into focused section components:
HeroSection, ProblemSection, WorkflowSection, AccessControlSection,
FeaturesSection, SuggestionTypesSection, ComparisonSection,
StatusSection, CTASection. Main page is now a clean composition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:38:53 +01:00
g-butandClaude Opus 4.6 45bab6e2ee refactor(api): standardize error handling and extract CSV analysis
Replace raw NextResponse.json() calls with apiSuccess/apiError/apiBadRequest
helpers across 8 API routes for consistent response format. Extract
analyzeProductDescription and calculateSustainabilityScore from import-csv
route to lib/inventory/csv-analysis.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:32:07 +01:00
g-butandClaude Opus 4.6 37f3d0df63 refactor(it-hilfe): extract shared mapper and notification service
- Extract RequestRow type + mapRequestListRow/mapRequestDetailRow to
  lib/it-hilfe/request-mapper.ts (DRY: shared between list and detail)
- Extract sendRequestCreatedNotifications to lib/it-hilfe/notifications.ts
  (requester confirmation, admin alert, matching helper emails)
- Fix type errors: cast through unknown for BlogSubmission, use string
  for number input value, add Record<string, unknown> cast in edit-utils

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:17:08 +01:00
g-butandClaude Opus 4.6 0a3faf646b refactor(api): extract business logic from 3 largest API routes
- Invoice PDF: extract template + generation to lib/invoices/pdf-template.ts
  (396 → 97 lines in route)
- Inventory: extract publish/unpublish/image logic to lib/admin/inventory-actions.ts
  (472 → 220 lines in route)
- Reviews: extract validation/rating/notification to lib/reviews/review-service.ts
  (421 → 225 lines in route)

Routes are now thin HTTP handlers delegating to domain modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:01:52 +01:00
g-butandClaude Opus 4.6 45a30424d8 refactor(types): eliminate remaining any casts in API routes and components
- Replace edit_history any[] with EditHistoryEntry[] in blog/workshop APIs
- Replace outcome as any with typed OutcomeData union in ResultsPanel
- Remove unused SECTION_COMPONENTS dead code from TeamProfileForm
- Remove index signature from BlogSubmission, cast internally instead

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:48:55 +01:00
g-butandClaude Opus 4.6 319c92214a refactor(types): replace any casts with proper types across 8 files
Reduces type-safety holes by replacing `any` with `unknown`, specific
union types, and `Record<string, ...>` patterns. Covers admin edit
modals, edit history utils, validation messages, editable-fields config,
unified permissions, and team profile form.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:26:01 +01:00
g-butandClaude Opus 4.6 5bec92e100 refactor: extract shared code from shop product + build-computer pages
Shop product page: extract useInventoryProduct hook + types to shared
lib, replace inline CONDITION_LABELS with existing getConditionLabel.
Build-your-computer: extract mock inventory data, use case options, and
recommendation logic to config/build-computer.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:04:38 +01:00
g-butandClaude Opus 4.6 ea802e6145 refactor(it-hilfe): decompose create page into sub-components
Extract ProblemDetailsSection, LocationSection, and SkillsSection from
the 578-line create page. Page retains state management, effects, and
handlers while rendering delegates to focused section components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:55:56 +01:00
g-butandClaude Opus 4.6 aec681fb1b refactor(marketplace): decompose sell page into sub-components
Extract ImageUploadGrid, ListingFormFields, and ListingPreview from the
647-line monolithic sell page. Consolidate 13 individual useState hooks
into a single ListingFormData object for cleaner state management.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:50:21 +01:00
g-butandClaude Opus 4.6 db11ea4abd refactor(repairer): decompose application form into focused sections
Extract 4 form sections (BusinessInfo, ContactInfo, ServicesPricing,
Documents) + shared types/config from 681-line monolithic page.
Move service/specialization options to config for SSOT.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:32:37 +01:00
g-butandClaude Opus 4.6 4d2e53bf0b chore: remove deprecated code and migrate legacy references
- Delete peer-repairs.ts (unused re-export wrapper)
- Delete data/services.ts (replaced by unified service layer)
- Delete hero-banner.tsx (migrated 3 files to ResponsiveHero)
- Delete marketplace/list redirect (updated refs to /marketplace/sell)
- Remove PEER_REPAIR_* aliases from TABLE_NAMES
- Remove PEER_REPAIR from REVIEW_TARGET_TYPES and CONVERSATION_TYPES
- Remove verifyAdminPasswordSync, hasRole, isAdminRole
- Rename PeerRepairRequest → ITHilfeRequest

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:13:07 +01:00
g-butandClaude Opus 4.6 587e3d8851 feat(seo): add metadata to 9 public route layouts
Static metadata for it-hilfe, repairers, marketplace, workshops, blog,
and auth (noindex). Dynamic generateMetadata for repairer/[id],
it-hilfe/[id], and marketplace/[id] with DB-driven titles and OG tags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:54:29 +01:00
g-butandClaude Opus 4.6 ecbb8f1676 refactor(repairers): decompose search page into focused components
Extract 3 components from 597-line search page + DRY consolidation:
- RepairerSearchBar: search/filter UI with advanced filters
- RepairerCard: result card using shared StarRating, getServiceIcon, formatPrice
- RepairerReviewsModal: reviews overlay using shared RepairerReview type

Eliminates duplicated renderStars, getServiceIcon, serviceOptions in favor
of shared helpers from batch 6. Page reduced from 597 to ~170 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:17:12 +01:00
g-butandClaude Opus 4.6 7f69ee8e2d refactor(repairers): decompose detail + booking pages into focused components
Extract shared types/helpers and 8 components from two 700+ line pages:
- types.ts, helpers.ts: shared RepairerProfile, formatPrice, SERVICE_CATEGORIES
- StarRating, ServicesTab, ReviewsTab, AboutTab, RepairerSidebar (detail page)
- BookingStepProblem, BookingStepSchedule, BookingStepConfirm (booking wizard)

Page sizes: [id]/page 710→210 lines, [id]/book/page 718→260 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:54:49 +01:00
g-butandClaude Opus 4.6 1892e8dcd4 refactor: split large service files into focused modules
Split 3 files totaling 3647 lines into 13 focused modules with barrel
re-exports for zero import breakage across 232 consuming files:
- auth/db.ts (1261→6 modules): connection, users, workshops, services, verification, roles
- services/protocols.ts (1318→4 modules): queries, processing, linking, voting
- services/decisions.ts (1068→3 modules): core, voting, comments

Also fix pre-existing TS errors in IT-Hilfe test files (RequestInit cast, mockAuth null).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:42:39 +01:00
g-butandClaude Opus 4.6 af9df8e4d9 test(it-hilfe): add API test suite for requests and offers (38 tests)
Cover browse requests (filters, pagination, search), request detail
(auth, ownership, email visibility), request updates (status transitions,
owner-only), offer submission (validation, duplicates, expiry), offer
listing (owner-only), and offer withdrawal (ownership, status checks).

Guard window-dependent mocks in jest.setup.js so API route tests can
use the node environment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:00:21 +01:00
g-butandClaude Opus 4.6 22b8805b16 feat(ux): add error boundaries and loading states to key route segments
Add error.tsx to 6 route groups (it-hilfe, shop, marketplace,
dashboard, admin, auth) and loading.tsx to 4 that were missing them
(it-hilfe, shop, marketplace, auth). Error pages log via logger,
show Swiss German copy, and include reset + back navigation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:40:14 +01:00
g-butandClaude Opus 4.6 5d4932cebf refactor(it-hilfe): decompose 910-line detail page into focused components
Extract hook + 5 UI components under src/components/it-hilfe/detail/:
- useITHilfeDetail: all state, effects, handlers
- RequestHeader: title, badges, description, images, skills
- OfferForm: offer creation form with skill toggles
- OffersList: owner's received offers list
- UserOffer: non-owner's pending offer card
- RequestSidebar: details, requester info, messages, owner actions

Page reduced from 910 to 177 lines. Also replaces inline
window.location.reload() with proper fetchRequest() re-render
and renames PeerRepairRequest to ITHilfeRequest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:36:01 +01:00
g-butandClaude Opus 4.6 df6949b6e9 fix(security): remove debug endpoint, strip health info, harden uploads, require CSV review
- Delete /api/debug/db-config (exposed DB host/port/user publicly)
- Strip infrastructure details from health endpoints (auth-db config,
  auth secret messages, shop Medusa URL/key)
- Harden file uploads: MIME allowlist (JPEG/PNG/WebP/GIF only), block
  SVG (XSS vector), block double extensions, validate file extensions
- Change CSV import from auto-approve to pending review

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:11:26 +01:00
g-butandClaude Opus 4.6 91306cccd2 chore: remove old seller application/approval system
The old seller flow (apply → admin approve → create products) is fully
replaced by the new P2P listing system at /marketplace/sell. This removes
all dead routes, pages, components, and config entries while updating
surviving references to point to the new paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:10:13 +01:00
g-butandClaude Opus 4.6 be75d6f4d5 feat(it-hilfe): add image upload, contextual messaging, and review system
Wire three high-impact features into the IT-Hilfe marketplace using existing
backend infrastructure: image uploads on create/detail pages, a "Nachricht
senden" button that opens the right conversation from the detail page, and a
full review flow (form, API validation, helper rating recalculation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:47:50 +01:00
g-butandClaude Opus 4.6 6aff6f441f feat(it-hilfe): add offer withdrawal, new-offer notifications, and expiration handling
- Add DELETE endpoint for withdrawing pending offers
- Add withdraw button on request detail page and my-offers page
- Send email to requester when a new offer is received
- Block offer submissions on expired requests
- Show expiration banner on expired request detail pages
- Filter expired requests from public listing (already done, now enforced in offer API)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:51:49 +01:00
g-butandClaude Opus 4.6 4b71de905e feat(it-hilfe): add completion flow and acceptance notifications
- Add email templates for offer accepted/rejected notifications
- Accept API now emails the winning helper and notifies rejected helpers
- PUT handler allows matched → completed and matched → cancelled transitions
- Request detail page shows "Mark complete" and "Cancel" buttons when matched

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:28:05 +01:00
g-butandClaude Opus 4.6 a8a8354624 fix(it-hilfe): fix 5 bugs blocking the IT-Hilfe critical path
- Search bar: API now reads `search` param and does ILIKE across title,
  description, device brand, and model (was silently ignored)
- Sort dropdown: API maps frontend values (newest/urgent/budget_high/offers)
  to DB columns (was reading wrong param name with wrong values)
- Navigation: "Meine Anfragen" under IT-Hilfe now points to /it-hilfe/my
  instead of /dashboard/repairer/bookings (wrong dashboard)
- Messaging: MessageButton and MessageSidebar now read data.data.conversations
  and data.data.messages from apiSuccess wrapper (unread count was always 0,
  sidebar never loaded conversations)
- HelperCard: Fix response path for conversation_id and replace navigation
  to non-existent /messages/ page with success alert directing user to
  the message sidebar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:17:33 +01:00
g-butandClaude Opus 4.6 025b7d55a4 chore: remove dead TechnicianRepository with broken SQL
The repository referenced non-existent columns on helper_profiles
(status, is_available, skills, remote_support) and was never imported
anywhere. All active IT-Hilfe code uses direct queries with correct
column names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 11:22:32 +01:00
g-butandClaude Opus 4.6 1c4970e0aa refactor: improve code quality — types, SSOT configs, explicit queries, auth middleware
- Fix 5 unnecessary `any` types (sanitize, validation, components)
- Add SSOT status configs: newsletter-status, invoice-status, appointment-status
- Replace hardcoded status strings with config constants across 7 routes
- Replace SELECT * with explicit column lists in 10 query locations
- Migrate 10 routes from manual auth to withAuth/withAdmin middleware
- Fix NextResponse type in invoice PDF route for middleware compatibility

Verified: 0 tsc errors, 0 lint errors, 319 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 10:29:43 +01:00
g-butandClaude Opus 4.6 699ff9f58c feat(products): add bulk delete with checkbox selection
Adds select-all/individual checkboxes to both inventory and shop product
tables. Selected products can be bulk-deleted via the filter bar button
with a confirmation dialog. Also clarifies the checkout session handler
as a no-op pending payment provider decision.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:06:20 +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 8b03c39c99 fix(lint): resolve all 20 eslint errors and warnings
- Wrap fetchProposal in useCallback to satisfy exhaustive-deps
- Replace useState+useEffect(setState) with lazy useState initializer
  in cart page and ShopHeader to avoid cascading renders
- Move useRef above early return in ContentInputStep to fix
  conditional hook call
- Use inline arrow functions in useCallback for useShopStore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 08:13:38 +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 0354faccaf feat(shop): add live badge counts for cart, wishlist, and compare
Replace hardcoded zero badges with real data. Cart count comes from
Medusa via useCart hook, wishlist/compare use localStorage-backed
stores with useSyncExternalStore for cross-tab sync. Badges now
only render when count > 0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:31:35 +01:00
g-butandClaude Opus 4.6 a5d83189e5 chore(deps): normalize package-lock.json after audit investigation
ajv v6 ReDoS vulnerability (10 moderate findings) is unfixable —
eslint through v10 depends on ajv v6, and overriding to v8 breaks
eslint (incompatible API). Dev-only, not exploitable in our context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:29:58 +01:00
g-butandClaude Opus 4.6 a1dfe951d6 fix(deps): bump fast-xml-parser override to ^5.3.6
Resolves Dependabot alerts #48 and #50 (DoS via DOCTYPE entity
expansion). The installed version was already 5.3.6 via the previous
^5.3.4 override; this makes the minimum explicit.

ajv alerts #49 and #51 dismissed — transitive devDependency of eslint
with no fix available (v6→v8 is breaking). Not a production risk.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:13:01 +01:00