wip subscription org
This commit is contained in:
@@ -16,7 +16,7 @@ DeduplicationWindow = TypedDict('DeduplicationWindow', {'offset_days': int})
|
||||
|
||||
class LinkedEntity(str):
|
||||
def __new__(cls, id: str, type: str) -> Self:
|
||||
return super().__new__(cls, '#'.join([type.upper(), id]))
|
||||
return super().__new__(cls, '#'.join([type.lower(), id]))
|
||||
|
||||
def __init__(self, id: str, type: str) -> None:
|
||||
# __init__ is used to store the parameters for later reference.
|
||||
@@ -33,7 +33,7 @@ class Slot:
|
||||
@property
|
||||
def order_id(self) -> LinkedEntity:
|
||||
idx, _ = self.sk.split('#')
|
||||
return LinkedEntity(idx, 'order')
|
||||
return LinkedEntity(idx, 'ORDER')
|
||||
|
||||
|
||||
class LifecycleEvents(str, Enum):
|
||||
@@ -142,13 +142,15 @@ def enroll(
|
||||
)
|
||||
|
||||
for entity in linked_entities:
|
||||
type = entity.type.lower()
|
||||
keyprefix = entity.type.lower()
|
||||
transact.put(
|
||||
item={
|
||||
'id': enrollment.id,
|
||||
'sk': f'linked_entities#{type}',
|
||||
# Post-migration: uncomment the following line
|
||||
# 'sk': f'LINKED_ENTITIES#{entity.type}',
|
||||
'sk': f'linked_entities#{entity.type}',
|
||||
'created_at': now_,
|
||||
f'{type}_id': entity.id,
|
||||
f'{keyprefix}_id': entity.id,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -157,7 +159,7 @@ def enroll(
|
||||
item={
|
||||
'id': enrollment.id,
|
||||
# Post-migration: uncomment the following line
|
||||
# 'sk': 'metadata#parent_slot',
|
||||
# 'sk': 'METADATA#SOURCE_SLOT',
|
||||
'sk': 'parent_vacancy',
|
||||
'vacancy': asdict(slot),
|
||||
'created_at': now_,
|
||||
|
||||
Reference in New Issue
Block a user