from typing import Annotated from aws_lambda_powertools.event_handler.api_gateway import Router from aws_lambda_powertools.event_handler.exceptions import ( NotFoundError, ) from aws_lambda_powertools.event_handler.openapi.params import Body from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair from layercake.extra_types import CpfStr, NameStr from boto3clients import dynamodb_client from config import USER_TABLE from .emails import router as emails from .orgs import router as orgs from .password import router as password __all__ = ['emails', 'orgs', 'password'] router = Router() dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client) @router.get('/') def get_user(user_id: str): return dyn.collection.get_item( KeyPair(user_id, '0'), exc_cls=NotFoundError, ) @router.patch('/') def update( user_id: str, name: Annotated[NameStr, Body(embed=True)], cpf: Annotated[CpfStr, Body(embed=True)], ): ...