finish seat
This commit is contained in:
@@ -5,7 +5,7 @@ from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
|
||||
from boto3clients import dynamodb_client
|
||||
from config import ENROLLMENT_TABLE
|
||||
from exceptions import CancelPolicyConflictError
|
||||
from exceptions import CancelPolicyConflictError, EnrollmentConflictError
|
||||
from middlewares.authentication_middleware import User as Authenticated
|
||||
|
||||
logger = Logger(__name__)
|
||||
@@ -21,7 +21,7 @@ def cancel(enrollment_id: str):
|
||||
with dyn.transact_writer() as transact:
|
||||
transact.update(
|
||||
key=KeyPair(enrollment_id, '0'),
|
||||
cond_expr='#status = :pending',
|
||||
cond_expr='attribute_exists(sk) AND #status = :pending',
|
||||
update_expr='SET #status = :canceled, \
|
||||
canceled_at = :now, \
|
||||
updated_at = :now',
|
||||
@@ -33,6 +33,7 @@ def cancel(enrollment_id: str):
|
||||
':canceled': 'CANCELED',
|
||||
':now': now_,
|
||||
},
|
||||
exc_cls=EnrollmentConflictError,
|
||||
)
|
||||
transact.put(
|
||||
item={
|
||||
|
||||
Reference in New Issue
Block a user