ruichen199801 / forxnews

CIS550 database course project
https://youtu.be/nuDBwg3mG6o
0 stars 1 forks source link

[Improvement] Generate Random Images for Restaurants #32

Closed ruichen199801 closed 1 year ago

ruichen199801 commented 1 year ago

Currently we use a default image for all restaurants, as restaurant images are missing in our chosen datasets.

For demo purpose, we can fetch random restaurant images using Unsplash API:

  1. Create a RestaurantMedia table:
    CREATE TABLE RestaurantMedia
    (
    restaurantId char(22) NOT NULL,
    imageUrl     varchar(2083),
    PRIMARY KEY (restaurantId),
    FOREIGN KEY (restaurantId) REFERENCES Restaurant (restaurantId)
    );
  2. Switch to feature/unsplash branch, start local server and call unsplash API to get photos (50 request / hour)
  3. Copy imageUrls to notebook, create a dataset with restaurantId and imageUrl, export it and upload to RestaurantMedia table
  4. Make changes in express routes to join RestaurantMedia table to include imageUrl in response, and change logics in React accordingly

We can persist the photos using cloud service such as Google Cloud or Cloudinary if the previous steps go smooth.

ruichen199801 commented 1 year ago

We may need to define the border-radius property for new images in addition to width and height.

ruichen199801 commented 1 year ago

We do not plan to persist the photos in cloud, as this will require us to store cloud urls in RestaurantMedia table and brings unnecessary complexity.

ruichen199801 commented 1 year ago

60 is a stable prod version without images. We could revert to it in case things go wrong.