reenroll when failed

This commit is contained in:
2025-09-12 20:16:08 -03:00
parent e51964bc8b
commit 9fb1895557
4 changed files with 25 additions and 15 deletions

View File

@@ -9,9 +9,7 @@ from aws_lambda_powertools.utilities.typing import LambdaContext
from layercake.dynamodb import DynamoDBPersistenceLayer, SortKey, TransactKey
from boto3clients import dynamodb_client
from config import (
ENROLLMENT_TABLE,
)
from config import ENROLLMENT_TABLE
from enrollment import LinkedEntity, enroll
from schemas import Course, Enrollment, User
@@ -46,6 +44,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
return enroll(
enrollment,
org=metadata.get('org', None),
subscription=subscription,
deduplication_window={'offset_days': metadata['dedup_window_offset_days']},
linked_entities=frozenset({LinkedEntity(new_image['id'], 'ENROLLMENT')}),

View File

@@ -54,6 +54,12 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
},
cond_expr='attribute_not_exists(sk)',
)
transact.delete(
key=KeyPair(
pk=new_image['id'],
sk='parent_vacancy',
),
)
except Exception:
return False
else: