add events

This commit is contained in:
2025-08-21 22:18:37 -03:00
parent c70a74b94a
commit 3ab20c485b
19 changed files with 315 additions and 164 deletions

View File

@@ -44,6 +44,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
org_id = new_image['org_id']
enrollment = enrollment_layer.collection.get_items(
TransactKey(new_image['id']) + SortKey('0') + SortKey('author')
# Post-migration: uncomment the following line
# + SortKey('CREATED_BY')
)
if not enrollment:
@@ -97,7 +99,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
# Add enrollment entry to billing
try:
author = enrollment.get('author')
canceled_by = enrollment.get('author')
course_id = enrollment['course']['id']
course = course_layer.collection.get_items(
KeyPair(
@@ -129,11 +131,11 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
| (
{
'author': {
'id': author['user_id'],
'name': author['name'],
'id': canceled_by['user_id'],
'name': canceled_by['name'],
}
}
if author
if canceled_by
else {}
),
cond_expr='attribute_not_exists(sk)',