add report submission
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user