add billing

This commit is contained in:
2025-12-12 12:16:21 -03:00
parent 3895e953af
commit 319016a361

View File

@@ -0,0 +1,27 @@
from datetime import date
from typing import Annotated
from aws_lambda_powertools.event_handler.api_gateway import Router
from aws_lambda_powertools.event_handler.openapi.params import Query
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
from boto3clients import dynamodb_client
from config import COURSE_TABLE
router = Router()
dyn = DynamoDBPersistenceLayer(COURSE_TABLE, dynamodb_client)
@router.get('/<org_id>/billing')
def get_custom_pricing(
org_id: str,
start_date: Annotated[date, Query()],
end_date: Annotated[date, Query()],
):
return dyn.collection.query(
KeyPair(
pk=f'BILLING#ORG#{org_id}',
sk=f'START#{start_date}#END#{end_date}',
),
limit=150,
)