21 lines
656 B
Python
21 lines
656 B
Python
from fastapi import APIRouter, Depends, HTTPException, status
|
|
from sqlalchemy.orm import Session
|
|
from typing import List
|
|
from core.database import get_db
|
|
from models.login import Login
|
|
from schemas.login import LoginSchema
|
|
from helpers.login_helpers import get_login_details
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/newendpoint", status_code=200, response_model=LoginSchema)
|
|
async def get_login(
|
|
db: Session = Depends(get_db)
|
|
):
|
|
login_details = get_login_details(db)
|
|
if not login_details:
|
|
raise HTTPException(
|
|
status_code=status.HTTP_404_NOT_FOUND,
|
|
detail="Login details not found"
|
|
)
|
|
return login_details |