Add GET endpoint for /endpint

This commit is contained in:
Backend IM Bot 2025-03-26 16:57:31 +00:00
parent ba29d7e14e
commit 260a3b78fe

View File

@ -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