monographs: add slug field which regenerates on republish#72
monographs: add slug field which regenerates on republish#7201zulfi wants to merge 5 commits intostreetwriters:masterfrom
Conversation
4fe5107 to
7e0e5fa
Compare
| if (!string.IsNullOrEmpty(monograph?.Slug)) | ||
| { | ||
| return NotFound(new | ||
| { | ||
| error = "invalid_id", | ||
| error_description = $"No such monograph found." | ||
| }); | ||
| } |
There was a problem hiding this comment.
I'm still contemplating if we need to add this check. On one hand, I think it makes sense to restrict fetching monograph by id if the slug exists. On another hand, if a user's client app is a bit behind (i.e. doesn't have the slug property yet), they'll be shown the monograph link with the id which will be a 404 causing confusion
There was a problem hiding this comment.
What if we use a different endpoint for monographs with slug? It'll prevent a lot of bugs.
There was a problem hiding this comment.
The public get monograph API is only called on the monograph frontend. I'm trying to understand how having a separate API to fetch by id and slug is beneficial
There was a problem hiding this comment.
True but if we use separate URL on the frontend for slugs, we can easily route users based on that. It will bring clarity and prevent doing extra work every time a slug is not matched. It still won't fix this though:
On another hand, if a user's client app is a bit behind (i.e. doesn't have the slug property yet), they'll be shown the monograph link with the id which will be a 404 causing confusion
Unless we allow both to work.
There was a problem hiding this comment.
created a separate endpoint for getting monographs by slug
also, in the get monography by Id endpoint, I'm not checking for slug anymore
7e0e5fa to
5717b67
Compare
56b64a9 to
db4a2c8
Compare
db4a2c8 to
6904139
Compare
| if (!string.IsNullOrEmpty(monograph?.Slug)) | ||
| { | ||
| return NotFound(new | ||
| { | ||
| error = "invalid_id", | ||
| error_description = $"No such monograph found." | ||
| }); | ||
| } |
There was a problem hiding this comment.
What if we use a different endpoint for monographs with slug? It'll prevent a lot of bugs.
* create separate endpoint for fetching monographs by slug * combine analytics and publish-url endpoint into a publish-info endpoint
No description provided.