add purge to canceled and failed enrollment

This commit is contained in:
2026-01-22 12:17:54 -03:00
parent a01e4329f0
commit 5fac7888a8
11 changed files with 129 additions and 108 deletions

View File

@@ -61,6 +61,8 @@ Org = TypedDict('Org', {'org_id': str, 'name': str})
CreatedBy = TypedDict('CreatedBy', {'id': str, 'name': str})
Seat = TypedDict('Seat', {'id': str, 'sk': str})
DeduplicationWindow = TypedDict('DeduplicationWindow', {'offset_days': int})
Subscription = TypedDict(
@@ -100,6 +102,11 @@ class SubscriptionFrozenError(Exception):
super().__init__('Subscription is frozen')
class SeatNotFoundError(Exception):
def __init__(self, msg: str | dict):
super().__init__('Seat required')
def enroll(
enrollment: Enrollment,
*,
@@ -108,6 +115,7 @@ def enroll(
subscription: Subscription | None = None,
created_by: CreatedBy | None = None,
scheduled_at: datetime | None = None,
seat: Seat | None = None,
linked_entities: frozenset[LinkedEntity] = frozenset(),
deduplication_window: DeduplicationWindow | None = None,
persistence_layer: DynamoDBPersistenceLayer,
@@ -138,6 +146,8 @@ def enroll(
'sk': 'CANCEL_POLICY',
'created_at': now_,
}
#
| ({'seat': seat} if seat else {})
)
# Relationships between this enrollment and its related entities