add user id to order
This commit is contained in:
@@ -17,23 +17,18 @@ enrollment_layer = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||
order_layer = DynamoDBPersistenceLayer(ORDER_TABLE, dynamodb_client)
|
||||
|
||||
|
||||
class TenantDoesNotExistError(Exception):
|
||||
def __init__(self, *args):
|
||||
super().__init__('Tenant does not exist')
|
||||
|
||||
|
||||
@event_source(data_class=EventBridgeEvent)
|
||||
@logger.inject_lambda_context
|
||||
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
new_image = event.detail['new_image']
|
||||
order_id = new_image['id']
|
||||
tenant_id = new_image['tenant']
|
||||
org_id = new_image['tenant_id']
|
||||
|
||||
result = enrollment_layer.collection.query(
|
||||
KeyPair(
|
||||
# Post-migration: Uncomment the following line
|
||||
# f'slots#org#{tenant_id}',
|
||||
f'vacancies#{tenant_id}',
|
||||
# f'SLOT#ORG#{org_id}',
|
||||
f'vacancies#{org_id}',
|
||||
order_id,
|
||||
)
|
||||
)
|
||||
@@ -45,8 +40,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
batch.delete_item(
|
||||
Key={
|
||||
# Post-migration: Uncomment the following line
|
||||
# 'id': {'S': f'slots#org#{tenant_id}'},
|
||||
'id': {'S': f'vacancies#{tenant_id}'},
|
||||
# 'id': {'S': f'SLOT#ORG#{org_id}'},
|
||||
'id': {'S': f'vacancies#{org_id}'},
|
||||
'sk': {'S': pair['sk']},
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user