Implement Club Feature Quota Bypass and Update Versioning
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Failing after 2s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 42s
Test Suite / playwright-tests (push) Successful in 1m19s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Failing after 2s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 42s
Test Suite / playwright-tests (push) Successful in 1m19s
- Added support for club feature quota bypass based on portal roles and profile grants in the capabilities check. - Introduced new functions to handle quota bypass logic in club feature access and consumption. - Updated the FeatureUsageBadge component to reflect platform exemptions for features. - Incremented application version to 0.8.195 and database schema version to 20260606083 to reflect these changes. - Enhanced backend routers to include new logic for consuming club features during AI-related actions.
This commit is contained in:
1 parent
fa10450315
commit
8404a42b6c
16 files changed
+1063
-41
No files matched your search
@@ -39,7 +39,7 @@ from ai_prompt_context import ExerciseFormAiFocusRow, ExerciseFormAiPromptContex
|
||||
from ai_prompt_job import run_exercise_form_ai_suggestion
|
||||
from account_lifecycle import assert_min_account_state
|
||||
from capabilities import probe_capability
|
||||
from club_features import probe_club_feature_access, resolve_club_id_for_probe
|
||||
from club_features import consume_club_feature, probe_club_feature_access, resolve_club_id_for_probe
|
||||
|
||||
from exercise_rich_text import (
|
||||
RICH_HTML_EXERCISE_FIELDS,
|
||||
@@ -2321,18 +2321,20 @@ def exercise_ai_suggest_endpoint(
|
||||
OPENROUTER_API_KEY erforderlich.
|
||||
"""
|
||||
assert_min_account_state(tenant, "active_member", endpoint="POST /exercises/ai/suggest")
|
||||
club_id = resolve_club_id_for_probe(tenant)
|
||||
probe_capability(
|
||||
tenant,
|
||||
"exercises.ai.suggest",
|
||||
action="suggest",
|
||||
club_id=resolve_club_id_for_probe(tenant),
|
||||
club_id=club_id,
|
||||
endpoint="POST /exercises/ai/suggest",
|
||||
)
|
||||
probe_club_feature_access(
|
||||
feature_id="ai_calls",
|
||||
action="suggest",
|
||||
club_id=resolve_club_id_for_probe(tenant),
|
||||
club_id=club_id,
|
||||
profile_id=tenant.profile_id,
|
||||
portal_role=tenant.global_role,
|
||||
endpoint="POST /exercises/ai/suggest",
|
||||
)
|
||||
with get_db() as conn:
|
||||
@@ -2344,6 +2346,14 @@ def exercise_ai_suggest_endpoint(
|
||||
want_skills=body.include_skills,
|
||||
want_instructions=body.include_instructions,
|
||||
)
|
||||
consume_club_feature(
|
||||
feature_id="ai_calls",
|
||||
club_id=club_id,
|
||||
profile_id=tenant.profile_id,
|
||||
portal_role=tenant.global_role,
|
||||
action="suggest",
|
||||
conn=conn,
|
||||
)
|
||||
return payload
|
||||
|
||||
|
||||
@@ -2355,18 +2365,20 @@ def exercise_ai_regenerate_endpoint(
|
||||
):
|
||||
"""Neu-Anfrage KI fuer eine gespeicherte Uebung; schreibendes Ergebnis nur im Frontend (PUT)."""
|
||||
assert_min_account_state(tenant, "active_member", endpoint="POST /exercises/{id}/ai/regenerate")
|
||||
club_id = resolve_club_id_for_probe(tenant)
|
||||
probe_capability(
|
||||
tenant,
|
||||
"exercises.ai.regenerate",
|
||||
action="regenerate",
|
||||
club_id=resolve_club_id_for_probe(tenant),
|
||||
club_id=club_id,
|
||||
endpoint="POST /exercises/{id}/ai/regenerate",
|
||||
)
|
||||
probe_club_feature_access(
|
||||
feature_id="ai_calls",
|
||||
action="regenerate",
|
||||
club_id=resolve_club_id_for_probe(tenant),
|
||||
club_id=club_id,
|
||||
profile_id=tenant.profile_id,
|
||||
portal_role=tenant.global_role,
|
||||
endpoint="POST /exercises/{id}/ai/regenerate",
|
||||
)
|
||||
want_summary = "summary" in body.regenerate
|
||||
@@ -2400,6 +2412,14 @@ def exercise_ai_regenerate_endpoint(
|
||||
want_skills=want_skills,
|
||||
want_instructions=want_instructions,
|
||||
)
|
||||
consume_club_feature(
|
||||
feature_id="ai_calls",
|
||||
club_id=club_id,
|
||||
profile_id=tenant.profile_id,
|
||||
portal_role=tenant.global_role,
|
||||
action="regenerate",
|
||||
conn=conn,
|
||||
)
|
||||
return payload
|
||||
|
||||
|
||||
@@ -2467,6 +2487,7 @@ def create_exercise(
|
||||
action="create",
|
||||
club_id=int(club_id),
|
||||
profile_id=profile_id,
|
||||
portal_role=tenant.global_role,
|
||||
endpoint="POST /exercises",
|
||||
)
|
||||
|
||||
@@ -3285,6 +3306,7 @@ async def upload_exercise_media(
|
||||
action="upload",
|
||||
club_id=int(media_club_id),
|
||||
profile_id=profile_id,
|
||||
portal_role=tenant.global_role,
|
||||
endpoint="POST /exercises/{id}/media",
|
||||
conn=conn,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user