Initial Login functionality

This commit is contained in:
Josako
2024-04-24 11:58:45 +02:00
parent ca77f55a7f
commit c9b9828e7b
1101 changed files with 331963 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,49 @@
"""Added user to Public Schema
Revision ID: 090e8ec0fcad
Revises: 92f0bd8ddd69
Create Date: 2024-04-22 17:00:10.390992
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '090e8ec0fcad'
down_revision = '92f0bd8ddd69'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_name', sa.String(length=80), nullable=False),
sa.Column('email', sa.String(length=255), nullable=False),
sa.Column('password', sa.String(length=255), nullable=False),
sa.Column('first_name', sa.String(length=80), nullable=False),
sa.Column('last_name', sa.String(length=80), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=True),
sa.Column('is_tester', sa.Boolean(), nullable=True),
sa.Column('is_admin', sa.Boolean(), nullable=True),
sa.Column('valid_to', sa.Date(), nullable=True),
sa.Column('last_login', sa.DateTime(), nullable=True),
sa.Column('authenticated', sa.Boolean(), nullable=True),
sa.Column('tenant_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['tenant_id'], ['public.tenant.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email'),
sa.UniqueConstraint('user_name'),
schema='public'
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('user', schema='public')
# ### end Alembic commands ###

View File

@@ -0,0 +1,40 @@
"""Initial Public Schema
Revision ID: 92f0bd8ddd69
Revises:
Create Date: 2024-04-22 16:55:17.831524
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '92f0bd8ddd69'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tenant',
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=80), nullable=False),
sa.Column('website', sa.String(length=255), nullable=True),
sa.Column('license_start_date', sa.Date(), nullable=True),
sa.Column('license_end_date', sa.Date(), nullable=True),
sa.Column('allowed_monthly_interactions', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name'),
schema='public'
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('tenant', schema='public')
# ### end Alembic commands ###

View File

@@ -0,0 +1,38 @@
"""Changed user to include is_super
Revision ID: b0ac53ab9d12
Revises: 090e8ec0fcad
Create Date: 2024-04-23 08:21:38.926298
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b0ac53ab9d12'
down_revision = '090e8ec0fcad'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.add_column(sa.Column('is_super', sa.Boolean(), nullable=True))
batch_op.add_column(sa.Column('confirmed_at', sa.DateTime(), nullable=True))
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
batch_op.drop_column('confirmed_at')
batch_op.drop_column('is_super')
# ### end Alembic commands ###