finish seat

This commit is contained in:
2026-01-25 04:52:44 -03:00
parent 5fac7888a8
commit 3719842ae9
31 changed files with 731 additions and 134 deletions

View File

@@ -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={