remove items on canceled order
This commit is contained in:
@@ -5,7 +5,6 @@ from aws_lambda_powertools.utilities.data_classes import (
|
||||
)
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import (
|
||||
ComposeKey,
|
||||
DynamoDBPersistenceLayer,
|
||||
KeyPair,
|
||||
)
|
||||
@@ -33,8 +32,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
result = enrollment_layer.collection.query(
|
||||
KeyPair(
|
||||
# Post-migration: Uncomment the following line
|
||||
# ComposeKey(tenant_id, prefix='slots#org'),
|
||||
ComposeKey(tenant_id, prefix='vacancies'),
|
||||
# f'slots#org#{tenant_id}',
|
||||
f'vacancies#{tenant_id}',
|
||||
order_id,
|
||||
)
|
||||
)
|
||||
@@ -45,8 +44,9 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
for pair in result['items']:
|
||||
batch.delete_item(
|
||||
Key={
|
||||
# Post-migration: Rename `vacancies` to `slots#org`
|
||||
'id': {'S': ComposeKey(pair['id'], prefix='vacancies')},
|
||||
# Post-migration: Uncomment the following line
|
||||
# 'id': {'S': f'slots#org#{tenant_id}'},
|
||||
'id': {'S': f'vacancies#{tenant_id}'},
|
||||
'sk': {'S': pair['sk']},
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user