AlfiyaSiddique / TastyTrails

TastyTrails is a web application designed to explore delightful recipes from around the world. It leverages modern technologies to create an immersive culinary experience.
https://delightful-daifuku-a9f6ea.netlify.app/
GNU Affero General Public License v3.0
30 stars 86 forks source link

Fixed Recipe Image Storage & "Update Recipe" Page Improvements #434

Closed IkkiOcean closed 1 week ago

IkkiOcean commented 1 week ago

Description:

This PR addresses two major improvements for the recipe management functionality:

  1. Fixed Recipe Image Storage: Updated the application to store recipe images directly in the database rather than storing them on GitHub, which improves data security, organization, and accessibility.

  2. Enhanced Update Recipe Page: Added support for changing the recipe image on the update page, including backend support. Previously, there was no option to change the image, and the backend controller didn’t support this functionality.


Changes Made:

  1. Recipe Image Storage Fix:

    • Before: Recipe images were being stored on GitHub, which led to complications in managing image data and potential issues with scalability and access.
    • After: Recipe images are now stored directly in the recipes database, making it easier to retrieve, manage, and secure image data.
    • Updates:
      • Modified the backend image handling logic to store images in the database.
      • Adjusted API routes to support image storage as base64 or BLOB data.
  2. Update Recipe Page Fix:

    • Before: The update recipe page did not allow users to change the recipe image, and there was no backend support to handle image updates.
    • After: Added a file input option for the recipe image on the update page, allowing users to upload a new image. Updated the backend controller to support image updates.
    • Updates:
      • Frontend: Added a file upload button on the update recipe page to allow changing the recipe image.
      • Backend: Enhanced the recipe update controller to handle changes in the image field, ensuring the new image is stored correctly in the database.
      • Updated validation and error handling to ensure the image change is optional but, if provided, stored correctly.

Screenshots/Visual Changes:

https://github.com/user-attachments/assets/25016c1a-b962-4e4c-9854-449df45e7ad7

Screenshot 2024-11-09 at 12 04 51 AM

Related Issues:

How should this be tested?

Checklist

netlify[bot] commented 1 week ago

Deploy Preview for delightful-daifuku-a9f6ea canceled.

Name Link
Latest commit 1ac46921c1de81821a7d2c27a395aab26205064f
Latest deploy log https://app.netlify.com/sites/delightful-daifuku-a9f6ea/deploys/672f599c6011c400089f9374
IkkiOcean commented 1 week ago

During the shifting of storage from GitHub to database, I found that update page is not able to change the image of the recipe. so I fixed it also! I hope you dont mind it. @AlfiyaSiddique

AlfiyaSiddique commented 1 week ago

@IkkiOcean can you share a video by creating one dummy recipe with an image upload, since the current video only shows the update operation and not the add operation

IkkiOcean commented 1 week ago

@IkkiOcean can you share a video by creating one dummy recipe with an image upload, since the current video only shows the update operation and not the add operation

yeah sure! doing it right away

AlfiyaSiddique commented 1 week ago

Also remove the GitHub related envs from the env example file

IkkiOcean commented 1 week ago

https://github.com/user-attachments/assets/2d19e0bd-3eb4-4971-8e06-252e09f2cdb2

@AlfiyaSiddique the video of upload

github-actions[bot] commented 1 week ago

🎉 Thank you @IkkiOcean Your pull request has been successfully merged! 🎉 Thank you for your contribution to our project. Your efforts are greatly appreciated. Keep up the fantastic work! 🚀