add enroll to subscribed

This commit is contained in:
2025-12-08 16:48:31 -03:00
parent 1ff2634bc0
commit 93d96486ff
11 changed files with 148 additions and 108 deletions

View File

@@ -10,8 +10,7 @@ from layercake.dynamodb import DynamoDBPersistenceLayer, SortKey, TransactKey
from boto3clients import dynamodb_client
from config import ENROLLMENT_TABLE
from enrollment import Kind, LinkedEntity, enroll
from schemas import Course, Enrollment, User
from enrollment import Course, Enrollment, Kind, LinkedEntity, User, enroll
logger = Logger(__name__)
dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
@@ -24,16 +23,16 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
metadata = dyn.collection.get_items(
TransactKey(new_image['id'])
+ SortKey(
'METADATA#SUBSCRIPTION_COVERED',
sk='METADATA#SUBSCRIPTION_COVERED',
rename_key='subscription',
)
+ SortKey(
'METADATA#DEDUPLICATION_WINDOW',
sk='METADATA#DEDUPLICATION_WINDOW',
path_spec='offset_days',
rename_key='dedup_window_offset_days',
)
+ SortKey(
'ORG',
sk='ORG',
rename_key='org',
),
flatten_top=False,