guyver2 / battlechess

Chess with Battleship modification. You can only see around your pieces.
3 stars 4 forks source link

Adds avatar upload of a custom avatar. Fixes #38. #48

Closed quimnuss closed 3 years ago

quimnuss commented 3 years ago

Adds an endpoint ("/users/u/{userID}/avatar") to upload a file and save it to disk using the avatar id of the user. It checks for file but it doesn't check its sanity (this requires installling Pillow module).

Tests are conditional to having Pillow module installed to create or load an image.

I think this structure will be enough but there's an integration bug to be solved: atm I use {user_id}_avatar.jpeg as filename, but the user has an avatar filename parameter, do we want to use that as filename ? I think it's superfluous but if we might have different directories or whatever might be useful.

Atm it stores the image file to disk, but we could use a MinIO or something to be more organized.

I've discarded the option of storing the image in the database, it wasn't pretty imo...