add restore
This commit is contained in:
@@ -131,6 +131,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
# Add created_by if present
|
||||
| (
|
||||
{
|
||||
# Post-migration: rename `author` to `created_by`
|
||||
'author': {
|
||||
'id': created_by['user_id'],
|
||||
'name': created_by['name'],
|
||||
|
||||
@@ -28,7 +28,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
subscription = enrollment_layer.collection.get_items(
|
||||
TransactKey(enrollment_id)
|
||||
+ SortKey('METADATA#SUBSCRIPTION_COVERED')
|
||||
+ SortKey('CANCELED', path_spec='canceled_by', rename_key='canceled_by')
|
||||
+ SortKey('CANCELED', rename_key='canceled_by')
|
||||
)
|
||||
|
||||
created_at: datetime = fromisoformat(new_image['created_at']) # type: ignore
|
||||
@@ -66,9 +66,17 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
}
|
||||
| pick(('user', 'course', 'enrolled_at'), old_enrollment)
|
||||
# Add `created_by` if present
|
||||
| ({'author': canceled_by} if canceled_by else {}),
|
||||
# Post-migration: uncomment the following line
|
||||
# | ({'created_by': canceled_by} if canceled_by else {}),
|
||||
| (
|
||||
{
|
||||
# Post-migration: rename `author` to `canceled_by`
|
||||
'author': {
|
||||
'id': canceled_by['user_id'],
|
||||
'name': canceled_by['name'],
|
||||
},
|
||||
}
|
||||
if canceled_by
|
||||
else {}
|
||||
),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
)
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user