remove METADATA#COURSE
This commit is contained in:
@@ -12,7 +12,13 @@ from layercake.dateutils import fromisoformat, now
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, SortKey
|
||||
|
||||
from boto3clients import dynamodb_client, s3_client
|
||||
from config import BUCKET_NAME, ENROLLMENT_TABLE, PAPERFORGE_API, SIGNATURE_URI
|
||||
from config import (
|
||||
BUCKET_NAME,
|
||||
COURSE_TABLE,
|
||||
ENROLLMENT_TABLE,
|
||||
PAPERFORGE_API,
|
||||
SIGNATURE_URI,
|
||||
)
|
||||
|
||||
logger = Logger(__name__)
|
||||
dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||
@@ -24,10 +30,12 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
new_image = event.detail['new_image']
|
||||
now_ = now()
|
||||
enrollment_id = new_image['id']
|
||||
course_id = new_image['course']['id']
|
||||
cert = dyn.collection.get_item(
|
||||
KeyPair(
|
||||
pk=new_image['id'],
|
||||
sk=SortKey('METADATA#COURSE', path_spec='cert', rename_key='cert'),
|
||||
pk=course_id,
|
||||
sk=SortKey('0', path_spec='cert', rename_key='cert'),
|
||||
table_name=COURSE_TABLE,
|
||||
),
|
||||
raise_on_error=False,
|
||||
default=False,
|
||||
|
||||
Reference in New Issue
Block a user