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