Skip to content

remove_food_entry: delete exercises, notes and biometrics too - #74

Open
paultristanwagner wants to merge 2 commits into
rwestergren:mainfrom
paultristanwagner:delete-any-entry
Open

paultristanwagner wants to merge 2 commits into
rwestergren:mainfrom
paultristanwagner:delete-any-entry

Conversation

@paultristanwagner

Copy link
Copy Markdown

All code in this PR was written by an AI agent (Claude Opus 5.5) working with me; I directed it and tested the results on my own account. Feel free to take, change or drop any part of it.

Part of #73.

remove_food_entry can now delete every entry type in the diary:
exercises, notes and biometrics as well as foods. delete_entries
matched only servingId, so the other entries couldn't be removed.

They all go through the same DELETE /api/v3/user/{id}/diary-entries,
but the v3 endpoint is picky about the shape. Verified against the live API
and matching what the iOS app sends:

  • exercises are sent as get_diary returns them, keyed by exerciseId
  • notes and biometrics must be keyed by a plain id. With noteId the
    server answers 400, and with biometricId it answers 204 but deletes
    nothing
  • meta must be a JSON string ("{}"). get_diary returns it as an
    object, and sending that back gets a 400 "Not able to deserialize data
    provided"

Changes:

  • client: delete_entries matches entries by the id key of their type
    and reshapes them for v3 (_v3_diary_entry). Food servings are sent
    exactly as before.
  • server: remove_food_entry's description lists the entry types and
    their id fields.
  • README: tool table row.

https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ

delete_entries only matched servingId. Exercises (exerciseId), notes
(noteId) and biometrics (biometricId) go to the same v3 DELETE, but the
endpoint wants notes and biometrics keyed by a plain `id` (with their own
key it answers 204 and deletes nothing, or 400) and `meta` as a JSON
string. Verified against the live API, matching what the app sends.

Claude-Session: https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant