Recipe catalog v2: - Recipe gagne visibility (PERSONAL/HOUSE/PUBLIC), authorId, authorHouseId - Favoris par utilisateur (RecipeFavorite), régimes associés (RecipeDiet) - Aliments "pas aimés" par utilisateur (UserProfileDislikedIngredient), distinct des allergies médicales - API: GET /recipes?tab=favoris|perso|foyer|publique avec contrôle d'accès complet, POST/DELETE /recipes/:id/favorite, édition/suppression réservées à l'auteur (403 NOT_RECIPE_AUTHOR), GET/PATCH /profile/disliked-ingredients - Frontend: vue maître-détail (onglets + tableau + panneau détail), formulaire enrichi (visibilité, régimes), section préférences pour les aliments pas aimés Catalogue d'ingrédients de référence: - Extension du seed de 39 à ~430 ingrédients (viandes, poissons/fruits de mer, légumes, fruits, féculents, condiments/sauces, épices/herbes, pains à sandwich, cuisines italienne/asiatique/mexicaine/maghrébine, liquides et boissons de cuisine, bouillons/fonds) - Chaque ingrédient lié à ses allergènes UE (IngredientAllergy) — les 14 allergènes réglementaires restent tous couverts - Seeding optimisé en requêtes groupées (createMany/diff ciblé) plutôt qu'un upsert par ligne, pour garder resetDatabase() rapide en test Tests: 102 tests Mocha + 32 scénarios BDD, tous verts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
29 lines
1.4 KiB
TypeScript
29 lines
1.4 KiB
TypeScript
import { z } from "zod";
|
|
|
|
// See schemas/auth.ts for the shared client/server validation rationale.
|
|
|
|
/** Payload accepted by `PATCH /profile/diet`. `null` clears the profile's regime — this step of the profile journey is skippable. */
|
|
export const updateDietSchema = z.object({
|
|
dietId: z.number().int().positive().nullable(),
|
|
});
|
|
/** Inferred TS type for {@link updateDietSchema}'s validated output. */
|
|
export type UpdateDietInput = z.infer<typeof updateDietSchema>;
|
|
|
|
/** Payload accepted by `PATCH /profile/allergies`. Replaces the profile's full allergy set — an empty array clears it (also skippable). */
|
|
export const updateAllergiesSchema = z.object({
|
|
allergyIds: z.array(z.number().int().positive()),
|
|
});
|
|
/** Inferred TS type for {@link updateAllergiesSchema}'s validated output. */
|
|
export type UpdateAllergiesInput = z.infer<typeof updateAllergiesSchema>;
|
|
|
|
/**
|
|
* Payload accepted by `PATCH /profile/disliked-ingredients`. Replaces the
|
|
* profile's full "disliked" set — a personal taste preference, not a
|
|
* medical restriction (see `updateAllergiesSchema` above for that distinct
|
|
* list) — an empty array clears it.
|
|
*/
|
|
export const updateDislikedIngredientsSchema = z.object({
|
|
dislikedIngredientIds: z.array(z.number().int().positive()),
|
|
});
|
|
/** Inferred TS type for {@link updateDislikedIngredientsSchema}'s validated output. */
|
|
export type UpdateDislikedIngredientsInput = z.infer<typeof updateDislikedIngredientsSchema>;
|