renamem orders

This commit is contained in:
2025-10-13 14:31:29 -03:00
parent 8c750e00d0
commit 466ff824dd
60 changed files with 165 additions and 59 deletions

View File

@@ -7,8 +7,21 @@ from layercake.strutils import md5_hash
from schemas import Enrollment
Org = TypedDict('Org', {'org_id': str, 'name': str})
DeduplicationWindow = TypedDict('DeduplicationWindow', {'offset_days': int})
Org = TypedDict(
'Org',
{
'org_id': str,
'name': str,
},
)
DeduplicationWindow = TypedDict(
'DeduplicationWindow',
{
'offset_days': int,
},
)
Subscription = TypedDict(
'Subscription',
{
@@ -44,7 +57,6 @@ def enroll(
deduplication_window: DeduplicationWindow | None = None,
persistence_layer: DynamoDBPersistenceLayer,
) -> bool:
"""Enrolls a user into a course and schedules lifecycle events."""
now_ = now()
user = enrollment.user
course = enrollment.course
@@ -60,9 +72,7 @@ def enroll(
**enrollment.model_dump(),
}
| ({'subscription_covered': True} if subscription else {})
| ({'tenant_id': org['org_id']} if org else {}),
# Post-migration: uncomment the following line
# | ({'org_id': org['org_id']} if org else {}),
| ({'org_id': org['org_id']} if org else {}),
)
# Relationships between this enrollment and its related entities
@@ -97,9 +107,7 @@ def enroll(
transact.put(
item={
'id': enrollment.id,
# Post-migration: uncomment the following line
# 'sk': 'ORG',
'sk': 'tenant',
'sk': 'ORG',
'created_at': now_,
}
| org