add access_expires_at to enrollment
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from typing import NotRequired, Self, TypedDict
|
||||
|
||||
from layercake.dateutils import now, ttl
|
||||
@@ -48,12 +49,14 @@ def enroll(
|
||||
user = enrollment.user
|
||||
course = enrollment.course
|
||||
lock_hash = md5_hash('%s%s' % (user.id, course.id))
|
||||
access_expires_at = now_ + timedelta(days=course.access_period)
|
||||
|
||||
with persistence_layer.transact_writer() as transact:
|
||||
transact.put(
|
||||
item={
|
||||
'sk': '0',
|
||||
'created_at': now_,
|
||||
'access_expires_at': access_expires_at,
|
||||
**enrollment.model_dump(),
|
||||
}
|
||||
| ({'subscription_covered': True} if subscription else {})
|
||||
|
||||
Reference in New Issue
Block a user