add admins
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from .admins import router as admins
|
||||
from .custom_pricing import router as custom_pricing
|
||||
from .enrollments.scheduled import router as scheduled
|
||||
|
||||
__all__ = ['admins', 'custom_pricing']
|
||||
__all__ = ['admins', 'custom_pricing', 'scheduled']
|
||||
|
||||
@@ -2,7 +2,7 @@ from aws_lambda_powertools.event_handler.api_gateway import Router
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
|
||||
from boto3clients import dynamodb_client
|
||||
from config import COURSE_TABLE, USER_TABLE
|
||||
from config import USER_TABLE
|
||||
|
||||
router = Router()
|
||||
dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
|
||||
@@ -11,7 +11,7 @@ dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
|
||||
@router.get('/<org_id>/admins')
|
||||
def get_admins(org_id: str):
|
||||
return dyn.collection.query(
|
||||
# Post-migration: rename `admins` to `ADMIN`
|
||||
KeyPair(org_id, 'admins#'),
|
||||
table_name=COURSE_TABLE,
|
||||
limit=100,
|
||||
)
|
||||
|
||||
@@ -2,16 +2,15 @@ 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, USER_TABLE
|
||||
from config import COURSE_TABLE
|
||||
|
||||
router = Router()
|
||||
dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
|
||||
dyn = DynamoDBPersistenceLayer(COURSE_TABLE, dynamodb_client)
|
||||
|
||||
|
||||
@router.get('/<org_id>/custompricing')
|
||||
@router.get('/<org_id>/custom-pricing')
|
||||
def get_custom_pricing(org_id: str):
|
||||
return dyn.collection.query(
|
||||
PartitionKey(f'CUSTOM_PRICING#ORG#{org_id}'),
|
||||
table_name=COURSE_TABLE,
|
||||
limit=100,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
from aws_lambda_powertools import Logger
|
||||
from aws_lambda_powertools.event_handler.api_gateway import Router
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
||||
|
||||
from boto3clients import dynamodb_client
|
||||
from config import ENROLLMENT_TABLE
|
||||
|
||||
logger = Logger(__name__)
|
||||
router = Router()
|
||||
dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||
|
||||
|
||||
@router.get('/<org_id>/enrollments/scheduled')
|
||||
def scheduled(org_id: str):
|
||||
start_key = router.current_event.get_query_string_value('start_key', None)
|
||||
|
||||
return dyn.collection.query(
|
||||
# Post-migration: rename `scheduled_items` to `SCHEDULED#ORG#{org_id}`
|
||||
key=PartitionKey(f'scheduled_items#{org_id}'),
|
||||
start_key=start_key,
|
||||
limit=150,
|
||||
)
|
||||
Reference in New Issue
Block a user