Task E: Deleting Pictures
It’s reasonable for users to want to remove images they no longer wish to display. Therefore, we need to provide a way for users to select images they wish to remove and tell the application about it. To delete a picture, we’ll have to remove both the original image and the generated thumbnail from the database.
Since the images can only be removed by the owner, we’ll check if the ID of the owner of the page matches the user in the session. When this is the case, we’ll display a button next to the image that will allow the user to delete it.
Implementing the Server Route
First we need to write the service operation for deleting images from the database. Let’s open up the queries.sql file and add the query for deleting ...
Get Web Development with Clojure, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.