feat(server): API de synchronisation incrémentale LWW (ticket #50)

Ajoute l'endpoint api/sync_api.dart, les use cases de synchronisation
(application/sync_use_cases.dart) et l'adapter Postgres
(infrastructure/postgres/synced_resource_repository.dart) implémentant
un upsert LWW atomique via CTE (INSERT ... ON CONFLICT ... WHERE
client_updated_at < EXCLUDED.client_updated_at, avec fallback UNION
ALL pour le cas ignoré). dart pub get OK, dart analyze clean, dart
test 15/15 vert. SQL d'upsert relu manuellement et jugé correct ; pas
de test de bout en bout contre un vrai PostgreSQL faute d'accès
Docker dans ce sandbox.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 10:23:36 +02:00
parent 66d5c9a173
commit 60912ebde4
15 changed files with 1237 additions and 9 deletions

View File

@ -2,5 +2,5 @@
Connection and migration utilities for server-side PostgreSQL.
Repository adapters will be added by the sync/auth tickets once their ports are
defined.
Current adapters cover auth users/sessions and the generic `synced_resources`
sync table.