get user id from order
This commit is contained in:
@@ -54,8 +54,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
'id': f'vacancies#{tenant_id}',
|
||||
'sk': f'{order_id}#{uuid4()}',
|
||||
# Post-migration: uncomment the follow lines
|
||||
# 'id': f'slots#org#{tenant_id}',
|
||||
# 'sk': f'order#{order_id}#enrollment#{uuid4()}',
|
||||
# 'id': f'SLOT#ORG#{tenant_id}',
|
||||
# 'sk': f'ORDER#{order_id}#ENROLLMENT#{uuid4()}',
|
||||
'course': asdict(slot),
|
||||
'created_at': now_,
|
||||
},
|
||||
@@ -80,6 +80,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
class Course:
|
||||
id: str
|
||||
name: str
|
||||
# Post-migration: remove the following line
|
||||
time_in_days: int
|
||||
|
||||
|
||||
@@ -93,6 +94,7 @@ 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()
|
||||
|
||||
@@ -6,7 +6,6 @@ from aws_lambda_powertools.utilities.data_classes import (
|
||||
event_source,
|
||||
)
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from glom import glom
|
||||
from layercake.dateutils import now
|
||||
from layercake.dynamodb import (
|
||||
DynamoDBPersistenceLayer,
|
||||
@@ -44,12 +43,9 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> list[str]
|
||||
if item['unit_price'] > 0
|
||||
}
|
||||
|
||||
result = order_layer.collection.query(KeyPair(order_id, 'assignees#'))
|
||||
user_id = glom(result, 'items.0.sk').removeprefix('assignees#')
|
||||
|
||||
courses = _get_courses(set(items.keys()))
|
||||
user = User(
|
||||
id=user_id,
|
||||
id=order['user_id'],
|
||||
name=order['name'],
|
||||
email=order['email'],
|
||||
cpf=order['cpf'],
|
||||
|
||||
Reference in New Issue
Block a user