feat(admin): referent management (CRUD, import/export, public API)#3198
feat(admin): referent management (CRUD, import/export, public API)#3198LucasCharrier merged 13 commits intoalphafrom
Conversation
revu-bot
left a comment
There was a problem hiding this comment.
⚠️ PR Review Skipped
1 validation issue found. Review thresholds can be adjusted in
.revu.yml.
See why it was skipped and detailed metrics
Issues Found
1. This PR changes 47 files, which exceeds the limit of 25 files.
Suggestion: Consider breaking this PR into smaller, more focused changes. Large PRs are harder to review effectively and may contain unrelated changes.
PR Metrics
- Total files changed: 47
- Reviewable files: 47
- Diff size: 3316 lines
- Documentation files: 0
- Largest file change: 280 lines
- Addition/Deletion ratio: 417.71
This validation helps ensure the bot focuses on PRs where automated review provides the most value.
maxgfr
left a comment
There was a problem hiding this comment.
J'ai marqué pas mal de commentaires sur les autres PR, je pense il y a un soucis de rebase
694a7b3 to
7cfa7c2
Compare
- Create DsfrTable wrapper component in ~/modules/shared - Create shared useDsfrModal hook to deduplicate modal open/close logic - Export useZodForm from shared barrel for consistent imports - Add REGIONS, COUNTIES, REGIONS_TO_COUNTIES dictionaries to domain layer
- Create AdminNavigation component with DSFR sidemenu pattern - Update admin layout to include sidebar + content grid - Remove duplicate fr-container from AdminHomePage
…blic API - Add referents table to Drizzle schema with referent_type enum - Create adminReferents tRPC router (search, create, update, delete, import, exportAll) - Build AdminReferentsPage with paginated table, search, sort, batch delete - Add create/edit modals with region-dependent county select - Add JSON import modal with validation - Add JSON/CSV export buttons - Create public API route /api/public/referents-egalite-professionnelle - Add Zod schemas, types, constants for the referents module - Add unit tests for schemas, constants, and page component - Add E2E test for non-admin redirect Closes #3182
7cfa7c2 to
f159e73
Compare
Server files imported shared constants through the `~/modules/shared` barrel, which also re-exports client-only hooks (useZodForm, useDsfrModal, useFileUploadForm). Turbopack pulled those hooks into the RSC bundle and failed on useRef/useForm. Import directly from uploadConfig instead.
The test assumed a non-admin logged-in user but Playwright shares a single AUTH_FILE (admin). Rewrite to follow admin-declarations.e2e.ts: happy-path admin access + unauthenticated redirect to /login.
Adds unit tests for all adminReferentsRouter procedures (search, create, update, delete, import, exportAll, auth guard) and for the public referents-egalite-professionnelle route (JSON default, CSV formatting and headers). Increases Sonar new-code coverage above the 60% gate.
…ort) Also fix lint errors: unused CountyCode import in ReferentFormFields, unused formatShortDate in DeclarationsSection, and replace the then-property in the router test mock with a Proxy to satisfy biome/noThenProperty.
Schema was pushed in CI via db:push but no migration file existed, so the table would not be created in envs that use db:migrate (prod/preprod). Add 0026_add_referents_table.sql with the referent_type enum, the app_referent table and the region index.
Without fr-btn--icon-left, DSFR treats the button as icon-only and hides the text, making the action unclear.
DSFR expects the `fr-icon-X` class to come before `fr-btn--icon-left`. When the modifier is placed before the icon class, some DSFR rules treat the button as icon-only and hide the text.
DSFR applies max-width:2rem;overflow:hidden to buttons with fr-icon-* inside a fr-btns-group unless the group itself has fr-btns-group--icon-left (or -right). Without this, the button text is visually hidden even when the button has fr-btn--icon-left.
Oui ca fait beaucoup de fichiers modifié pour une page de referents |
Le commentaire de Max c'était hier, mais normarlement là tout est bien rebase. C'est pas juste une page avec les referents, il y a un systeme de recherche, d'ajout, d'import de csv, il y la page d'admin et d'affichage publique. C'est vrai qu'il y a beaucoup de fichiers mais comme on subdivise tout en petit composants par fichier, ça fait rapidement plein de fichier au total. |
| CLAMAV_HOST="localhost" | ||
| CLAMAV_PORT="3310" | ||
| ADMIN_EMAILS="test@fia1.fr" | ||
| EGAPRO_AUDIT_CLEANUP_TOKEN="change-me-to-a-32-chars-minimum-token" |
There was a problem hiding this comment.
Pourquoi on met pas ça dans un router trpc ?
There was a problem hiding this comment.
Le CSV bloque : tRPC renvoie du JSON enveloppé, pas moyen de setter Content-Disposition pour le téléchargement. Et pour un endpoint /api/public/ consommé par des clients externes (curl, Python, data.gouv), l'enveloppe tRPC + URL couplée au nom de procédure c'est pas le bon contrat. tRPC serait pertinent pour un usage interne.
| CLAMAV_HOST="localhost" | ||
| CLAMAV_PORT="3310" | ||
| ADMIN_EMAILS="test@fia1.fr" | ||
| EGAPRO_AUDIT_CLEANUP_TOKEN="change-me-to-a-32-chars-minimum-token" |
There was a problem hiding this comment.
à quoi ca sert concretementt ? et pouquoi on l'a pas register dans le env.js ?
There was a problem hiding this comment.
Ah ou alors, c'est une variable qu'on avait oublié d'ajouter :)
There was a problem hiding this comment.
C'est juste bizarre d'avoir une variable clean_up comme ça, on pourra en discuter une next time
There was a problem hiding this comment.
Oui c'est plus un oubli, c'est un token pour sécuriser l'api de nettoyage des logs d'audit
|
🎉 Deployment for commit d8890a1 : Docker images
|
Summary
GET /api/public/referents-egalite-professionnelle?format=json|csvDsfrTable,useDsfrModalhook, regions/counties domain dictionariesBased on
feat/issue-3178-admin-role.Closes #3182
Note: Drizzle migration needs to be generated manually (
pnpm db:generate) — drizzle-kit requires a TTY for interactive conflict resolution.Quality gates
Generated with Claude Code