Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x | /**
* SQS-driven: removes the like rows, installing flows, comments, comment blocks and search index
* rows of a deleted pack, which are unbounded and so cannot be removed within
* the request. A retried message is harmless. Until then the search finds no
* deleted pack: its matches are checked against the pack rows.
*
* @implements UC-STORE-007.1, UC-STORE-009.1, UC-STORE-010.1, UC-STORE-012.1
*/
const { DynamoDBClient } = require('@aws-sdk/client-dynamodb')
const { DynamoDBDocumentClient } = require('@aws-sdk/lib-dynamodb')
const {
deleteAllLikesForPack,
deleteAllImportsForPack,
deleteAllCommentsForPack
} = require('../utils/packCleanup')
const { deleteSearchIndexRows } = require('../utils/directorySearchIndex')
const docClient = DynamoDBDocumentClient.from(new DynamoDBClient({}))
exports.handler = async (event) => {
for (const record of event.Records) {
const { packId } = JSON.parse(record.body)
await deleteAllLikesForPack(docClient, packId)
await deleteAllImportsForPack(docClient, packId)
await deleteAllCommentsForPack(docClient, packId)
await deleteSearchIndexRows(docClient, process.env.FIELD_VALUE_INDEX_TABLE_NAME, 'PACK', packId)
}
}
|