mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-03 04:25:24 +02:00
feat: "I Made This" Dialog (#1801)
* added chef hat * removed unnecessary log * modified recipe and recipe timeline event schema changed timeline event "message" -> "event_message" added "last made" timestamp to recipe * added "I made this" dialog to recipe action menu * added missing field and re-ran code-gen * moved dialog out of context menu and refactored removed references in action menu and context menu refactored dialog to be triggered by a button instead added route to update recipe last made timestamp added visual for last made timestamp to recipe header and title * added sorting by last made * switched event type to comment * replaced alter column with pydantic alias * added tests for event message alias
This commit is contained in:
parent
f0e6496001
commit
a2dcdc1adf
20 changed files with 275 additions and 9 deletions
|
@ -176,6 +176,52 @@ def test_delete_timeline_event(api_client: TestClient, unique_user: TestUser, re
|
|||
assert event_response.status_code == 404
|
||||
|
||||
|
||||
def test_timeline_event_message_alias(api_client: TestClient, unique_user: TestUser, recipes: list[Recipe]):
|
||||
# create an event using aliases
|
||||
recipe = recipes[0]
|
||||
new_event_data = {
|
||||
"userId": unique_user.user_id,
|
||||
"subject": random_string(),
|
||||
"eventType": "info",
|
||||
"eventMessage": random_string(), # eventMessage is the correct alias for the message
|
||||
}
|
||||
|
||||
event_response = api_client.post(
|
||||
api_routes.recipes_slug_timeline_events(recipe.slug),
|
||||
json=new_event_data,
|
||||
headers=unique_user.token,
|
||||
)
|
||||
new_event = RecipeTimelineEventOut.parse_obj(event_response.json())
|
||||
assert str(new_event.user_id) == new_event_data["userId"]
|
||||
assert str(new_event.event_type) == new_event_data["eventType"]
|
||||
assert new_event.message == new_event_data["eventMessage"]
|
||||
|
||||
# fetch the new event
|
||||
event_response = api_client.get(
|
||||
api_routes.recipes_slug_timeline_events_item_id(recipe.slug, new_event.id), headers=unique_user.token
|
||||
)
|
||||
assert event_response.status_code == 200
|
||||
|
||||
event = RecipeTimelineEventOut.parse_obj(event_response.json())
|
||||
assert event == new_event
|
||||
|
||||
# update the event message
|
||||
new_subject = random_string()
|
||||
new_message = random_string()
|
||||
updated_event_data = {"subject": new_subject, "eventMessage": new_message}
|
||||
|
||||
event_response = api_client.put(
|
||||
api_routes.recipes_slug_timeline_events_item_id(recipe.slug, new_event.id),
|
||||
json=updated_event_data,
|
||||
headers=unique_user.token,
|
||||
)
|
||||
assert event_response.status_code == 200
|
||||
|
||||
updated_event = RecipeTimelineEventOut.parse_obj(event_response.json())
|
||||
assert updated_event.subject == new_subject
|
||||
assert updated_event.message == new_message
|
||||
|
||||
|
||||
def test_create_recipe_with_timeline_event(api_client: TestClient, unique_user: TestUser, recipes: list[Recipe]):
|
||||
# make sure when the recipes fixture was created that all recipes have at least one event
|
||||
for recipe in recipes:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue