Skip to content
Merged
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
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
id: pylint
run: |
echo "Running pylint..."
if pylint src > pylint-output.txt 2>&1; then
if pylint app > pylint-output.txt 2>&1; then
echo "PYLINT_PASSED=true" >> $GITHUB_ENV
echo "No pylint errors found!"
else
Expand All @@ -61,7 +61,7 @@ jobs:
id: ruff
run: |
echo "Running ruff check..."
if ruff check . > ruff-output.txt 2>&1; then
if ruff check app > ruff-output.txt 2>&1; then
echo "RUFF_PASSED=true" >> $GITHUB_ENV
echo "No ruff errors found!"
else
Expand All @@ -75,14 +75,15 @@ jobs:
id: mypy
run: |
echo "Running mypy..."
if mypy . > mypy-output.txt 2>&1; then
cd app
if mypy . > ../mypy-output.txt 2>&1; then
echo "MYPY_PASSED=true" >> $GITHUB_ENV
echo "No mypy errors found"
else
echo "MYPY_PASSED=false" >> $GITHUB_ENV
echo "Mypy found issues"
fi
cat mypy-output.txt
cat ../mypy-output.txt
continue-on-error: true

- name: Create Lint Summary
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ venv
*.env
*.cache
*.egg
.angela

__pycache__/
*.py[cod]
Expand Down
8 changes: 5 additions & 3 deletions backend/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
from sqlalchemy.engine import Connection
from sqlalchemy.ext.asyncio import async_engine_from_config

from src.config import settings
from src.models import Base
from src.core.enums import SafeEnum
from config import settings
from core.Base import Base
from core.enums import SafeEnum
from user.User import User
from auth.RefreshToken import RefreshToken


config = context.config
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions backend/src/__main__.py → backend/app/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"""
import uvicorn

from src.config import settings
from src.factory import create_app
from config import settings
from factory import create_app


app = create_app()

if __name__ == "__main__":
uvicorn.run(
"src.__main__:app",
"__main__:app",
host = settings.HOST,
port = settings.PORT,
reload = settings.RELOAD,
Expand Down
Empty file added backend/app/admin/__init__.py
Empty file.
Empty file added backend/app/admin/py.typed
Empty file.
37 changes: 17 additions & 20 deletions backend/src/routes/admin.py → backend/app/admin/routes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
ⒸAngelaMos | 2025
admin.py
routes.py
"""

from uuid import UUID
Expand All @@ -13,28 +13,25 @@
status,
)

from src.config import (
from config import (
settings,
UserRole,
)
from src.core.dependencies import (
DBSession,
RequireRole,
)
from src.core.responses import (
from core.dependencies import RequireRole
from core.responses import (
AUTH_401,
CONFLICT_409,
FORBIDDEN_403,
NOT_FOUND_404,
)
from src.schemas.user import (
from user.schemas import (
AdminUserCreate,
UserListResponse,
UserResponse,
UserUpdateAdmin,
)
from src.models.User import User
from src.services.user import UserService
from user.User import User
from user.dependencies import UserServiceDep


router = APIRouter(prefix = "/admin", tags = ["admin"])
Expand All @@ -51,7 +48,7 @@
},
)
async def list_users(
db: DBSession,
user_service: UserServiceDep,
_: AdminOnly,
page: int = Query(default = 1,
ge = 1),
Expand All @@ -64,7 +61,7 @@ async def list_users(
"""
List all users (admin only)
"""
return await UserService.list_users(db, page, size)
return await user_service.list_users(page, size)


@router.post(
Expand All @@ -78,14 +75,14 @@ async def list_users(
},
)
async def create_user(
db: DBSession,
user_service: UserServiceDep,
_: AdminOnly,
user_data: AdminUserCreate,
) -> UserResponse:
"""
Create a new user (admin only, bypasses registration)
"""
return await UserService.admin_create_user(db, user_data)
return await user_service.admin_create_user(user_data)


@router.get(
Expand All @@ -98,14 +95,14 @@ async def create_user(
},
)
async def get_user(
db: DBSession,
user_service: UserServiceDep,
_: AdminOnly,
user_id: UUID,
) -> UserResponse:
"""
Get user by ID (admin only)
"""
return await UserService.get_user_by_id(db, user_id)
return await user_service.get_user_by_id(user_id)


@router.patch(
Expand All @@ -119,15 +116,15 @@ async def get_user(
},
)
async def update_user(
db: DBSession,
user_service: UserServiceDep,
_: AdminOnly,
user_id: UUID,
user_data: UserUpdateAdmin,
) -> UserResponse:
"""
Update user (admin only)
"""
return await UserService.admin_update_user(db, user_id, user_data)
return await user_service.admin_update_user(user_id, user_data)


@router.delete(
Expand All @@ -140,11 +137,11 @@ async def update_user(
},
)
async def delete_user(
db: DBSession,
user_service: UserServiceDep,
_: AdminOnly,
user_id: UUID,
) -> None:
"""
Delete user (admin only, hard delete)
"""
await UserService.admin_delete_user(db, user_id)
await user_service.admin_delete_user(user_id)
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
relationship,
)

from src.config import (
from config import (
DEVICE_ID_MAX_LENGTH,
DEVICE_NAME_MAX_LENGTH,
IP_ADDRESS_MAX_LENGTH,
TOKEN_HASH_LENGTH,
)
from src.models.Base import (
from core.Base import (
Base,
TimestampMixin,
UUIDMixin,
)

if TYPE_CHECKING:
from src.models.User import User
from user.User import User


class RefreshToken(Base, UUIDMixin, TimestampMixin):
Expand Down
Empty file added backend/app/auth/__init__.py
Empty file.
21 changes: 21 additions & 0 deletions backend/app/auth/dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
ⒸAngelaMos | 2025
dependencies.py
"""

from typing import Annotated

from fastapi import Depends

from core.dependencies import DBSession
from .service import AuthService


def get_auth_service(db: DBSession) -> AuthService:
"""
Dependency to inject AuthService instance
"""
return AuthService(db)


AuthServiceDep = Annotated[AuthService, Depends(get_auth_service)]
Empty file added backend/app/auth/py.typed
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
ⒸAngelaMos | 2025
refresh_token.py
repository.py
"""

from uuid import UUID
Expand All @@ -9,8 +9,8 @@
from sqlalchemy import select, update
from sqlalchemy.ext.asyncio import AsyncSession

from src.models.RefreshToken import RefreshToken
from src.repositories.base import BaseRepository
from .RefreshToken import RefreshToken
from core.base_repository import BaseRepository


class RefreshTokenRepository(BaseRepository[RefreshToken]):
Expand Down
Loading
Loading