Closed JRSiwiecki closed 1 year ago
Hi @JRSiwiecki, I wasn't requested to review this PR, but I'm doing a similar task and I am confused about how the profile is set up. I looked at your code and noticed that you have code to check whether a profile exists in your POST method, but how would a profile exist if there is no method to create a profile in the first place?
I feel like there should be a task for implementing a POST method that creates a profile with all the fields and tasks like these to patch/change the individual fields. I don't know if this makes sense but I am confused because I don't see any task (HTTP post call handling) for creating a profile.
Resolves #7
FEATURES:
ProfilePicturesView:
Added POST request endpoint (
POST /profile-pictures/
) to upload a profile picture and link it with the user's profile.The POST request requires the following fields:
accountID
andprofilePicture
.Checks if the user already has a profile picture. If yes, returns a
409 Conflict
response with an error message.Otherwise, encodes and uploads the image to Imgur, retrieves the image link, and saves it with the user's profile.
Returns a JSON response with the
profileID
andprofilePicture
links.Added PATCH request endpoint (
PATCH /profile-pictures/
) to update a user's profile picture.The PATCH request requires the following fields:
accountID
andprofilePicture
.Checks if the user has an existing profile picture. If not, returns a
409 Conflict
response with an error message.Otherwise, encodes and uploads the new image to Imgur, retrieves the new image link, and updates it in the user's profile.
Returns a JSON response with the
profileID
and updatedprofilePicture
link.Added DELETE request endpoint (
DELETE /profile-pictures/
) to delete a user's profile picture.The DELETE request requires the field:
accountID
.Checks if the user has an existing profile picture. If not, returns a
404 Not Found
response with an error message.Otherwise, deletes the profile picture link from the user's profile.
Returns a
204 No Content
response.ENDPOINTS:
POST /profile-pictures/
accountID
andprofilePicture
.PATCH /profile-pictures/
accountID
andprofilePicture
.DELETE /profile-pictures/
accountID
.Note: Most migrations files can be ignored, the only change is the date they were created, except for the migrations for profile, which needed to be re-made to update existing tables.