28 lines
752 B
Python
28 lines
752 B
Python
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,
|
|
)
|