SQL reduction: ask for forgiveness

from blog nickb.dev, | ↗ original
In an app that has S3 files and a Postgres database storing file metadata, we might have a DELETE route that looks something like: Select file from db, and if it does not exist throw a 404. If the file’s owner isn’t our session’s user, check the db if the session’s user is an admin Delete file from the db Delete file from S3 The above steps...