Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ STACK_NAME=full-stack-fastapi-project

# Backend
BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com"
SECRET_KEY=changethis
SECRET_KEY=UXjzVJ3dRZEDKD8RkdUBTBsSPVETMj3R
[email protected]
FIRST_SUPERUSER_PASSWORD=changethis
FIRST_SUPERUSER_PASSWORD=Torghay1988

# Emails
SMTP_HOST=
Expand All @@ -31,12 +31,12 @@ SMTP_TLS=True
SMTP_SSL=False
SMTP_PORT=587

# Postgres
POSTGRES_SERVER=localhost
POSTGRES_PORT=5432
POSTGRES_DB=app
POSTGRES_USER=postgres
POSTGRES_PASSWORD=changethis
# Mysql
MYSQL_SERVER=localhost
MYSQL_PORT=3306
MYSQL_DB=lalili
MYSQL_USER=root
MYSQL_PASSWORD=Qaz123(!*

SENTRY_DSN=

Expand Down

This file was deleted.

48 changes: 48 additions & 0 deletions backend/app/alembic/versions/324024cfba63_upgrade_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""Upgrade model

Revision ID: 324024cfba63
Revises:
Create Date: 2025-01-14 14:35:35.495095

"""
from alembic import op
import sqlalchemy as sa
import sqlmodel.sql.sqltypes


# revision identifiers, used by Alembic.
revision = '324024cfba63'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
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('is_superuser', sa.Boolean(), nullable=False),
sa.Column('full_name', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=True),
sa.Column('id', sa.Uuid(), nullable=False),
sa.Column('hashed_password', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
op.create_table('item',
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=True),
sa.Column('id', sa.Uuid(), nullable=False),
sa.Column('title', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.Column('owner_id', sa.Uuid(), nullable=False),
sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('item')
op.drop_index(op.f('ix_user_email'), table_name='user')
op.drop_table('user')
# ### end Alembic commands ###

This file was deleted.

This file was deleted.

54 changes: 0 additions & 54 deletions backend/app/alembic/versions/e2412789c190_initialize_models.py

This file was deleted.

5 changes: 4 additions & 1 deletion backend/app/api/deps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import uuid
from collections.abc import Generator
from typing import Annotated


import jwt
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
Expand All @@ -13,6 +15,7 @@
from app.core.db import engine
from app.models import TokenPayload, User


reusable_oauth2 = OAuth2PasswordBearer(
tokenUrl=f"{settings.API_V1_STR}/login/access-token"
)
Expand All @@ -38,7 +41,7 @@ def get_current_user(session: SessionDep, token: TokenDep) -> User:
status_code=status.HTTP_403_FORBIDDEN,
detail="Could not validate credentials",
)
user = session.get(User, token_data.sub)
user = session.get(User, uuid.UUID(token_data.sub))
if not user:
raise HTTPException(status_code=404, detail="User not found")
if not user.is_active:
Expand Down
Loading
Loading