Brings the Work Package Suite from a browser-local prototype to a multi-tenant, SQL-backed deployment hardened for customer IP. Auth & access control - Local username/password login (bcrypt + JWT in an HttpOnly cookie), admin-managed users, per-project membership, and project-scoped API access. - Admin console: change user roles, view the audit trail, manage settings. Security hardening - CSP / HSTS / X-Frame-Options / nosniff headers in nginx; Secure cookie via X-Forwarded-Proto; CSRF Origin check; attribute-safe output escaping. - Login lockout, token_version session revocation, stronger password policy, fail-closed secret loading, encrypted (AES-256) database backups. Persistence & schema - SOPs and Work Packages are now DB-backed and shared across users, written through a durable client sync outbox that queues offline edits. - Alembic migrations applied automatically on container start. New capabilities - Phase 2 dashboard (progress, gating, pagination, archive). - Phase 3 PWA "Field View" with offline caching and auth fallback. - WP owner assignment with OPTIONAL email notifications, OFF by default and toggled from the admin console. SMTP password is read only from the SMTP_PASSWORD env var (never stored); emails carry a WP number + deep link, never customer IP. Also: IBM Carbon restyle, Help section, and DEPLOYMENT.md brought up to date. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64 lines
3.0 KiB
Python
64 lines
3.0 KiB
Python
"""assignment + settings + notifications
|
|
|
|
Revision ID: 57dec34f11cb
|
|
Revises: ad8e6cc5de0f
|
|
Create Date: 2026-07-15 16:43:09.230419
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '57dec34f11cb'
|
|
down_revision = 'ad8e6cc5de0f'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('app_settings',
|
|
sa.Column('key', sa.String(length=80), nullable=False),
|
|
sa.Column('value', sa.JSON(), nullable=False),
|
|
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
|
sa.PrimaryKeyConstraint('key')
|
|
)
|
|
op.create_table('notifications',
|
|
sa.Column('id', sa.String(length=40), nullable=False),
|
|
sa.Column('user_id', sa.String(length=40), nullable=False),
|
|
sa.Column('email', sa.String(length=200), nullable=False),
|
|
sa.Column('kind', sa.String(length=40), nullable=False),
|
|
sa.Column('wp_id', sa.String(length=40), nullable=True),
|
|
sa.Column('project_id', sa.String(length=40), nullable=True),
|
|
sa.Column('subject', sa.String(length=300), nullable=False),
|
|
sa.Column('body', sa.Text(), nullable=False),
|
|
sa.Column('link', sa.String(length=500), nullable=False),
|
|
sa.Column('status', sa.String(length=20), nullable=False),
|
|
sa.Column('error', sa.String(length=400), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column('sent_at', sa.DateTime(timezone=True), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_notifications_created_at'), 'notifications', ['created_at'], unique=False)
|
|
op.create_index(op.f('ix_notifications_kind'), 'notifications', ['kind'], unique=False)
|
|
op.create_index(op.f('ix_notifications_project_id'), 'notifications', ['project_id'], unique=False)
|
|
op.create_index(op.f('ix_notifications_status'), 'notifications', ['status'], unique=False)
|
|
op.create_index(op.f('ix_notifications_user_id'), 'notifications', ['user_id'], unique=False)
|
|
op.add_column('work_packages', sa.Column('assignee_id', sa.String(length=40), nullable=True))
|
|
op.create_index(op.f('ix_work_packages_assignee_id'), 'work_packages', ['assignee_id'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_work_packages_assignee_id'), table_name='work_packages')
|
|
op.drop_column('work_packages', 'assignee_id')
|
|
op.drop_index(op.f('ix_notifications_user_id'), table_name='notifications')
|
|
op.drop_index(op.f('ix_notifications_status'), table_name='notifications')
|
|
op.drop_index(op.f('ix_notifications_project_id'), table_name='notifications')
|
|
op.drop_index(op.f('ix_notifications_kind'), table_name='notifications')
|
|
op.drop_index(op.f('ix_notifications_created_at'), table_name='notifications')
|
|
op.drop_table('notifications')
|
|
op.drop_table('app_settings')
|
|
# ### end Alembic commands ###
|