Skip to content

Commit

Permalink
♻️ Edit refactor models, routes and utils to use UUID instead of id i…
Browse files Browse the repository at this point in the history
…ntegers (#153)

Co-authored-by: Alejandra <90076947+alejsdev@users.noreply.github.com>
Co-authored-by: User <alejsdev@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
  • Loading branch information
4 people authored Jul 22, 2024
1 parent 2db5d29 commit 7e24bb9
Show file tree
Hide file tree
Showing 28 changed files with 852 additions and 1,216 deletions.

This file was deleted.

This file was deleted.

43 changes: 0 additions & 43 deletions backend/app/alembic/versions/3a7df55f39d3_add_invitations_table.py

This file was deleted.

25 changes: 0 additions & 25 deletions backend/app/alembic/versions/4df8ae4a83c0_merge_heads.py

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions backend/app/alembic/versions/6eb318701c26_merge_heads.py

This file was deleted.

77 changes: 77 additions & 0 deletions backend/app/alembic/versions/89c9a00d523e_initial_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""Initial setup
Revision ID: 89c9a00d523e
Revises:
Create Date: 2024-07-18 22:25:02.356343
"""
from alembic import op
import sqlalchemy as sa
import sqlmodel.sql.sqltypes


# revision identifiers, used by Alembic.
revision = '89c9a00d523e'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('team',
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=True),
sa.Column('id', sa.Uuid(), nullable=False),
sa.Column('slug', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_team_slug'), 'team', ['slug'], unique=True)
op.create_table('user',
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('full_name', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.Column('id', sa.Uuid(), nullable=False),
sa.Column('hashed_password', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('username', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.Column('is_verified', sa.Boolean(), nullable=False),
sa.Column('personal_team_id', sa.Uuid(), nullable=True),
sa.ForeignKeyConstraint(['personal_team_id'], ['team.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
op.create_table('invitation',
sa.Column('role', sa.Enum('member', 'admin', name='role'), nullable=False),
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.Column('id', sa.Uuid(), nullable=False),
sa.Column('team_id', sa.Uuid(), nullable=False),
sa.Column('invited_by_id', sa.Uuid(), nullable=False),
sa.Column('status', sa.Enum('pending', 'accepted', name='invitationstatus'), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('expires_at', sa.DateTime(), nullable=False),
sa.ForeignKeyConstraint(['invited_by_id'], ['user.id'], ),
sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('userteamlink',
sa.Column('user_id', sa.Uuid(), nullable=False),
sa.Column('team_id', sa.Uuid(), nullable=False),
sa.Column('role', sa.Enum('member', 'admin', name='role'), nullable=False),
sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('user_id', 'team_id')
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('userteamlink')
op.drop_table('invitation')
op.drop_index(op.f('ix_user_username'), 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_slug'), table_name='team')
op.drop_table('team')
# ### end Alembic commands ###
25 changes: 0 additions & 25 deletions backend/app/alembic/versions/a17996bd5bff_merge_heads.py

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7e24bb9

Please sign in to comment.