add events
This commit is contained in:
@@ -29,8 +29,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
TransactKey(enrollment_id)
|
||||
+ SortKey('METADATA#SUBSCRIPTION_COVERED')
|
||||
# Post-migration: uncomment the following line
|
||||
# + SortKey('CANCELED', path_spec='author', rename_key='author')
|
||||
+ SortKey('canceled', path_spec='author', rename_key='author')
|
||||
# + SortKey('CANCELED', path_spec='canceled_by', rename_key='canceled_by')
|
||||
+ SortKey('canceled', path_spec='author', rename_key='canceled_by')
|
||||
)
|
||||
|
||||
created_at: datetime = fromisoformat(new_image['create_date']) # type: ignore
|
||||
@@ -49,7 +49,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
return False
|
||||
|
||||
try:
|
||||
author = subscription.get('author')
|
||||
canceled_by = subscription.get('canceled_by')
|
||||
# Retrieve canceled enrollment data
|
||||
old_enrollment = order_layer.collection.get_item(
|
||||
KeyPair(
|
||||
@@ -68,7 +68,9 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
}
|
||||
| pick(('user', 'course', 'enrolled_at'), old_enrollment)
|
||||
# Add author if present
|
||||
| ({'author': author} if author else {}),
|
||||
| ({'author': canceled_by} if canceled_by else {}),
|
||||
# Post-migration: uncomment the following line
|
||||
# | ({'created_by': canceled_by} if canceled_by else {}),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
)
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user