I'm developing Flutter app with my own backend in Spring, but question is rather more general. Let's say I have forum functionality in my app, where I want to display posts, comments etc. Each post / comment was of course posted by somebody and therefore I would like to show his/her name and avatar. Note that I send avatar as encoded string and I decode it on frontend side.
Now I'm asking what in general is good approach:
- Should the user info (name, avatar) be part of the PostDTO encapsulated in e.g. PosterInfo or
- only user ID is part of DTO and after fetching all the posts I should fetch information about users afterwards? Should I cache it somehow?
Imagine I'm editing the title of the Post. I send an update request and I receive updated one as an response, but again with this relatively big portion of data with encoded picture and again there is a must of decoding it again and so on...
How do you solve such cases in your apps?