18 lines
475 B
Python
18 lines
475 B
Python
# 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 |