Update code in endpoints/newendpoint.get.py
This commit is contained in:
parent
d50aff29df
commit
6ce6c98a49
@ -0,0 +1,21 @@
|
|||||||
|
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
|
Loading…
x
Reference in New Issue
Block a user