veza/apps/web/src/services
senke c0e06e61b6 feat(legal): versioned terms acceptance ledger (CGU/CGV/mentions)
v1.0.10 légal item 3. RGPD requires explicit re-acceptance of any
terms-of-service-class document on material change. Adds a per-user,
per-document, per-version ledger so disputes can be answered with
evidence (timestamp + originating IP + user-agent).

Backend
  * migrations/991_terms_acceptance.sql — table terms_acceptances with
    UNIQUE (user_id, terms_type, version) so re-accepts are idempotent.
    inet column for IP, varchar(512) for UA, both nullable for the
    internal seed paths.
  * internal/services/terms_service.go — TermsService :
      - CurrentTerms map (ISO date version per class) is the single
        source of truth ; bump on text edit.
      - CurrentVersions(userID) returns versions + the user's
        unaccepted set ; userID==Nil ⇒ versions only (anonymous OK).
      - Accept(userID, []AcceptInput) : validates each (type, version)
        against CurrentTerms (ErrTermsVersionMismatch on stale POST),
        writes one row per accept in a single transaction, idempotent
        via FirstOrCreate against the unique index.
  * internal/handlers/terms_handler.go — REST surface :
      - GET  /api/v1/legal/terms/current  (public, OptionalAuth)
      - POST /api/v1/legal/terms/accept   (RequireAuth)
      - Captures IP via gin's ClientIP() (X-Forwarded-For-aware) and
        UA from the request, truncates UA to fit the column.
  * routes_legal.go — wires the two endpoints. `current` falls back
    to no-middleware when AuthMiddleware is nil so test rigs work.

Frontend
  * features/legal/pages/{CGUPage,CGVPage,MentionsPage}.tsx — initial
    drafts with version constants matching the backend's CurrentTerms.
    Counsel review required before v2.0.0 (text is honest baseline,
    not finalised legal copy).
  * services/api/legalTerms.ts — fetchCurrentTerms() / acceptTerms() ;
    hand-written to keep the consent-modal wiring readable.
  * components/TermsAcceptanceModal.tsx — non-dismissable modal that
    opens on every authenticated session when the unaccepted set is
    non-empty. Per-document checkboxes + single submit ; refusal keeps
    the modal open (no decline-and-continue path because the legal
    contract requires acceptance to use the platform).
  * Mounted in App.tsx alongside CookieBanner ; both must overlay
    every screen.
  * Lazy-component registry + routes for /legal/{cgu,cgv,mentions}.

Operator workflow when text changes :
  1. Edit the text in the relevant page component. Bump the
     `*_VERSION` const in that file.
  2. Bump CurrentTerms[*] in services/terms_service.go to the same
     value.
  3. Deploy. Every existing user gets force-prompted on their next
     session ; new users prompted at registration.

