Skip to content
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

Open
wants to merge 1 commit into
base: multi-wiki-support
Choose a base branch
from

Conversation

well-noted
Copy link

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

Copy link

@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).

Copy link

netlify bot commented Dec 16, 2024

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit 1758a9c
🔍 Latest deploy log https://app.netlify.com/sites/tiddlywiki-previews/deploys/6760bad52fa8db00085bfd6b
😎 Deploy Preview https://deploy-preview-8822--tiddlywiki-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

});
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with TW do not indent the code inside the outer (function() { wrapper. -- It is intended to remove those wrapper functions in a future PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the extra indentation is removed, IMO your PR should only contain 2 files. The rest should stay as it was.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @pmario points out, it is important to match the formatting conventions used elsewhere in the code. I appreciate that that often means fighting tooling that wants to do things differently, and we do have an interest in improving the situation.

Copy link

well-noted has signed the Contributor License Agreement (see contributing.md)

Copy link
Member

@Jermolene Jermolene left a 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") {
Copy link
Member

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.

});
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @pmario points out, it is important to match the formatting conventions used elsewhere in the code. I appreciate that that often means fighting tooling that wants to do things differently, and we do have an interest in improving the situation.

@@ -4,57 +4,83 @@ type: application/javascript
module-type: mws-route
POST /recipes
DELETE /recipes (via _method=DELETE)
Copy link
Member

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"
/*
Copy link
Member

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.

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.

3 participants