plezanje-net / api

NestJS GraphQL web server
GNU General Public License v3.0
7 stars 2 forks source link

Fix upload images async and more #146

Closed salamca closed 2 years ago

salamca commented 2 years ago

Fixes a bug, where image was not saved, but BE already responded and then FE tried to load a nonexistent image file.

User entity had a picture column which was removed. Not clear what was it for (it was all empty).

Image entity had a type column which we do not need anymore. The only information to transfer from this column was wether an image is some user's profile image. The condition was: type=profile and userId=someuserid Before deletion a new relation was established between user and image: profileImage I consider cases (2) where one user had more than one profile image a bug. Was manually chosen which image to keep and the others were discarded.

An author column was added to the image entity, because the uploader is not necessarily also the author.

Some migrations were generated (pending still from typeorm update)

Don't forget to run the migrations...

Test this with: https://github.com/plezanje-net/web/pull/436