Files
saladeaula.digital/api.saladeaula.digital/app/routes/orders/__init__.py

20 lines
531 B
Python

from aws_lambda_powertools.event_handler.api_gateway import Router
from aws_lambda_powertools.event_handler.exceptions import (
NotFoundError,
)
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
from boto3clients import dynamodb_client
from config import ORDER_TABLE
router = Router()
dyn = DynamoDBPersistenceLayer(ORDER_TABLE, dynamodb_client)
@router.get('/<order_id>')
def get_order(order_id: str):
return dyn.collection.get_item(
KeyPair(order_id, '0'),
exc_cls=NotFoundError,
)