remove METADATA#COURSE

This commit is contained in:
2025-10-07 16:56:00 -03:00
parent 161b75db8d
commit 4fdf98a5b4
10 changed files with 40 additions and 31 deletions

View File

@@ -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,