update meilis

This commit is contained in:
2025-07-05 15:08:06 -03:00
parent 0df4d7aa71
commit d002828afa
17 changed files with 430 additions and 45 deletions

View File

@@ -32,7 +32,7 @@ def lambda_handler(event: SESEvent, context: LambdaContext) -> dict:
print(
{
'id': f'mailbox#{org_id}',
'id': f'mailbox#org#{org_id}',
'sk': ses.mail.message_id,
}
)

View File

@@ -0,0 +1,4 @@
"""
Stopgap events. Everything here is a quick fix and should be replaced with
proper solutions.
"""

View File

@@ -0,0 +1,30 @@
from aws_lambda_powertools.utilities.data_classes import (
EventBridgeEvent,
event_source,
)
from aws_lambda_powertools.utilities.typing import LambdaContext
from layercake.dateutils import now
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
from boto3clients import dynamodb_client
from config import USER_TABLE
user_layer = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
@event_source(data_class=EventBridgeEvent)
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
new_image = event.detail['new_image']
now_ = now()
_, tenant = new_image['id'].split('#')
user_layer.update_item(
key=KeyPair(new_image['sk'], '0'),
update_expr='ADD tenant :tenant SET updated_at = :updated_at',
expr_attr_values={
':tenant': {tenant},
':updated_at': now_,
},
)
return True