Open mgroves opened 1 year ago
Probably need a transaction to create new article and delete old article.
What happens to any favorites of the previous slug? Updating them ALL is probably too much work for a single endpoint?
Scratch that comment, here's the approach I'm taking:
in this implementation, slug is doing double duty! each slug is of the form "my-title::xyxyxyx" where the "my-title" part is derived from the title and the xyxyxyx part is generated and used as the unique document key SO THAT the title and slug can be mutable WITHOUT having to create a copy of the article AND all the references in favorites documents remain the same
ONLY use GetArticleKey extension WITHIN the data access portions of the application OR within tests/test helpers
PUT /api/articles/:slug
Example request body:
Authentication required, returns the updated Article
Optional fields: title, description, body
The slug also gets updated when the title is changed