In our new API-Centric approach, how do we handle placeholder images (based on category/topic/sub-topic) ?
null for a non-existent image and we have a separate endpoint that provides all the placeholder images for each category and the frontend can use both to display the correct placeholder.@mariobehling @aviaryan @SaptakS @shubham-padia @magdalenesuo your views ?
Right now, in the /browse UI, placeholder images are not being differentiated from a real image at all. So I think we should have the API response return placeholder image if event's background is null.
But, after we move to the API centric approach, the edit event page may also use the same API for fetching existing event details. It won't be good to return placeholder images there.
If the endpoints for fetching /browse event information and fetching edit event's event information are different, we can easily do things in the backend to return placeholder images only where they are really needed.
In short, I am with returning placeholder images in the same API but this depends on how API endpoints are going to be defined.
I think fetching from a separate endpoint is a better option. That way things would be clean and separate and won't create confusion in terms of API results returned. If there is no background image, the API endpoint should return a null value instead of a placeholder value to avoid confusion at later stages of production. This also helps in avoiding any kind of interference with editing or updating event page. We can put the logic in the front-end only. I don't think it will make the js much heavy because it should be done by a single if check.
Another alternative which I think is even better is in the API endpoint for events, we add an attribute placeholder_image which will contain the placeholder image depending on the category even if a background image is uploaded. Then in front-end we will see that if background image present, use that, else use the placeholder_image attribute. This way the number of API requests will also stay minimal and there won't be any problem in readability as well. What do you think @niranjan94 @aviaryan @shubham-padia @magdalenesuo ?
Another alternative which I think is even better is in the API endpoint for events, we add an attribute placeholder_image which will contain the placeholder image depending on the category even if a background image is uploaded.
:+1: Since an event will only have one placeholder image, adding a field like this won't cause any overhead. And this certainly removes all ambiguities.
Another alternative which I think is even better is in the API endpoint for events, we add an attribute placeholder_image which will contain the placeholder image depending on the category even if a background image is uploaded.
@SaptakS I like the option suggested by you ... 馃憤
So should I work on this? @niranjan94
@aviaryan yes. You can proceed.
Most helpful comment
:+1: Since an event will only have one placeholder image, adding a field like this won't cause any overhead. And this certainly removes all ambiguities.