add send cert reporting
This commit is contained in:
@@ -16,8 +16,8 @@ from config import (
|
||||
BUCKET_NAME,
|
||||
COURSE_TABLE,
|
||||
ENROLLMENT_TABLE,
|
||||
ESIGN_URI,
|
||||
PAPERFORGE_API,
|
||||
SIGNATURE_URI,
|
||||
)
|
||||
|
||||
logger = Logger(__name__)
|
||||
@@ -38,12 +38,12 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
sk=SortKey('0', path_spec='cert', rename_key='cert'),
|
||||
),
|
||||
raise_on_error=False,
|
||||
default=False,
|
||||
default=None,
|
||||
)
|
||||
|
||||
if not cert:
|
||||
logger.debug('Certificate not found')
|
||||
# There is no certificate to issue from metadata
|
||||
# There is no certificate to issue from course
|
||||
return False
|
||||
|
||||
started_at: datetime = fromisoformat(new_image['started_at']) # type: ignore
|
||||
@@ -62,7 +62,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
data=json.dumps(
|
||||
{
|
||||
'template_uri': cert['s3_uri'],
|
||||
'sign_uri': SIGNATURE_URI,
|
||||
'sign_uri': ESIGN_URI,
|
||||
'args': {
|
||||
'name': new_image['user']['name'],
|
||||
'cpf': _cpffmt(new_image['user']['cpf']),
|
||||
@@ -106,10 +106,10 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
pk=enrollment_id,
|
||||
sk='0',
|
||||
),
|
||||
update_expr='SET issued_cert = :issued_cert, updated_at = :now',
|
||||
update_expr='SET cert = :cert, updated_at = :now',
|
||||
expr_attr_values={
|
||||
':now': now_,
|
||||
':issued_cert': {
|
||||
':cert': {
|
||||
'issued_at': now_,
|
||||
}
|
||||
| ({'expires_at': cert_expires_at} if cert_expires_at else {})
|
||||
|
||||
Reference in New Issue
Block a user