add report submission

This commit is contained in:
2025-12-11 20:46:34 -03:00
parent 3fb8488074
commit 1e1a0ae24c
10 changed files with 281 additions and 54 deletions

View File

@@ -18,17 +18,10 @@ router = Router()
dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
class CancelPolicyConflictError(BadRequestError):
def __init__(self, *_):
super().__init__('Cancellation policy not found')
class CancelPolicyConflictError(BadRequestError): ...
class SlotConflictError(BadRequestError):
def __init__(self, *_):
super().__init__('Slot not found')
@router.post('/<enrollment_id>/cancel')
@router.patch('/<enrollment_id>/cancel')
def cancel(
enrollment_id: str,
lock_hash: Annotated[str | None, Body(embed=True)] = None,
@@ -44,12 +37,11 @@ def cancel(
canceled_at = :now, \
updated_at = :now',
expr_attr_names={
':status': 'status',
'#status': 'status',
},
expr_attr_values={
':pending': 'PENDING',
':canceled': 'CANCELED',
':true': True,
':now': now_,
},
)
@@ -89,9 +81,7 @@ def cancel(
key=KeyPair(
pk=enrollment_id,
sk='METADATA#PARENT_SLOT',
),
cond_expr='attribute_exists(sk)',
exc_cls=SlotConflictError,
)
)
if lock_hash: