renamem orders
This commit is contained in:
@@ -34,7 +34,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
order = order_layer.collection.get_items(
|
||||
TransactKey(order_id) + SortKey('0') + SortKey('items', path_spec='items'),
|
||||
)
|
||||
# Post-migration: rename `tenant_id` to `org_id`
|
||||
# Post-migration (orders): rename `tenant_id` to `org_id`
|
||||
org_id = order['tenant_id']
|
||||
items = {
|
||||
item['id']: int(item['quantity'])
|
||||
@@ -54,7 +54,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
item={
|
||||
'id': f'vacancies#{org_id}',
|
||||
'sk': f'{order_id}#{uuid4()}',
|
||||
# Post-migration: uncomment the follow lines
|
||||
# Post-migration (orders): uncomment the follow lines
|
||||
# 'id': f'SLOT#ORG#{org_id}',
|
||||
# 'sk': f'ORDER#{order_id}#ENROLLMENT#{uuid4()}',
|
||||
'course': asdict(slot),
|
||||
@@ -81,8 +81,6 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
class Course:
|
||||
id: str
|
||||
name: str
|
||||
# Post-migration: remove the following line
|
||||
time_in_days: int
|
||||
|
||||
|
||||
def _get_courses(ids: set) -> tuple[Course, ...]:
|
||||
@@ -95,8 +93,6 @@ def _get_courses(ids: set) -> tuple[Course, ...]:
|
||||
Course(
|
||||
id=idx,
|
||||
name=obj['name'],
|
||||
# Post-migration: remove the following line
|
||||
time_in_days=int(obj['access_period']),
|
||||
)
|
||||
for idx, obj in result.items()
|
||||
)
|
||||
|
||||
@@ -81,6 +81,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
emailmsg = Message(
|
||||
from_=EMAIL_SENDER,
|
||||
to=_get_admin_emails(org_id),
|
||||
reply_to=REPLY_TO,
|
||||
bcc=BCC,
|
||||
subject=SUBJECT.format(month=month),
|
||||
)
|
||||
emailmsg.add_alternative(MESSAGE.format(month=month))
|
||||
|
||||
@@ -29,11 +29,10 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
path_spec='offset_days',
|
||||
rename_key='dedup_window_offset_days',
|
||||
)
|
||||
+ SortKey('konviva')
|
||||
+ SortKey('tenant', rename_key='org'),
|
||||
+ SortKey('ORG', rename_key='org')
|
||||
+ SortKey('konviva'),
|
||||
# Post-migration: uncomment the following lines
|
||||
# + SortKey('KONVIVA', rename_key='konviva')
|
||||
# + SortKey('ORG', rename_key='org'),
|
||||
flatten_top=False,
|
||||
)
|
||||
user = User.model_validate(new_image['user'])
|
||||
|
||||
@@ -45,6 +45,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
':completed': 'COMPLETED',
|
||||
':now': now_,
|
||||
},
|
||||
exc_cls=StatusConflictError,
|
||||
)
|
||||
transact.put(
|
||||
item={
|
||||
@@ -68,3 +69,6 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
class StatusConflictError(Exception): ...
|
||||
|
||||
@@ -24,7 +24,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
new_image = event.detail['new_image']
|
||||
now_ = now()
|
||||
terms = user_layer.get_item(
|
||||
# Post-migration: uncomment the following line
|
||||
# Post-migration (users): uncomment the following line
|
||||
# KeyPair(new_image['org_id'], 'METADATA#BILLING_TERMS'),
|
||||
KeyPair(new_image['tenant_id'], 'metadata#billing_policy'),
|
||||
)
|
||||
@@ -48,7 +48,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
item={
|
||||
'id': new_image['id'],
|
||||
'sk': 'METADATA#SUBSCRIPTION_COVERED',
|
||||
'org_id': new_image['tenant_id'],
|
||||
'org_id': new_image['org_id'],
|
||||
'billing_day': terms['billing_day'],
|
||||
'created_at': now_,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user