Skip to content

Commit

Permalink
🚚 Rename organization resources to team (#32)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
  • Loading branch information
estebanx64 and tiangolo authored Apr 16, 2024
1 parent 1f302b5 commit 6b068c5
Show file tree
Hide file tree
Showing 11 changed files with 491 additions and 570 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('invitation',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('organization_id', sa.Integer(), nullable=False),
sa.Column('team_id', sa.Integer(), nullable=False),
sa.Column('invited_by_id', sa.Integer(), nullable=False),
sa.Column('invited_user_id', sa.Integer(), nullable=True),
sa.Column('role', sa.Enum('member', 'admin', name='role'), nullable=False),
Expand All @@ -31,7 +31,7 @@ def upgrade():
sa.Column('expires_at', sa.DateTime(), nullable=False),
sa.ForeignKeyConstraint(['invited_by_id'], ['user.id'], ),
sa.ForeignKeyConstraint(['invited_user_id'], ['user.id'], ),
sa.ForeignKeyConstraint(['organization_id'], ['organization.id'], ),
sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Add organization table and UserOrganization join table
"""Add team table and UserTeam join table
Revision ID: 56310da83983
Revises: e2412789c190
Expand All @@ -19,25 +19,25 @@

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('organization',
op.create_table('team',
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('userorganizationlink',
op.create_table('userteamlink',
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('organization_id', sa.Integer(), nullable=False),
sa.Column('team_id', sa.Integer(), nullable=False),
sa.Column('role', sa.Enum('member', 'admin', name='role'), nullable=False),
sa.ForeignKeyConstraint(['organization_id'], ['organization.id'], ),
sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('user_id', 'organization_id')
sa.PrimaryKeyConstraint('user_id', 'team_id')
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('userorganizationlink')
op.drop_table('organization')
op.drop_table('userteamlink')
op.drop_table('team')
# ### end Alembic commands ###
6 changes: 2 additions & 4 deletions backend/app/api/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from fastapi import APIRouter

from app.api.routes import items, login, organizations, users, utils
from app.api.routes import items, login, teams, users, utils

api_router = APIRouter()
api_router.include_router(login.router, tags=["login"])
api_router.include_router(users.router, prefix="/users", tags=["users"])
api_router.include_router(utils.router, prefix="/utils", tags=["utils"])
api_router.include_router(items.router, prefix="/items", tags=["items"])
api_router.include_router(
organizations.router, prefix="/organizations", tags=["organizations"]
)
api_router.include_router(teams.router, prefix="/teams", tags=["teams"])
317 changes: 0 additions & 317 deletions backend/app/api/routes/organizations.py

This file was deleted.

Loading

0 comments on commit 6b068c5

Please sign in to comment.