add notification

This commit is contained in:
2025-11-27 20:41:29 -03:00
parent ab7e4ea38b
commit 2467798855
19 changed files with 560 additions and 80 deletions

View File

@@ -8,7 +8,7 @@ from aws_lambda_powertools.event_handler.exceptions import (
ServiceError,
)
from aws_lambda_powertools.event_handler.openapi.params import Body
from layercake.dateutils import now
from layercake.dateutils import now, ttl
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, SortKey
from layercake.extra_types import CnpjStr, CpfStr, NameStr
from pydantic import BaseModel, EmailStr, Field
@@ -126,9 +126,26 @@ def _create_user(user: User, org: Org) -> bool:
'sk': f'emails#{user.email}',
'email_verified': email_verified,
'email_primary': True,
'mx_record_exists': email_verified,
'created_at': now_,
}
)
if not email_verified:
transact.put(
item={
'id': user_id,
'sk': f'EMAIL_VERIFICATION#{uuid4()}',
'fresh_user': True,
'name': user.name,
'email': user.email,
'email_primary': True,
'org_name': org.name,
'ttl': ttl(start_dt=now_, days=30),
'created_at': now_,
}
)
transact.put(
item={
# Post-migration: rename `cpf` to `CPF`