get bag tiddler and put recipe tiddler should return the bag name

This commit is contained in:
Jeremy Ruston 2024-01-19 20:12:29 +00:00
parent 8f9ae7e4d5
commit 01d29ed11e
3 changed files with 4 additions and 5 deletions

View File

@ -40,7 +40,7 @@ exports.handler = function(request,response,state) {
}
});
tiddlerFields.revision = "0";
tiddlerFields.bag = "bag-gamma";
tiddlerFields.bag = bag_name;
tiddlerFields.type = tiddlerFields.type || "text/vnd.tiddlywiki";
state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(tiddlerFields),"utf8");
} else {

View File

@ -39,11 +39,9 @@ exports.handler = function(request,response,state) {
});
// Require the recipe names to match
if(recipe_name === recipe_name_2) {
$tw.sqlTiddlerStore.saveRecipeTiddler(fields,recipe_name);
var recipe_bags = $tw.sqlTiddlerStore.getRecipeBags(recipe_name),
top_bag = recipe_bags[recipe_bags.length - 1];
var bag_name = $tw.sqlTiddlerStore.saveRecipeTiddler(fields,recipe_name);
response.writeHead(204, "OK",{
Etag: "\"" + top_bag + "/" + encodeURIComponent(title) + "/" + 2222 + ":\"",
Etag: "\"" + bag_name + "/" + encodeURIComponent(title) + "/" + 2222 + ":\"",
"Content-Type": "text/plain"
});
response.end();

View File

@ -270,6 +270,7 @@ SqlTiddlerStore.prototype.saveRecipeTiddler = function(tiddlerFields,recipename)
});
// Save the tiddler to the topmost bag
this.saveBagTiddler(tiddlerFields,row.bag_name);
return row.bag_name;
};
SqlTiddlerStore.prototype.deleteTiddler = function(title,bagname) {