add billing

This commit is contained in:
2025-12-12 20:28:47 -03:00
parent 3147ec2317
commit c516960b01
16 changed files with 496 additions and 97 deletions

View File

@@ -6,14 +6,27 @@ 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
from config import ORDER_TABLE, USER_TABLE
router = Router()
dyn = DynamoDBPersistenceLayer(COURSE_TABLE, dynamodb_client)
dyn = DynamoDBPersistenceLayer(ORDER_TABLE, dynamodb_client)
@router.get('/<org_id>/subscription')
def subscription(org_id: str):
return dyn.collection.get_item(
KeyPair(
pk=org_id,
sk='METADATA#SUBSCRIPTION',
table_name=USER_TABLE,
),
raise_on_error=False,
default={},
)
@router.get('/<org_id>/billing')
def get_custom_pricing(
def billing(
org_id: str,
start_date: Annotated[date, Query()],
end_date: Annotated[date, Query()],