from aws_lambda_powertools.event_handler.api_gateway import Router
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey

from boto3clients import dynamodb_client
from config import COURSE_TABLE

router = Router()
dyn = DynamoDBPersistenceLayer(COURSE_TABLE, dynamodb_client)


@router.get('/<org_id>/custom-pricing')
def get_custom_pricing(org_id: str):
    return dyn.collection.query(
        PartitionKey(f'CUSTOM_PRICING#ORG#{org_id}'),
        limit=100,
    )