baseline checks : tsc 0 errors, eslint 754, go build clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 20:47:07 +02:00
..
api feat(legal): versioned terms acceptance ledger (CGU/CGV/mentions) 2026-05-01 20:47:07 +02:00
generated chore(web): drop orval multi-status response wrapper from generated types 2026-04-30 15:21:05 +02:00
2fa-service.test.ts test: fix and improve unit tests across multiple features 2026-03-25 23:34:42 +01:00
2fa-service.ts fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle 2026-03-24 21:18:49 +01:00
adminService.test.ts incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00
adminService.ts refactor(web): zero out @typescript-eslint/no-unused-vars (134 → 0) 2026-04-30 23:05:32 +02:00
analyticsService.test.ts feat(analytics): complete backend analytics, remove frontend mocks 2026-02-15 16:21:20 +01:00
analyticsService.ts feat(v0.11.1): F396-F399 frontend advanced analytics components 2026-03-10 17:13:13 +01:00
chatService.test.ts fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle 2026-03-24 21:18:49 +01:00
chatService.ts fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle 2026-03-24 21:18:49 +01:00
coListeningService.ts feat(v0.10.7): Collaboration Temps Réel F481-F483 2026-03-10 13:34:16 +01:00
commerceService.test.ts fix(tests): cycles 12–18 – corrections services, mocks et design tokens 2026-02-11 09:43:55 +01:00
commerceService.ts feat(frontend): add admin transfer API functions in commerceService 2026-02-23 23:36:09 +01:00
cookieService.ts chore: enable noUncheckedIndexedAccess, isolate ghost MSW handlers, document go-clamd tech debt 2026-02-12 23:12:35 +01:00
csrf.ts fix(web): silence console for expected failures (CSRF, webhooks 5xx) 2026-02-10 19:51:20 +01:00
developerService.test.ts fix(a11y): fix heading hierarchy h1→h3 gaps on 8 pages 2026-03-25 10:14:18 +01:00
developerService.ts feat(developer): connect API keys to real backend (Lot C frontend) 2026-02-20 00:19:58 +01:00
discoverService.ts fix(backend,web): restore audio playback via /stream fallback 2026-04-16 14:52:26 +02:00
distributionService.ts fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle 2026-03-24 21:18:49 +01:00
educationService.ts fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle 2026-03-24 21:18:49 +01:00
feedService.ts fix(backend,web): restore audio playback via /stream fallback 2026-04-16 14:52:26 +02:00
gearService.ts fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle 2026-03-24 21:18:49 +01:00
groupService.test.ts incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00
groupService.ts feat(groups): S2 frontend - request join, invite, roles, my groups, MSW handlers 2026-02-21 05:51:29 +01:00
liveService.ts feat(v0.10.6): Livestreaming basique F471-F476 2026-03-10 10:21:57 +01:00
marketplaceService.test.ts fix(tests): cycles 12–18 – corrections services, mocks et design tokens 2026-02-11 09:43:55 +01:00
marketplaceService.ts refactor(web): zero out @typescript-eslint/no-explicit-any (115 → 0) 2026-05-01 03:23:27 +02:00
offlineQueue.test.ts refactor(web): zero out 3 ESLint warning buckets (storybook + react-refresh + non-null-assertion) 2026-04-30 23:30:22 +02:00
offlineQueue.ts chore: enable noUncheckedIndexedAccess, isolate ghost MSW handlers, document go-clamd tech debt 2026-02-12 23:12:35 +01:00
productService.ts feat(marketplace): connect CreateProductView to enriched product API 2026-02-22 14:10:26 +01:00
pwa.ts refactor(web): zero out @typescript-eslint/no-explicit-any (115 → 0) 2026-05-01 03:23:27 +02:00
requestDeduplication.test.ts chore: consolidate pending changes (Hyperswitch, PostCard, dashboard, stream server, etc.) 2026-02-14 21:45:15 +01:00
requestDeduplication.ts refactor(web): zero out @typescript-eslint/no-explicit-any (115 → 0) 2026-05-01 03:23:27 +02:00
responseCache.test.ts refactor(web): zero out @typescript-eslint/no-unused-vars (134 → 0) 2026-04-30 23:05:32 +02:00
responseCache.ts refactor(web): zero out @typescript-eslint/no-explicit-any (115 → 0) 2026-05-01 03:23:27 +02:00
roleService.ts incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00
searchService.test.ts chore(refactor/sumi-migration): commit pending changes — tests, stream server, dist_verification 2026-02-13 19:39:18 +01:00
searchService.ts fix: resolve ts-ignore directives and unsafe type casts 2026-02-12 22:21:55 +01:00
sessionService.test.ts chore(refactor/sumi-migration): commit pending changes — tests, stream server, dist_verification 2026-02-13 19:39:18 +01:00
sessionService.ts incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00
socialService.test.ts fix(a11y): fix heading hierarchy h1→h3 gaps on 8 pages 2026-03-25 10:14:18 +01:00
socialService.ts refactor(web): zero out @typescript-eslint/no-unused-vars (134 → 0) 2026-04-30 23:05:32 +02:00
subscriptionService.ts fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle 2026-03-24 21:18:49 +01:00
tokenRefresh.test.ts chore(refactor/sumi-migration): commit pending changes — tests, stream server, dist_verification 2026-02-13 19:39:18 +01:00
tokenRefresh.ts refactor(web): zero out 3 ESLint warning buckets (storybook + react-refresh + non-null-assertion) 2026-04-30 23:30:22 +02:00
tokenStorage.test.ts chore(refactor/sumi-migration): commit pending changes — tests, stream server, dist_verification 2026-02-13 19:39:18 +01:00
tokenStorage.ts security: migrate access token to httpOnly cookie (Actions 5.1.1.1-5.1.1.3) 2026-01-16 01:03:23 +01:00
uploadService.test.ts chore(refactor/sumi-migration): commit pending changes — tests, stream server, dist_verification 2026-02-13 19:39:18 +01:00
uploadService.ts refactor(web): zero out @typescript-eslint/no-explicit-any (115 → 0) 2026-05-01 03:23:27 +02:00
webhookService.ts refactor(web): zero out @typescript-eslint/no-explicit-any (115 → 0) 2026-05-01 03:23:27 +02:00
websocket.ts refactor(frontend): eliminate ~45 'any' types in production code 2026-02-22 17:44:49 +01:00