feat(server): partage ciblé de programmes et séances entre comptes (ticket #51)
Ajoute l'endpoint api/share_api.dart, les use cases de partage (application/share_use_cases.dart) et l'adapter Postgres (infrastructure/postgres/share_repository.dart). L'acceptation d'un partage crée une nouvelle ressource synced_resources avec de nouveaux IDs pour le destinataire, sans jamais modifier la ressource source de l'émetteur ; gestion des conflits révoqué/déjà répondu. dart pub get OK, dart analyze clean, dart test 24/24 vert. Use case d'acceptation 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:
@ -104,18 +104,34 @@ server clock if no resource is returned.
|
||||
`pushResults` included so per-item validation errors remain visible to the
|
||||
client.
|
||||
|
||||
## Sharing
|
||||
|
||||
Ticket #51 adds authenticated targeted sharing for programs and workout
|
||||
templates.
|
||||
|
||||
Endpoints:
|
||||
|
||||
- `POST /shares` with `Authorization: Bearer <token>`.
|
||||
- `GET /shares/inbox` with `Authorization: Bearer <token>`.
|
||||
- `POST /shares/{id}/accept` with `Authorization: Bearer <token>`.
|
||||
- `POST /shares/{id}/decline` with `Authorization: Bearer <token>`.
|
||||
- `POST /shares/{id}/revoke` with `Authorization: Bearer <token>`.
|
||||
|
||||
Creating a share stores a snapshot payload and creates pending recipient rows
|
||||
for known recipient emails. Unknown emails are reported as `unresolvedEmails`
|
||||
without failing the whole request. Accepting a share creates a new
|
||||
`synced_resources` copy owned by the recipient with a server-generated
|
||||
`clientId`; the sender's original resource is never modified. Accept returns
|
||||
`409` for revoked or already answered shares, while missing shares or recipients
|
||||
return `404`.
|
||||
|
||||
## Scope
|
||||
|
||||
Ticket #47 only scaffolds the Dart server, the hexagonal directory layout and
|
||||
the `/health` endpoint. Ticket #49 adds the first PostgreSQL schema. Ticket #48
|
||||
adds authentication. Ticket #50 adds sync only; sharing behavior is still
|
||||
implemented in a later ticket.
|
||||
adds authentication. Ticket #50 adds sync. Ticket #51 adds targeted sharing.
|
||||
|
||||
Upcoming tickets will fill the empty adapters and use cases:
|
||||
|
||||
- #48: user authentication and API tokens.
|
||||
- #49: PostgreSQL schema and repositories.
|
||||
- #50: incremental sync API.
|
||||
- #51: targeted sharing.
|
||||
- #52: Docker and registry packaging.
|
||||
- #53: API, contract and integration tests.
|
||||
|
||||
Reference in New Issue
Block a user