add set as expired

This commit is contained in:
2025-08-22 18:04:21 -03:00
parent 45f444a222
commit 4acf85fd85
17 changed files with 87 additions and 53 deletions

View File

@@ -4,7 +4,7 @@ from aws_lambda_powertools.utilities.data_classes import (
event_source,
)
from aws_lambda_powertools.utilities.typing import LambdaContext
from layercake.dynamodb import DynamoDBPersistenceLayer
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, SortKey, TransactKey
from boto3clients import dynamodb_client
from config import (
@@ -19,5 +19,10 @@ enrollment_layer = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
@logger.inject_lambda_context
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
new_image = event.detail['new_image']
enrollment = enrollment_layer.collection.get_items(
TransactKey(pk=new_image['id'])
+ SortKey('METADATA#DEDUPLICATION_WINDOW', rename_key='DEDUPLICATION_WINDOW')
+ SortKey('METADATA#COURSE', rename_key='COURSE'),
)
return True