Setup project, started outlining endpoints and tests.

This commit is contained in:
Sparkchaser13 committed 2026-09-23 16:00:14 -06:00
commit 33cd28376d
41 files changed
+5177

No files matched your search

View File
Whitespace-only changes.
View File
Whitespace-only changes.
+3
View File
@@ -0,0 +1,3 @@
"""Common types and models."""
type Message = dict[str, str]
+20
View File
@@ -0,0 +1,20 @@
"""Where the magic happens."""
from fastapi import APIRouter, FastAPI
from app.core.common import Message
from app.platform.auth import router as auth
from app.platform.users import router as users
app = FastAPI()
api_router = APIRouter(prefix="/api")
api_router.include_router(users.router)
api_router.include_router(auth.router)
app.include_router(api_router)
@app.get(path="/")
def status_check() -> Message:
"""Endpoind to check if server is running."""
return {"status": "healthy"}
View File
Whitespace-only changes.
Whitespace-only changes.
+49
View File
@@ -0,0 +1,49 @@
"""Endpoints for authentication."""
from fastapi import APIRouter
from app.core.common import Message
router = APIRouter(prefix="/auth", tags=["auth"])
@router.post(path="/login")
async def login_user() -> Message:
"""Start user session/token."""
return {"status": "healthy"}
@router.post(path="/refresh")
async def refresh_login_session() -> Message:
"""Refresh user login."""
return {"status": "healthy"}
@router.post(path="/logout")
async def logout_user() -> Message:
"""End user session/token."""
return {"status": "healthy"}
@router.post(path="/invite/accept")
async def accept_invite() -> Message:
"""Accept user invite."""
return {"status": "healthy"}
@router.post(path="/password-reset/request")
async def request_password_reset() -> Message:
"""Initiate password request."""
return {"status": "healthy"}
@router.post(path="/password-reset/confirm")
async def confirm_password_reset() -> Message:
"""Confirm password request."""
return {"status": "healthy"}
@router.get(path="/{user_id}")
async def retrieve_authenticated_user(user_id: str) -> Message:
"""Retrieve current authenticated user by id."""
return {"status": user_id}
Whitespace-only changes.
Whitespace-only changes.
+21
View File
@@ -0,0 +1,21 @@
"""Database user model."""
import uuid
from sqlalchemy import Column, String
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
"""Base Class for all db models."""
pass
class DBUser(Base):
"""Database User Model."""
id = Column(
String(36), primary_key=True, default=lambda: str(uuid.uuid4()), index=True
)
email = Column(String)
+61
View File
@@ -0,0 +1,61 @@
"""Routes for users."""
from fastapi import APIRouter
from app.core.common import Message
router = APIRouter(prefix="/users", tags=["user"])
@router.get(path="/")
def list_users() -> Message:
"""Retrieve all users stored in DB."""
return {"status": "healthy"}
@router.post(path="/invite")
def send_user_invite() -> Message:
"""Send user invite request."""
return {"status": "healthy"}
@router.get(path="/{user_id}")
def retrieve_user(user_id: str) -> Message:
"""Retrieve user by id."""
return {"user": user_id}
@router.patch(path="/{user_id}")
def update_user(user_id: str) -> Message:
"""Update user by id."""
return {"user": user_id}
@router.post(path="/{user_id}/deactivate")
def deactivate_user(user_id: str) -> Message:
"""Deactivates user by id."""
return {"user": user_id}
@router.post(path="/{user_id}/reactivate")
def reactivate_user(user_id: str) -> Message:
"""Reactivates user by id."""
return {"user": user_id}
@router.post(path="/{user_id}/resend-invite")
def resend_user_invite(user_id: str) -> Message:
"""Resends user invite."""
return {"user": user_id}
@router.get(path="/{user_id}/export")
def export_user(user_id: str) -> Message:
"""Resends user invite."""
return {"user": user_id}
@router.delete(path="/{user_id}")
def delete_user(user_id: str) -> Message:
"""Resends user invite."""
return {"user": user_id}