feat: multi org/user scoping for services & templates + service↔template links - #25
Merged
Merged
Conversation
…ate links
- services & document_templates gain allowed_organization_ids / allowed_user_ids
(text[] arrays, GIN-indexed); both empty = global. Legacy single org/user
columns kept and derived for backward compat (Studio still reads scope/user_id).
- document template scope is now editable (PUT accepts the lists + replace_scope);
upload accepts the lists too.
- new service_document_templates link table + GET/PUT /services/{id}/templates;
a service with no linked templates falls back to the global default template.
- admin UI: reusable ScopeEditor (chip inputs), wired into ServiceForm,
TemplateUpload, TemplateEditDialog, and the per-service templates page.
- alembic 007 (chained on 005) adds the columns, backfills from the legacy
columns, drops the now-obsolete unique/check constraints, creates the link table.
Wire the admin footer to package.json (NEXT_PUBLIC_APP_VERSION via next.config) instead of the hardcoded '0.1.0', so the displayed version stays in sync.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Résumé
Permet de scoper services et templates de documents à plusieurs organisations et/ou utilisateurs (au lieu d'un seul), de gérer le scope des templates depuis l'admin, et d'associer explicitement un ensemble de templates à un service.
Changements
allowed_organization_ids/allowed_user_ids(Postgrestext[], GIN). Listes vides = global/système. Colonnes legacyorganization_id/user_idconservées et dérivées → compat LinTO Studio (qui lit encorescope/user_id).PUT /document-templates/{id}accepte les listes +replace_scope; l'upload aussi.service_document_templates+GET/PUT /services/{id}/templates. Un service sans template lié retombe sur le template par défaut global.ScopeEditor(chips), branché sur le formulaire service, l'upload/édition de template, et la page templates par service.008: ajoute les colonnes, backfill depuis les colonnes legacy, drop des contraintes obsolètes, crée la table de liaison.package.json(fin du0.1.0codé en dur).Vérifs
Chaîne alembic
001→008appliquée + round-trip sur vrai Postgres ; parité pytest avecnext(zéro régression) ; ruff + tsc OK.