add enroll to subscribed
This commit is contained in:
@@ -40,8 +40,8 @@ class DeduplicationConflictError(ConflictError): ...
|
||||
class User(BaseModel):
|
||||
id: str | UUID4
|
||||
name: NameStr
|
||||
cpf: CpfStr
|
||||
email: EmailStr
|
||||
cpf: CpfStr
|
||||
|
||||
|
||||
class Course(BaseModel):
|
||||
@@ -123,9 +123,9 @@ def enroll(
|
||||
Context = TypedDict(
|
||||
'Context',
|
||||
{
|
||||
'created_by': Authenticated,
|
||||
'org': Org,
|
||||
'terms': SubscriptionTerms,
|
||||
'created_by': Authenticated,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -251,14 +251,12 @@ def enroll_later(enrollment: Enrollment, context: Context):
|
||||
'sk': f'{scheduled_for.isoformat()}#{lock_hash}',
|
||||
'user': user.model_dump(),
|
||||
'course': course.model_dump(),
|
||||
'org': org.model_dump(),
|
||||
'org_name': org.name,
|
||||
'created_by': {
|
||||
'id': created_by.id,
|
||||
'name': created_by.name,
|
||||
},
|
||||
'subscription_covered': {
|
||||
'billing_day': subscription_terms.billing_day,
|
||||
},
|
||||
'subscription_billing_day': subscription_terms.billing_day,
|
||||
'ttl': ttl(start_dt=scheduled_for),
|
||||
'created_at': now_,
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||
@router.get('/<org_id>/enrollments/scheduled')
|
||||
def scheduled(org_id: str, start_key: Annotated[str | None, Query] = None):
|
||||
return dyn.collection.query(
|
||||
# Post-migration: rename `scheduled_items` to `SCHEDULED#ORG#{org_id}`
|
||||
key=PartitionKey(f'scheduled_items#{org_id}'),
|
||||
key=PartitionKey(f'SCHEDULED#ORG#{org_id}'),
|
||||
start_key=start_key,
|
||||
limit=150,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user