Closed cdepillabout closed 7 years ago
Also, the existing Store
POST and Coupon
POST handlers will now take an imageKey
parameter. This is used to set the imageKey
for a Store
or Coupon
.
This includes the following three handlers:
/store/edit
POST
/store/coupon/\<id\>/edit
POST
/store/coupon/create
POST
LGTM!
This PR adds an
Image
table to hold images uploaded to Kucipong. It changes theStore
andCoupon
tables to reference thisImage
table.Since this PR changes tables, you'll have to run the following sql commands before you run the API:
Three new APIs have been added.
POST Images. This API is for uploading new image files. It accepts
multipart/form-data
. This creates a new entry in theImage
table.Assuming you have an image in the current directory called
goat-cafe.jpg
, you can upload it withcurl
using the following command:The return value is a
Envelope
with theImage
key.There is currently no way to delete images that have been uploaded.
Set an
Image
for aStore
. This sets aStore
'simage
column to anImage
key that has been uploaded in (1).This is a JSON API and can be accessed with
curl
like the following:If the image doesn't exist or the
Image
's owner is not the current user, an error will be returned.Set an
Image
for aCoupon
. This is just like (2), but for aCoupon
instead of aStore
Fixes #161.