
- Set up project structure with FastAPI application - Implement SQLAlchemy models for users, services, projects, team members, contacts - Create API endpoints for website functionality - Implement JWT authentication system with user roles - Add file upload functionality for media - Configure CORS and health check endpoints - Add database migrations with Alembic - Create comprehensive README with setup instructions
154 lines
7.2 KiB
Python
154 lines
7.2 KiB
Python
"""initial migration
|
|
|
|
Revision ID: 001
|
|
Revises:
|
|
Create Date: 2023-11-08
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '001'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('contact',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=100), nullable=False),
|
|
sa.Column('email', sa.String(length=100), nullable=False),
|
|
sa.Column('phone', sa.String(length=20), nullable=True),
|
|
sa.Column('subject', sa.String(length=200), nullable=True),
|
|
sa.Column('message', sa.Text(), nullable=False),
|
|
sa.Column('is_read', sa.Boolean(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_contact_email'), 'contact', ['email'], unique=False)
|
|
op.create_index(op.f('ix_contact_id'), 'contact', ['id'], unique=False)
|
|
|
|
op.create_table('project',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('title', sa.String(length=100), nullable=False),
|
|
sa.Column('slug', sa.String(length=100), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=False),
|
|
sa.Column('client', sa.String(length=100), nullable=True),
|
|
sa.Column('completion_date', sa.DateTime(), nullable=True),
|
|
sa.Column('featured_image', sa.String(length=255), nullable=True),
|
|
sa.Column('is_featured', sa.Boolean(), nullable=True),
|
|
sa.Column('is_active', sa.Boolean(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_project_client'), 'project', ['client'], unique=False)
|
|
op.create_index(op.f('ix_project_id'), 'project', ['id'], unique=False)
|
|
op.create_index(op.f('ix_project_slug'), 'project', ['slug'], unique=True)
|
|
op.create_index(op.f('ix_project_title'), 'project', ['title'], unique=False)
|
|
|
|
op.create_table('service',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('title', sa.String(length=100), nullable=False),
|
|
sa.Column('slug', sa.String(length=100), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=False),
|
|
sa.Column('icon', sa.String(length=255), nullable=True),
|
|
sa.Column('image_path', sa.String(length=255), nullable=True),
|
|
sa.Column('is_active', sa.Boolean(), nullable=True),
|
|
sa.Column('order', sa.Integer(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_service_id'), 'service', ['id'], unique=False)
|
|
op.create_index(op.f('ix_service_slug'), 'service', ['slug'], unique=True)
|
|
op.create_index(op.f('ix_service_title'), 'service', ['title'], unique=False)
|
|
|
|
op.create_table('settings',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('site_name', sa.String(length=100), nullable=False),
|
|
sa.Column('site_description', sa.Text(), nullable=True),
|
|
sa.Column('contact_email', sa.String(length=100), nullable=False),
|
|
sa.Column('contact_phone', sa.String(length=20), nullable=True),
|
|
sa.Column('address', sa.Text(), nullable=True),
|
|
sa.Column('facebook', sa.String(length=255), nullable=True),
|
|
sa.Column('twitter', sa.String(length=255), nullable=True),
|
|
sa.Column('linkedin', sa.String(length=255), nullable=True),
|
|
sa.Column('instagram', sa.String(length=255), nullable=True),
|
|
sa.Column('logo_path', sa.String(length=255), nullable=True),
|
|
sa.Column('favicon_path', sa.String(length=255), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_settings_id'), 'settings', ['id'], unique=False)
|
|
|
|
op.create_table('team_member',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=100), nullable=False),
|
|
sa.Column('position', sa.String(length=100), nullable=False),
|
|
sa.Column('bio', sa.Text(), nullable=True),
|
|
sa.Column('photo', sa.String(length=255), nullable=True),
|
|
sa.Column('email', sa.String(length=100), nullable=True),
|
|
sa.Column('linkedin', sa.String(length=255), nullable=True),
|
|
sa.Column('twitter', sa.String(length=255), nullable=True),
|
|
sa.Column('is_active', sa.Boolean(), nullable=True),
|
|
sa.Column('order', sa.Integer(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_team_member_id'), 'team_member', ['id'], unique=False)
|
|
op.create_index(op.f('ix_team_member_name'), 'team_member', ['name'], unique=False)
|
|
|
|
op.create_table('user',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('email', sa.String(), nullable=False),
|
|
sa.Column('full_name', sa.String(), nullable=True),
|
|
sa.Column('hashed_password', sa.String(), nullable=False),
|
|
sa.Column('is_active', sa.Boolean(), nullable=True),
|
|
sa.Column('is_superuser', sa.Boolean(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
|
|
op.create_index(op.f('ix_user_full_name'), 'user', ['full_name'], unique=False)
|
|
op.create_index(op.f('ix_user_id'), 'user', ['id'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_user_id'), table_name='user')
|
|
op.drop_index(op.f('ix_user_full_name'), table_name='user')
|
|
op.drop_index(op.f('ix_user_email'), table_name='user')
|
|
op.drop_table('user')
|
|
|
|
op.drop_index(op.f('ix_team_member_name'), table_name='team_member')
|
|
op.drop_index(op.f('ix_team_member_id'), table_name='team_member')
|
|
op.drop_table('team_member')
|
|
|
|
op.drop_index(op.f('ix_settings_id'), table_name='settings')
|
|
op.drop_table('settings')
|
|
|
|
op.drop_index(op.f('ix_service_title'), table_name='service')
|
|
op.drop_index(op.f('ix_service_slug'), table_name='service')
|
|
op.drop_index(op.f('ix_service_id'), table_name='service')
|
|
op.drop_table('service')
|
|
|
|
op.drop_index(op.f('ix_project_title'), table_name='project')
|
|
op.drop_index(op.f('ix_project_slug'), table_name='project')
|
|
op.drop_index(op.f('ix_project_id'), table_name='project')
|
|
op.drop_index(op.f('ix_project_client'), table_name='project')
|
|
op.drop_table('project')
|
|
|
|
op.drop_index(op.f('ix_contact_id'), table_name='contact')
|
|
op.drop_index(op.f('ix_contact_email'), table_name='contact')
|
|
op.drop_table('contact')
|
|
# ### end Alembic commands ### |