- Add Specialist Magic Links

- correction of some bugs:
  - dynamic fields for adding documents / urls to dossier catalog
  - tabs in latest bootstrap version no longer functional
  - partner association of license tier not working when no partner selected
  - data-type dynamic field needs conversion to isoformat
  - Add public tables to env.py of tenant schema
This commit is contained in:
Josako
2025-06-04 11:53:35 +02:00
parent b4e58659a8
commit 0d05499d2b
34 changed files with 822 additions and 121 deletions

View File

@@ -0,0 +1,35 @@
"""Add SpecialistMagicLinkTenant model
Revision ID: 2b4cb553530e
Revises: 7d3c6f48735c
Create Date: 2025-06-03 20:26:36.423880
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2b4cb553530e'
down_revision = '7d3c6f48735c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('specialist_magic_link_tenant',
sa.Column('magic_link_code', sa.String(length=55), nullable=False),
sa.Column('tenant_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['tenant_id'], ['public.tenant.id'], ),
sa.PrimaryKeyConstraint('magic_link_code'),
schema='public'
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('specialist_magic_link_tenant', schema='public')
# ### end Alembic commands ###

View File

@@ -71,8 +71,8 @@ target_db = current_app.extensions['migrate'].db
def get_public_table_names():
# TODO: This function should include the necessary functionality to automatically retrieve table names
return ['role', 'roles_users', 'tenant', 'user', 'tenant_domain','license_tier', 'license', 'license_usage',
'business_event_log', 'tenant_project']
'business_event_log', 'tenant_project', 'partner', 'partner_service', 'invoice', 'license_period',
'license_change_log', 'partner_service_license_tier', 'payment', 'partner_tenant']
PUBLIC_TABLES = get_public_table_names()
logger.info(f"Public tables: {PUBLIC_TABLES}")

View File

@@ -0,0 +1,47 @@
"""Add SpecialistMagicLink model
Revision ID: d69520ec540d
Revises: 55c696c4a687
Create Date: 2025-06-03 20:25:51.129869
"""
from alembic import op
import sqlalchemy as sa
import pgvector
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'd69520ec540d'
down_revision = '55c696c4a687'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('specialist_magic_link',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=50), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('specialist_id', sa.Integer(), nullable=False),
sa.Column('magic_link_code', sa.String(length=55), nullable=False),
sa.Column('valid_from', sa.DateTime(), nullable=True),
sa.Column('valid_to', sa.DateTime(), nullable=True),
sa.Column('specialist_args', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('created_by', sa.Integer(), nullable=True),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('updated_by', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['created_by'], ['public.user.id'], ),
sa.ForeignKeyConstraint(['specialist_id'], ['specialist.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['updated_by'], ['public.user.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('magic_link_code')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('specialist_magic_link')
# ### end Alembic commands ###