`;
});
-apiDelete('/feeds/:feed_id',{auth: true}, async (req, res) => {
- const id = req.params.feed_id;
+apiDelete('/accounts/:account_id/feeds/:feed_id',{auth: true}, async (req, res) => {
+ const { feed_id, account_id } = req.params;
+ if(!query.isFeedOwnedBy(account_id, feed_id)) {
+ throw new Error('Invalid feed');
+ }
- query.deleteFeed.run(id);
+ query.deleteFeed.run(feed_id);
+ console.log(`Deleting feed ${feed_id}`);
res.setHeader('HX-Trigger', 'newFeed');
return;
});