-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DELETE functionality to bags and recipe cards #8822
base: multi-wiki-support
Are you sure you want to change the base?
Add DELETE functionality to bags and recipe cards #8822
Conversation
@well-noted It appears that this is your first contribution to the project, welcome. With apologies for the bureaucracy, please could you prepare a separate PR to the 'tiddlywiki-com' branch with your signature for the Contributor License Agreement (see contributing.md). |
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag.js
Outdated
Show resolved
Hide resolved
well-noted has signed the Contributor License Agreement (see contributing.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @well-noted, much appreciated.
sqlTiddlerDatabase = server.sqlTiddlerDatabase; | ||
|
||
// Handle DELETE request | ||
if(state.data._method === "DELETE") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not keen on the way that the DELETE /bags/:bag-name method is piggybacked into the same handler as the POST /bags method.
I'd prefer to implement DELETE /bags/:bag-name as a separate handler, and to move the logic that allows POST as a synonym for DELETE into mws-server.js (similarly to the PUT/POST mapping it already does). This would allow REST purists to do things properly if they want to.
plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag.js
Outdated
Show resolved
Hide resolved
@@ -4,57 +4,83 @@ type: application/javascript | |||
module-type: mws-route | |||
|
|||
POST /recipes | |||
DELETE /recipes (via _method=DELETE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this should be its own separate handler
recipe: { | ||
table: "recipes", | ||
column: "recipe_name" | ||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diffs here are messed up by the formatting changes which makes it hard to review them, so I'll come back to this once the formatting is fixed.
…ETE mapping to mws-server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @well-noted this looks good to go apart from the unwanted whitespace changes.
Adds delete handlers to post-recipe and post-bag, adds delete functions to sql-tiddler-store and sql-tiddler-database, and adds buttons to get-index.tid