GET /shopping-list?date= (shopping-list.service.ts/.routes.ts) somme les ingrédients de chaque recette planifiée sur la semaine, mis à l'échelle par les portions de chaque créneau (PlanningItem.portions / Recipe.portions), regroupés par paire (ingredientId, unitId) — jamais null contrairement à GET /planning, une semaine vide redescend en items: []. Côté web, ShoppingListPage rend cette liste groupée par rayon (même IngredientCategory que IngredientPicker), triée alphabétiquement en français à l'intérieur d'un rayon (shopping-list.ts, logique pure extraite du composant). WeekNavigator (flèches + calendrier) est extrait de PlanningPage vers features/planning/ pour être partagé entre les deux pages ; ses libellés migrent de planning.* vers common.weekNav.*/ common.calendar.*/common.days.*, plus génériques pour une page qui n'est plus seulement le planning. ComingSoonPage retiré (plus aucun appelant, Liste de courses avait le dernier stub restant). Tests : Mocha (agrégation, mise à l'échelle par portions, unités non fusionnées) + Cucumber (shopping-list.feature : liste vide, groupement/tri, navigation de semaine) + mise à jour de layout.cy.ts/planning-page.cy.ts pour le nouveau rendu. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
19 lines
944 B
TypeScript
19 lines
944 B
TypeScript
import { z } from "zod";
|
|
|
|
// See schemas/auth.ts for the shared client/server validation rationale.
|
|
|
|
/**
|
|
* Payload accepted by `GET /shopping-list`'s `?date=` query param — same
|
|
* shape/rationale as `schemas/planning.ts`'s `getPlanningByDateSchema`
|
|
* (only checks the `YYYY-MM-DD` shape, real-calendar-date validation is
|
|
* service-side via `@batch-cooking/date-tools`'s `parseDateOnly`). Kept as
|
|
* its own schema rather than importing `getPlanningByDateSchema` — each
|
|
* router module owns its own request contract in this repo, even when two
|
|
* happen to share a shape (see the two near-identical `date` fields already
|
|
* inside `schemas/planning.ts` itself).
|
|
*/
|
|
export const getShoppingListSchema = z.object({
|
|
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date invalide"),
|
|
});
|
|
/** Inferred TS type for {@link getShoppingListSchema}'s validated output. */
|
|
export type GetShoppingListInput = z.infer<typeof getShoppingListSchema>;
|