feat: Add PUT endpoint for products and related tests#12
Conversation
| db.session.remove() | ||
| return { | ||
| "error": { | ||
| "message": "Internal server error.", |
There was a problem hiding this comment.
Nit: Probably better to print a specific error (which in this could be along the lines of "failed to update/save product", considering the single operation in the try block). Helps quick debugging and pinpointing the concerned block.
There was a problem hiding this comment.
Not sure I agree, 500s are by nature catch-alls for unexpected failures, so keeping the message generic is intentional. The specific error would be visible in server logs, which is the right place for debugging internals rather than exposing them in API responses (which could also turn into a security concern for server level issues)
| } | ||
| }, 404 | ||
|
|
||
| product.name = name |
There was a problem hiding this comment.
As slug will always remain the same despite the name, why is that desirable?
There was a problem hiding this comment.
Good question, it's an intentional decision for a couple reasons. Product name changes are extremely rare so any name/slug drift is equally rare and manageable, and slugs are used as path parameters across most endpoints, so regenerating them on name change would break any existing URLs, scripts, or integrations pointing at the old slug without giving the user any warning
Done
create_product_deploymentNormalizeNameMixinQA
Issue / Card
https://warthogs.atlassian.net/browse/WD-33171