I'm not quite sure how to handle an UploadFile object. I'm using Literstar with Motor, and in Mongo I can store binary objects in the db. I would like to have a user profile with a profile picture field that stores an image. I defined the model in Pydantic as
class User(BaseModel):
username: str
password: str
display_name: str
profile_picture: UploadFile
birthdate: date
Now, this works for a post route, where I receive multipart data from the frontend - but what about a get route where I fetch an object from the db and pass it to the frontend? Do I create a second model with UploadFile replaced with bytes?