-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from TheScienceMuseum/improvements
Improvements
- Loading branch information
Showing
9 changed files
with
143 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const AWS = require('aws-sdk'); | ||
const dynamoDB = new AWS.DynamoDB({region: process.env.REGION}); | ||
const querystring = require('querystring'); | ||
const listObjects = require('../lib/listObjects'); | ||
const s3 = new AWS.S3({region: process.env.REGION}); | ||
|
||
module.exports.handler = function (event, context, callback) { | ||
var params = querystring.parse(event.body); | ||
|
||
return dynamoDB.deleteItem({ | ||
TableName: process.env.TABLE_NAME, | ||
Key: { | ||
'id': { | ||
S: params.id | ||
} | ||
} | ||
}, function (err, data) { | ||
if (err) return callback(err); | ||
|
||
return s3.deleteObject({ | ||
Bucket: process.env.S3_BUCKET, | ||
Key: params.id | ||
}, function(err, data) { | ||
if (err) return callback(err); | ||
|
||
return listObjects({}, {}, callback); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters