Add member profile questions, admin tooling, legal pages, and fast tests
- 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
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
"""Add volunteer level and dynamic profile questions
|
||||
|
||||
Revision ID: 2e8a0f9d4b31
|
||||
Revises: b583fd2cf202
|
||||
Create Date: 2026-05-04 17:50:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '2e8a0f9d4b31'
|
||||
down_revision: Union[str, None] = 'b583fd2cf202'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column('users', sa.Column('volunteer_level', sa.String(length=50), nullable=True))
|
||||
|
||||
op.create_table(
|
||||
'profile_questions',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('key', sa.String(length=100), nullable=False),
|
||||
sa.Column('label', sa.String(length=255), nullable=False),
|
||||
sa.Column('help_text', sa.Text(), nullable=True),
|
||||
sa.Column('input_type', sa.String(length=30), nullable=False),
|
||||
sa.Column('placeholder', sa.String(length=255), nullable=True),
|
||||
sa.Column('options_json', sa.Text(), nullable=True),
|
||||
sa.Column('is_required', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.Column('admin_only_edit', sa.Boolean(), nullable=False),
|
||||
sa.Column('display_order', sa.Integer(), nullable=False),
|
||||
sa.Column('depends_on_question_id', sa.Integer(), nullable=True),
|
||||
sa.Column('depends_on_value', sa.String(length=255), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['depends_on_question_id'], ['profile_questions.id']),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
)
|
||||
op.create_index(op.f('ix_profile_questions_id'), 'profile_questions', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_profile_questions_key'), 'profile_questions', ['key'], unique=True)
|
||||
|
||||
op.create_table(
|
||||
'user_profile_answers',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('question_id', sa.Integer(), nullable=False),
|
||||
sa.Column('value_text', sa.Text(), nullable=True),
|
||||
sa.Column('updated_by_user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['question_id'], ['profile_questions.id']),
|
||||
sa.ForeignKeyConstraint(['updated_by_user_id'], ['users.id']),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id']),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('user_id', 'question_id', name='uq_user_profile_answer'),
|
||||
)
|
||||
op.create_index(op.f('ix_user_profile_answers_id'), 'user_profile_answers', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_user_profile_answers_question_id'), 'user_profile_answers', ['question_id'], unique=False)
|
||||
op.create_index(op.f('ix_user_profile_answers_user_id'), 'user_profile_answers', ['user_id'], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f('ix_user_profile_answers_user_id'), table_name='user_profile_answers')
|
||||
op.drop_index(op.f('ix_user_profile_answers_question_id'), table_name='user_profile_answers')
|
||||
op.drop_index(op.f('ix_user_profile_answers_id'), table_name='user_profile_answers')
|
||||
op.drop_table('user_profile_answers')
|
||||
|
||||
op.drop_index(op.f('ix_profile_questions_key'), table_name='profile_questions')
|
||||
op.drop_index(op.f('ix_profile_questions_id'), table_name='profile_questions')
|
||||
op.drop_table('profile_questions')
|
||||
|
||||
op.drop_column('users', 'volunteer_level')
|
||||
Reference in New Issue
Block a user