fix billing

This commit is contained in:
2025-08-27 22:17:33 -03:00
parent b3a4b48fe5
commit 83c97f409b
12 changed files with 129 additions and 45 deletions

View File

@@ -39,7 +39,7 @@ def get_enrollments():
tenant: Tenant = router.context['tenant']
event = router.current_event
query = parse.unquote(event.get_query_string_value('q', ''))
sort = event.get_query_string_value('sort', 'create_date:desc')
sort = event.get_query_string_value('sort', 'created_at:desc')
page = int(event.get_query_string_value('page', '1'))
hits_per_page = int(event.get_query_string_value('hitsPerPage', '25'))
filter_ = meili.parse(event.get_query_string_value('filter', ''))
@@ -70,15 +70,14 @@ def get_enrollment(id: str):
return enrollment_layer.collection.get_items(
TransactKey(id)
+ SortKey('0')
+ SortKey('started_date')
+ SortKey('finished_date')
+ SortKey('failed_date')
+ SortKey('canceled_date')
+ SortKey('archived_date')
+ SortKey('cancel_policy')
+ SortKey('STARTED', rename_key='started_at', path_spec='started_at')
+ SortKey('COMPLETED', rename_key='completed_at', path_spec='completed_at')
+ SortKey('FAILED', rename_key='failed_at', path_spec='failed_at')
+ SortKey('CANCELED', rename_key='canceled')
+ SortKey('ARCHIVED', rename_key='archived_at', path_spec='archived_at')
+ SortKey('CANCEL_POLICY', rename_key='cancel_policy')
+ SortKey('LOCK', rename_key='lock')
+ SortKey('parent_vacancy', path_spec='vacancy')
+ SortKey('lock')
+ SortKey('author')
+ SortKey('tenant')
+ SortKey('cert')
)

View File

@@ -41,7 +41,7 @@ def cancel(id: str, payload: Cancel):
set_status_as_canceled(
id,
lock_hash=payload.lock_hash,
author={
created_by={
'id': user.id,
'name': user.name,
},

View File

@@ -17,7 +17,10 @@ def lookup(username: str):
r = meili_client.index(USER_TABLE).search(f'"{username}"')
if user := glom(r, 'hits.0', default=None):
return pick(('id', 'name', 'email', 'cognito__sub'), user)
cognito_sub = user.get('cognito:sub')
return {'cognito__sub': cognito_sub} | pick(
('id', 'name', 'email', 'cognito__sub'), user
)
return JSONResponse(
body={'message': 'User not found.'},