ubclaunchpad / LP-website

UBC Launch Pad knowledge base
https://www.ubclaunchpad.com
8 stars 5 forks source link

Partial doc API #272

Closed armintalaie closed 2 months ago

armintalaie commented 10 months ago

implementing the doc manipulations for S3 via an API

Acceptance Criteria

would not need to be safeguarded by user auth at this point

KeveenWong commented 9 months ago

DELETE endpoint case 2: unsuccessful - file does not exist deleteObject(params = {}, callback) ⇒ AWS.Request Removes an object from a bucket. The behavior depends on the bucket's versioning state:

If versioning is enabled, the operation removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects but will still respond that the command was successful.

If versioning is suspended or not enabled, the operation permanently deletes the object.

Basically, S3 responds with a success if the object does not exist. if we want, i can do a check if the objectKey exists and throw an error if it doesnt.

PATCH endpoint "If you upload an object with a key name that already exists in a versioning-enabled bucket, Amazon S3 creates another version of the object instead of replacing the existing object."

it seems there is no "PATCH" or "UPDATE" in s3; "No, there is no concept of updating a file on S3. A file on S3 is updated the same way it is uploaded in the first place - through a PUT object request." we will have to read the object, make changes to the object, and then write the entire object back to s3.