From 260a3b78fe9e73e6c558650d93ed3e705c56a7e5 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 16:57:31 +0000 Subject: [PATCH] Add GET endpoint for /endpint --- endpoints/endpint.get.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/endpoints/endpint.get.py b/endpoints/endpint.get.py index e69de29..8178976 100644 --- a/endpoints/endpint.get.py +++ b/endpoints/endpint.get.py @@ -0,0 +1,18 @@ +# Entity: Color + +from fastapi import APIRouter, Depends, HTTPException, status +from sqlalchemy.orm import Session +from typing import List +from core.database import get_db +from models.color import Color +from schemas.color import ColorSchema + +router = APIRouter() + +@router.get("/endpoint", response_model=List[ColorSchema], status_code=200) +async def get_colors( + db: Session = Depends(get_db) +): + """Get all colors""" + colors = db.query(Color).all() + return colors \ No newline at end of file