Recipe edit (WIP): forms to edit groups, steps and ingredients

This commit is contained in:
Greg Burri 2024-12-26 01:39:07 +01:00
parent dd05a673d9
commit 07b7ff425e
25 changed files with 881 additions and 203 deletions

View file

@ -18,14 +18,61 @@ VALUES (
NULL
);
INSERT INTO [Recipe] ([user_id], [title], [is_published])
VALUES (1, 'Croissant au jambon', true);
INSERT INTO [Recipe] ([id], [user_id], [title], [is_published])
VALUES (1, 1, 'Croissant au jambon', true);
INSERT INTO [Recipe] ([user_id], [title], [is_published])
VALUES (1, 'Gratin de thon aux olives', true);
INSERT INTO [Recipe] ([id], [user_id], [title], [is_published])
VALUES (2, 1, 'Gratin de thon aux olives', true);
INSERT INTO [Recipe] ([user_id], [title], [is_published])
VALUES (1, 'Saumon en croute', true);
INSERT INTO [Recipe] ([id], [user_id], [title], [is_published])
VALUES (3, 1, 'Saumon en croute', true);
INSERT INTO [Recipe] ([user_id], [title], [is_published])
VALUES (2, 'Ouiche lorraine', true);
INSERT INTO [Recipe] ([id], [user_id], [title], [is_published])
VALUES (4, 2, 'Ouiche lorraine', true);
-- Groups, steps and ingredients for 'Gratin de thon'.
INSERT INTO [Group] ([id], [order], [recipe_id], [name], [comment])
VALUES (1, 1, 2, "Fond du gratin", "");
INSERT INTO [Group] ([id], [order], [recipe_id], [name], [comment])
VALUES (2, 2, 2, "Sauce", "");
INSERT INTO [Step] ([id], [order], [group_id], [action])
VALUES (1, 1, 1, "Égoutter et émietter dans un plat à gratting graissé");
INSERT INTO [Ingredient] ([id], [step_id], [name], [comment], [quantity_value], [quantity_unit])
VALUES (1, 1, "Thon en boîte", "", 240, "g");
INSERT INTO [Step] ([id], [order], [group_id], [action])
VALUES (2, 2, 1, "Saupoudrer");
INSERT INTO [Ingredient] ([id], [step_id], [name], [comment], [quantity_value], [quantity_unit])
VALUES (2, 2, "Sel à l'origan", "", 1, "c-à-c");
INSERT INTO [Step] ([id], [order], [group_id], [action])
VALUES (3, 3, 2, "Mélanger au fouet et verser sur le thon dans le plat");
INSERT INTO [Ingredient] ([id], [step_id], [name], [comment], [quantity_value], [quantity_unit])
VALUES (3, 3, "Concentré de tomate", "", 4, "c-à-s");
INSERT INTO [Ingredient] ([id], [step_id], [name], [comment], [quantity_value], [quantity_unit])
VALUES (4, 3, "Poivre", "", 0.25, "c-à-c");
INSERT INTO [Ingredient] ([id], [step_id], [name], [comment], [quantity_value], [quantity_unit])
VALUES (5, 3, "Herbe de Provence", "", 0.5, "c-à-c");
INSERT INTO [Ingredient] ([id], [step_id], [name], [comment], [quantity_value], [quantity_unit])
VALUES (6, 3, "Crème à café ou demi-crème", "", 2, "dl");
INSERT INTO [Ingredient] ([id], [step_id], [name], [comment], [quantity_value], [quantity_unit])
VALUES (7, 3, "Olives farcies coupées en deuxs", "", 50, "g");
INSERT INTO [Group] ([id], [order], [recipe_id], [name], [comment])
VALUES (3, 3, 2,
"15 à 20 minutes de cuisson au four à 220 °C",
"Servir avec du riz ou des patates robe des champs");

View file

@ -89,21 +89,12 @@ CREATE TABLE [Tag] (
CREATE UNIQUE INDEX [Tag_name_lang_index] ON [Tag] ([name], [lang]);
CREATE TABLE [Ingredient] (
[id] INTEGER PRIMARY KEY,
[name] TEXT NOT NULL,
[comment] TEXT NOT NULL DEFAULT '',
[quantity_value] INTEGER,
[quantity_unit] TEXT NOT NULL DEFAULT '',
[input_step_id] INTEGER NOT NULL,
FOREIGN KEY([input_step_id]) REFERENCES [Step]([id]) ON DELETE CASCADE
) STRICT;
CREATE TABLE [Group] (
[id] INTEGER PRIMARY KEY,
[order] INTEGER NOT NULL DEFAULT 0,
[recipe_id] INTEGER NOT NULL,
[name] TEXT NOT NULL DEFAULT '',
[comment] TEXT NOT NULL DEFAULT '',
@ -114,15 +105,30 @@ CREATE INDEX [Group_order_index] ON [Group]([order]);
CREATE TABLE [Step] (
[id] INTEGER PRIMARY KEY,
[order] INTEGER NOT NULL DEFAULT 0,
[action] TEXT NOT NULL DEFAULT '',
[group_id] INTEGER NOT NULL,
[action] TEXT NOT NULL DEFAULT '',
FOREIGN KEY(group_id) REFERENCES [Group](id) ON DELETE CASCADE
) STRICT;
CREATE INDEX [Step_order_index] ON [Group]([order]);
CREATE TABLE [Ingredient] (
[id] INTEGER PRIMARY KEY,
[step_id] INTEGER NOT NULL,
[name] TEXT NOT NULL,
[comment] TEXT NOT NULL DEFAULT '',
[quantity_value] REAL,
[quantity_unit] TEXT NOT NULL DEFAULT '',
FOREIGN KEY([step_id]) REFERENCES [Step]([id]) ON DELETE CASCADE
) STRICT;
-- CREATE TABLE [IntermediateSubstance] (
-- [id] INTEGER PRIMARY KEY,
-- [name] TEXT NOT NULL DEFAULT '',