fix enroll and reenroll relationship

This commit is contained in:
2025-10-14 18:11:24 -03:00
parent 466ff824dd
commit a7e5a0a528
20 changed files with 125 additions and 89 deletions

View File

@@ -18,7 +18,11 @@ from layercake.dynamodb import (
from boto3clients import dynamodb_client
from config import COURSE_TABLE, ENROLLMENT_TABLE, ORDER_TABLE
from enrollment import LinkedEntity, enroll
from enrollment import (
Kind,
LinkedEntity,
enroll,
)
from schemas import Course, Enrollment, User
logger = Logger(__name__)
@@ -89,7 +93,15 @@ def _handler(record: Course, context: dict) -> Enrollment:
enrollment,
persistence_layer=enrollment_layer,
deduplication_window={'offset_days': 90},
linked_entities=frozenset({LinkedEntity(context['order_id'], 'ORDER')}),
linked_entities=frozenset(
{
LinkedEntity(
id=context['order_id'],
kind=Kind.ORDER,
table_name=ORDER_TABLE,
),
}
),
)
return enrollment