finish seat
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Annotated
|
||||
from typing import Annotated, cast
|
||||
|
||||
from aws_lambda_powertools import Logger
|
||||
from aws_lambda_powertools.event_handler.api_gateway import Router
|
||||
@@ -11,8 +11,9 @@ from pydantic import FutureDatetime
|
||||
from api_gateway import JSONResponse
|
||||
from boto3clients import dynamodb_client
|
||||
from config import ENROLLMENT_TABLE
|
||||
from middlewares.authentication_middleware import User as Authenticated
|
||||
|
||||
from ...enrollments.enroll import Enrollment, Org, Subscription, enroll_now
|
||||
from ...enrollments.enroll import Context, Enrollment, Org, Subscription, enroll_now
|
||||
|
||||
logger = Logger(__name__)
|
||||
router = Router()
|
||||
@@ -72,12 +73,18 @@ def proceed(
|
||||
KeyPair(pk, sk),
|
||||
exc_cls=ScheduledNotFoundError,
|
||||
)
|
||||
org = Org(
|
||||
id=org_id,
|
||||
name=scheduled['org_name'],
|
||||
)
|
||||
subscription = Subscription(
|
||||
billing_day=scheduled['subscription_billing_day'],
|
||||
billing_day = scheduled.get('subscription_billing_day')
|
||||
ctx = cast(
|
||||
Context,
|
||||
{
|
||||
'created_by': router.context['user'],
|
||||
'org': Org(id=org_id, name=scheduled['org_name']),
|
||||
**(
|
||||
{'subscription': Subscription(billing_day=billing_day)}
|
||||
if billing_day
|
||||
else {}
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -86,11 +93,7 @@ def proceed(
|
||||
user=scheduled['user'],
|
||||
course=scheduled['course'],
|
||||
),
|
||||
{
|
||||
'org': org,
|
||||
'subscription': subscription,
|
||||
'created_by': router.context['user'],
|
||||
},
|
||||
ctx,
|
||||
)
|
||||
|
||||
with dyn.transact_writer() as transact:
|
||||
|
||||
Reference in New Issue
Block a user