Add GET endpoint for /school
This commit is contained in:
parent
7f79bf48de
commit
d56fafabcf
@ -0,0 +1,19 @@
|
|||||||
|
# Entity: School
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from typing import List
|
||||||
|
from core.database import get_db
|
||||||
|
from models.school import School
|
||||||
|
from schemas.school import SchoolSchema
|
||||||
|
from helpers.school_helpers import get_all_schools
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/school", response_model=List[SchoolSchema], status_code=200)
|
||||||
|
async def get_schools(
|
||||||
|
db: Session = Depends(get_db)
|
||||||
|
):
|
||||||
|
"""Get all schools"""
|
||||||
|
schools = get_all_schools(db)
|
||||||
|
return schools
|
Loading…
x
Reference in New Issue
Block a user