Squash depuis develop : POST /assistantes-maternelles/dossier (actif + mail MDP), AmDossierWizard create/review, validations inscription. Co-authored-by: Cursor <cursoragent@cursor.com>
76 lines
2.2 KiB
Markdown
76 lines
2.2 KiB
Markdown
# Mini-spec API — POST /assistantes-maternelles/dossier (#156)
|
||
|
||
Contrat pour le **plan front** (wizard création AM staff).
|
||
|
||
## Endpoint
|
||
|
||
| | |
|
||
|--|--|
|
||
| **Méthode** | `POST` |
|
||
| **URL** | `{base}/assistantes-maternelles/dossier` |
|
||
| **Auth** | Bearer JWT |
|
||
| **Rôles** | `gestionnaire`, `administrateur`, `super_admin` |
|
||
| **Content-Type** | `application/json` |
|
||
|
||
Ne **pas** appeler `POST /auth/register/am` depuis le dashboard.
|
||
|
||
## Body (JSON)
|
||
|
||
Aligné inscription AM publique, **sans** CGU/privacy obligatoires (acceptées serveur).
|
||
|
||
| Champ | Type | Obligatoire | Notes |
|
||
|-------|------|-------------|--------|
|
||
| `email` | string | oui | unique |
|
||
| `prenom` | string | oui | |
|
||
| `nom` | string | oui | |
|
||
| `telephone` | string | oui | `0X…` ou `+33…` |
|
||
| `adresse` | string | non | |
|
||
| `code_postal` | string | non | |
|
||
| `ville` | string | non | |
|
||
| `photo_base64` | string | non | data-URL `data:image/…;base64,…` |
|
||
| `photo_filename` | string | non | hint nom fichier |
|
||
| `consentement_photo` | bool | oui | |
|
||
| `date_naissance` | date ISO | non | `YYYY-MM-DD` |
|
||
| `lieu_naissance_ville` | string | oui | |
|
||
| `lieu_naissance_pays` | string | oui | |
|
||
| `nir` | string | oui | 15 car. (Corse 2A/2B OK) |
|
||
| `numero_agrement` | string | oui | unique |
|
||
| `date_agrement` | date ISO | non | |
|
||
| `capacite_accueil` | int | oui | 1–10 |
|
||
| `places_disponibles` | int | oui | 0–10, ≤ capacité |
|
||
| `biographie` | string | non | max 2000 |
|
||
|
||
## Réponses
|
||
|
||
### 201 Created
|
||
|
||
```json
|
||
{
|
||
"message": "Dossier AM créé et validé. Un e-mail de création de mot de passe a été envoyé.",
|
||
"user_id": "uuid",
|
||
"statut": "actif",
|
||
"numero_dossier": "2026-000042"
|
||
}
|
||
```
|
||
|
||
Effets serveur : user AM **actif**, fiche `assistantes_maternelles`, n° dossier, **e-mail création MDP** (pas d’accusé « en attente »).
|
||
|
||
### Erreurs
|
||
|
||
| Code | Cas |
|
||
|------|-----|
|
||
| 400 | Validation / NIR / places > capacité |
|
||
| 403 | Rôle non staff |
|
||
| 409 | Email, NIR ou agrément déjà pris |
|
||
| 401 | Token manquant / invalide |
|
||
|
||
## Front
|
||
|
||
- `UserService.createAmDossier(body)` → cet endpoint
|
||
- Après 201 : refresh liste AM ; snackbar OK
|
||
- Wizard create : ne pas envoyer `acceptation_cgu` / `acceptation_privacy` (optionnels)
|
||
|
||
## Branche
|
||
|
||
`feature/156-creation-dossier-am`
|