Here is how the new logic works for uploading images:
If the defaultImage is null and the user has not uploaded an image, then the image will be removed from the store/coupon.
If the defaultImage is "" and the user has not uploaded an image, then the image will be removed from the store/coupon. (This might be caused by a bug on the image uploading functionality, but I decided to handle it anyway. We can always remove functionality out later.)
If the defaultImage is some image name, and the user has not uploaded an image, then the defaultImage URL will be used as the store/coupon image name.
If the user has uploaded a file called image, it will be uploaded to S3, and the filename on S3 will be used as the store/coupon image name.
This PR allows images to be null or undefined.
Here is how the new logic works for uploading images:
If the
defaultImage
is null and the user has not uploaded an image, then the image will be removed from the store/coupon.If the
defaultImage
is""
and the user has not uploaded an image, then the image will be removed from the store/coupon. (This might be caused by a bug on the image uploading functionality, but I decided to handle it anyway. We can always remove functionality out later.)If the
defaultImage
is some image name, and the user has not uploaded an image, then thedefaultImage
URL will be used as the store/coupon image name.If the user has uploaded a file called
image
, it will be uploaded to S3, and the filename on S3 will be used as the store/coupon image name.Fixes #125 and fixes #137.