632e66e21d
- Add configurable profile questions with conditional visibility, admin-only fields, user answers, and seeded onboarding/volunteer questions
- Add admin UI for managing profile questions and member profile answers
- Add volunteer level/profile data support across backend schemas, models, API, and migration
- Update dashboard/profile UI, super admin menu, membership service types, and related styling
- Add privacy policy, terms of service, cookie notice, and footer links
- Add frontend Vitest coverage for profile question logic
- Add backend pytest coverage for profile answer normalization and validation
- Update restart.sh to build, run frontend/backend unit tests, and restart only after tests pass
- Refresh README, quickstart, project structure, instructions, and Square docs to match current app features
- Protect feature flag reload behind super-admin access
- Restrict admin-triggered password resets so admins can only reset member accounts
- Replace email template HTML preview rendering with escaped text preview
- Update docs for feature flag reload access, password reset scope, and email template preview safety
-- test user questions are also made by AI and not very useful. but i didn't know what to put there so its good enough for a test
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
from fastapi import APIRouter, Depends
|
|
from app.services.feature_flag_service import feature_flags
|
|
from app.schemas.feature_flags import FeatureFlagsResponse, FeatureFlagResponse
|
|
from app.api.dependencies import get_super_admin_user
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/flags", response_model=FeatureFlagsResponse)
|
|
async def get_all_feature_flags() -> FeatureFlagsResponse:
|
|
"""
|
|
Get all feature flags for the frontend
|
|
This endpoint is public as it only returns feature configuration
|
|
"""
|
|
all_flags = feature_flags.get_all_flags()
|
|
enabled_flags = feature_flags.get_enabled_flags()
|
|
|
|
return FeatureFlagsResponse(
|
|
flags=all_flags,
|
|
enabled_flags=enabled_flags
|
|
)
|
|
|
|
|
|
@router.get("/flags/{flag_name}", response_model=FeatureFlagResponse)
|
|
async def get_feature_flag(flag_name: str) -> FeatureFlagResponse:
|
|
"""
|
|
Get a specific feature flag value
|
|
"""
|
|
flag_name_upper = flag_name.upper()
|
|
enabled = feature_flags.is_enabled(flag_name_upper)
|
|
value = feature_flags.get_flag_value(flag_name_upper)
|
|
|
|
return FeatureFlagResponse(
|
|
name=flag_name_upper,
|
|
enabled=enabled,
|
|
value=value
|
|
)
|
|
|
|
|
|
@router.post("/flags/reload")
|
|
async def reload_feature_flags(
|
|
current_user = Depends(get_super_admin_user),
|
|
):
|
|
"""
|
|
Reload feature flags from environment variables.
|
|
"""
|
|
feature_flags.reload_flags()
|
|
return {"message": "Feature flags reloaded successfully"}
|