Add GET endpoint for interns
This commit is contained in:
parent
b35f3fc5fc
commit
bc1062046c
17
endpoints/interns.get.py
Normal file
17
endpoints/interns.get.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Entity: Intern
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Depends, status
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from typing import List
|
||||||
|
from core.database import get_db
|
||||||
|
from core.models.intern import Intern
|
||||||
|
from core.schemas.intern import InternSchema
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/interns", status_code=200, response_model=List[InternSchema])
|
||||||
|
async def get_interns(
|
||||||
|
db: Session = Depends(get_db)
|
||||||
|
):
|
||||||
|
interns = db.query(Intern).all()
|
||||||
|
return interns
|
Loading…
x
Reference in New Issue
Block a user