Skip to content

Commit b7ae060

Browse files
author
Uttam Singh
committed
Fix backend import by adding users router
1 parent bc08035 commit b7ae060

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

backend/app/routers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .users import *

backend/app/routers/users.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from fastapi import APIRouter, HTTPException, Depends
2+
from sqlalchemy.orm import Session
3+
from app.main import get_db
4+
5+
router = APIRouter(prefix="/users", tags=["Users"])
6+
7+
@router.get("/")
8+
def list_users(db: Session = Depends(get_db)):
9+
# For now, just a placeholder
10+
return {"message": "User list (placeholder)"}
11+
12+
@router.post("/login")
13+
def login(username: str, password: str, db: Session = Depends(get_db)):
14+
# Simple fake login logic (replace later)
15+
if username == "admin" and password == "admin123":
16+
return {"message": "Login successful", "role": "admin"}
17+
raise HTTPException(status_code=401, detail="Invalid credentials")

0 commit comments

Comments
 (0)