feat(meals): import the Tandoor meal plan / importer le planning Tandoor (+ 2 fixes) - #107
Merged
NexaFlowFrance merged 3 commits intoSep 27, 2026
Conversation
EN: Tandoor 2.x rejects the legacy "Token <key>" scheme on most endpoints (/api/recipe/ answers 403) while /api/user-preferences/ still accepts it, so the connection test passed but every sync failed. "Bearer <key>" is the documented scheme for Tandoor API tokens and works everywhere. FR : Tandoor 2.x refuse l'ancien schéma « Token <clé> » sur la plupart des routes (/api/recipe/ répond 403) alors que /api/user-preferences/ l'accepte encore : le test de connexion passait mais chaque synchro échouait. « Bearer <clé> » est le schéma documenté et fonctionne partout.
EN: The todo/item/list WebSocket command answers { items: [...] } for the
requested entity; it is not keyed by entity_id (that shape belongs to the
todo.get_items service). Modern todo lists (local_todo…) therefore always
imported 0 items.
FR : La commande WebSocket todo/item/list renvoie { items: [...] } pour
l'entité demandée, et non un objet rangé par entity_id (c'est le format
du service todo.get_items). Les listes modernes (local_todo…) importaient
donc toujours 0 article.
EN: The Tandoor integration only imported recipes, so a family planning its meals in Tandoor saw an empty week in OpenFamily. Adds an "Import from Tandoor" button on the meal planning page (parents only, once a Tandoor integration is connected). The dialog reads the Tandoor meal plan of the displayed week, lets the user match each Tandoor meal type (free text: "Lunch", "Midi"…) to an OpenFamily meal or skip it (best guess pre-selected), and previews the result slot by slot. Meals already planned are kept unless "Replace meals that are already planned" is ticked. Server: fetchTandoorMealPlan() (paginated or plain-array answers, multi-day entries expanded), GET /api/integrations/tandoor/meal-plan (preview) and POST /api/integrations/tandoor/meal-plan/import (entries fetched again server-side, the client only sends its choices). Recipes already imported by the sync are linked by name, otherwise a custom meal is stored; entries on the same slot are merged. Parent-only, URL re-validated, 31-day max range. Translations for en, fr, es, pt, ru, zh. FR : L'intégration Tandoor n'importait que les recettes : une famille qui planifie ses repas dans Tandoor voyait une semaine vide dans OpenFamily. Ajoute un bouton « Importer depuis Tandoor » sur le planning des repas (parents uniquement, intégration Tandoor connectée). La fenêtre lit le planning Tandoor de la semaine affichée, fait associer chaque type de repas Tandoor (texte libre : « Midi », « Lunch »…) à un repas OpenFamily ou l'ignorer (correspondance proposée d'office), et montre un aperçu créneau par créneau. Les repas déjà planifiés sont conservés sauf si « Remplacer les repas déjà planifiés » est coché. Serveur : fetchTandoorMealPlan() (réponses paginées ou en tableau, repas sur plusieurs jours dépliés), GET /api/integrations/tandoor/meal-plan (aperçu) et POST /api/integrations/tandoor/meal-plan/import (planning relu côté serveur, le client n'envoie que ses choix). Les recettes déjà importées par la synchro sont liées par leur nom, sinon repas personnalisé ; plusieurs repas sur un même créneau sont regroupés. Réservé aux parents, URL revérifiée, 31 jours max. Traductions en, fr, es, pt, ru, zh.
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.
🇬🇧 English
Why
The Tandoor integration only imports recipes. A family that plans its week in Tandoor sees an empty meal planning in OpenFamily and has to re-type every meal.
What's new: an "Import from Tandoor" button on the meal planning page
The button is visible to parents only, once a Tandoor integration is connected. It opens a dialog that:
How it works on the server:
GET /api/integrations/tandoor/meal-planreturns the preview, andPOST /api/integrations/tandoor/meal-plan/importdoes the import. On import, the server fetches the entries again itself; the client only sends its matching and the overwrite choice.assertSafeIntegrationUrl) and accept at most 31 days.Fixes
Tokenscheme on/api/recipe/(403), while/api/user-preferences/still accepts it. So the connection test passed but every sync failed. The code now sendsBearer, the documented scheme.todo/item/listanswers{ items: [...] }, not an object keyed by entity_id. As a result, lists such aslocal_todoalways imported 0 items.Tested
npm run build,check:i18nandcheck:publicpass.local_todolist: 17 items imported, against 0 before the fix.The three commits are independent, and I can split them into separate PRs if you prefer.
🇫🇷 Français
Pourquoi
L'intégration Tandoor n'importe que les recettes. Une famille qui planifie sa semaine dans Tandoor voit un planning des repas vide dans OpenFamily et doit tout ressaisir.
Nouveauté : un bouton « Importer depuis Tandoor » sur le planning des repas
Le bouton n'apparaît que pour les parents, et seulement quand l'intégration Tandoor est connectée. Il ouvre une fenêtre qui :
Fonctionnement côté serveur :
GET /api/integrations/tandoor/meal-planrenvoie l'aperçu,POST /api/integrations/tandoor/meal-plan/importfait l'import. À l'import, le serveur relit lui-même le planning ; le client n'envoie que ses choix de correspondance et l'option de remplacement.Corrections
Tokensur la liste des recettes (erreur 403), alors que le test de connexion, lui, passait. Toutes les synchros échouaient donc. Le code utilise maintenantBearer, le schéma documenté.todo/item/listcontient directement{ items: [...] }, et non un objet rangé par entité. Les listes commelocal_todoimportaient donc toujours 0 article.Tests
local_todo: 17 articles importés, contre 0 avant la correction.Les trois commits sont indépendants, et je peux les séparer en trois PR si vous préférez.