add events
This commit is contained in:
@@ -65,6 +65,16 @@ class LifecycleEvents(str, Enum):
|
||||
EXPIRATION = 'schedules#expiration'
|
||||
|
||||
|
||||
class SlotDoesNotExistError(Exception):
|
||||
def __init__(self, *args):
|
||||
super().__init__('Slot does not exist')
|
||||
|
||||
|
||||
class DeduplicationConflictError(Exception):
|
||||
def __init__(self, *args):
|
||||
super().__init__('Enrollment already exists')
|
||||
|
||||
|
||||
def enroll(
|
||||
enrollment: Enrollment,
|
||||
*,
|
||||
@@ -151,7 +161,7 @@ def enroll(
|
||||
transact.put(
|
||||
item={
|
||||
'id': enrollment.id,
|
||||
'sk': f'linked_entities#{type}',
|
||||
'sk': f'LINKED_ENTITIES#{type}',
|
||||
'created_at': now_,
|
||||
f'{type}_id': entity.id,
|
||||
}
|
||||
@@ -169,10 +179,6 @@ def enroll(
|
||||
}
|
||||
)
|
||||
|
||||
class SlotDoesNotExistError(Exception):
|
||||
def __init__(self, *args):
|
||||
super().__init__('Slot does not exist')
|
||||
|
||||
transact.delete(
|
||||
key=KeyPair(slot.id, slot.sk),
|
||||
cond_expr='attribute_exists(sk)',
|
||||
@@ -197,10 +203,6 @@ def enroll(
|
||||
},
|
||||
)
|
||||
|
||||
class DeduplicationConflictError(Exception):
|
||||
def __init__(self, *args):
|
||||
super().__init__('Enrollment already exists')
|
||||
|
||||
# Prevents the user from enrolling in the same course again until
|
||||
# the deduplication window expires or is removed.
|
||||
if deduplication_window:
|
||||
|
||||
Reference in New Issue
Block a user