17 lines
498 B
Python
17 lines
498 B
Python
from typing import List
|
|
from sqlalchemy.orm import Session
|
|
from core.models.car import Car
|
|
from core.schemas.car import CarSchema
|
|
|
|
def get_german_cars(db: Session) -> List[CarSchema]:
|
|
"""
|
|
Retrieves a list of German cars from the database.
|
|
|
|
Args:
|
|
db (Session): The database session.
|
|
|
|
Returns:
|
|
List[CarSchema]: A list of German car objects.
|
|
"""
|
|
german_cars = db.query(Car).filter(Car.is_german).all()
|
|
return [CarSchema.from_orm(car) for car in german_cars] |