Skip to content

Commit

Permalink
Altera imports
Browse files Browse the repository at this point in the history
  • Loading branch information
joao15victor08 committed Sep 4, 2024
1 parent cc486f6 commit a4e5107
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

load_dotenv()

from src.utils import dotenv
from utils import dotenv

load_dotenv()
dotenv.validate_dotenv()

if __name__ == '__main__': # pragma: no cover
port = 8000
uvicorn.run('src.main:app', reload=True, port=int(port), host="0.0.0.0")
uvicorn.run(' main:app', reload=True, port=int(port), host="0.0.0.0")
10 changes: 5 additions & 5 deletions src/controller/authController.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from fastapi import APIRouter, HTTPException, Response, status, Depends
from src.utils import security, enumeration, send_mail
from src.database.database import get_db
from utils import security, enumeration, send_mail
from database.database import get_db
from sqlalchemy.orm import Session
from datetime import datetime, timedelta
from src.constants import errorMessages
from constants import errorMessages
from starlette.responses import JSONResponse

from src.domain import userSchema, authSchema
from src.repository import userRepository
from domain import userSchema, authSchema
from repository import userRepository

auth = APIRouter(
prefix="/auth"
Expand Down
10 changes: 5 additions & 5 deletions src/controller/userController.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from fastapi import APIRouter, HTTPException, Response, status, Depends, Header
from src.database.database import get_db
from database.database import get_db
from sqlalchemy.orm import Session

from src.constants import errorMessages
from src.domain import userSchema
from src.repository import userRepository
from src.utils import security, enumeration
from constants import errorMessages
from domain import userSchema
from repository import userRepository
from utils import security, enumeration

from fastapi_filter import FilterDepends

Expand Down
2 changes: 1 addition & 1 deletion src/domain/userSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from fastapi_filter import FilterDepends, with_prefix
from sqlalchemy import or_
from fastapi_filter.contrib.sqlalchemy import Filter
from src.model import userModel
from model import userModel

class UserUpdate(BaseModel):
name: str = None
Expand Down
6 changes: 3 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from fastapi.middleware.cors import CORSMiddleware


from src.controller import userController, authController
from src.model import userModel
from src.database import database
from controller import userController, authController
from model import userModel
from database import database


userModel.Base.metadata.create_all(bind=database.engine)
Expand Down
2 changes: 1 addition & 1 deletion src/model/userModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship

from src.database.database import Base
from database.database import Base

class User(Base):
__tablename__ = "users"
Expand Down
4 changes: 2 additions & 2 deletions src/repository/userRepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from sqlalchemy import or_
from sqlalchemy.orm import Session

from src.domain import userSchema
from src.model import userModel
from domain import userSchema
from model import userModel

# Obtem usuario a partir do seu ID
def get_user(db: Session, user_id: int):
Expand Down
2 changes: 1 addition & 1 deletion src/utils/dotenv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from src.constants import errorMessages
from constants import errorMessages

def validate_dotenv():
required_env_var = ["SECRET", "ALGORITHM", "MAIL_USERNAME", "MAIL_PASSWORD", "MAIL_FROM", "MAIL_PORT", "MAIL_SERVER"]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from passlib.context import CryptContext
from jose import JWTError, jwt
from fastapi.security import OAuth2PasswordBearer
from src.constants import errorMessages
from constants import errorMessages

SECRET_KEY = os.getenv("SECRET")
ALGORITHM = os.getenv("ALGORITHM")
Expand Down
2 changes: 1 addition & 1 deletion src/utils/send_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pydantic import BaseModel, EmailStr
from starlette.responses import JSONResponse
from typing import List
from src.domain import authSchema
from domain import authSchema

conf = ConnectionConfig(
MAIL_USERNAME = os.getenv("MAIL_USERNAME"),
Expand Down
10 changes: 5 additions & 5 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from jose import JWTError
from fastapi import HTTPException

from src.main import app
from src.constants import errorMessages
from src.model import userModel
from src.utils import security, dotenv, send_mail, enumeration
from src.database.database import get_db, engine, Base
from main import app
from constants import errorMessages
from model import userModel
from utils import security, dotenv, send_mail, enumeration
from database.database import get_db, engine, Base

valid_user_active_admin = {"name": "Forsen", "email": "[email protected]", "connection": "PROFESSOR", "password": "123456"}
valid_user_active_user = {"name": "Guy Beahm", "email": "[email protected]", "connection": "ESTUDANTE", "password": "123456"}
Expand Down
6 changes: 3 additions & 3 deletions tests/test_user.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest, os, asyncio
from fastapi.testclient import TestClient

from src.main import app
from src.constants import errorMessages
from src.database.database import get_db, engine, Base
from main import app
from constants import errorMessages
from database.database import get_db, engine, Base
from tests import test_auth

valid_user_active_admin = test_auth.valid_user_active_admin
Expand Down

0 comments on commit a4e5107

Please sign in to comment.