Skip to content
Snippets Groups Projects
Commit 137c1866 authored by Antoine Gaudron-Desjardins's avatar Antoine Gaudron-Desjardins
Browse files

linting

parent 7337d9bc
No related branches found
No related tags found
1 merge request!6Ci
...@@ -7,7 +7,8 @@ from db import models, schemas ...@@ -7,7 +7,8 @@ from db import models, schemas
def get_records(place: str, db: Session): def get_records(place: str, db: Session):
""" Get all the records for the given place """ """ Get all the records for the given place """
records = db.query(models.Records).filter(models.Records.place == place).order_by(models.Records.date.desc()).all() records = db.query(models.Records).filter(
models.Records.place == place).order_by(models.Records.date.desc()).all()
return records return records
......
...@@ -15,4 +15,3 @@ engine = create_engine(SQLALCHEMY_DATABASE_URL) ...@@ -15,4 +15,3 @@ engine = create_engine(SQLALCHEMY_DATABASE_URL)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base() Base = declarative_base()
...@@ -8,10 +8,13 @@ from pydantic import BaseModel, Field ...@@ -8,10 +8,13 @@ from pydantic import BaseModel, Field
class RecordBase(BaseModel): class RecordBase(BaseModel):
"""Records base schema""" """Records base schema"""
place: str = Field(..., title="Name of the RU corresponding the given record") place: str = Field(...,
title="Name of the RU corresponding the given record")
date: datetime = Field(..., title="Date of the record") date: datetime = Field(..., title="Date of the record")
density: float = Field(..., title="Estimated density of people") density: float = Field(..., title="Estimated density of people")
waiting_time: Optional[timedelta] = Field(title="Estimated waiting time for people coming at this date") waiting_time: Optional[timedelta] = Field(
title="Estimated waiting time for people coming at this date")
class Record(RecordBase): class Record(RecordBase):
"""Database records schema""" """Database records schema"""
......
...@@ -25,6 +25,7 @@ app.add_middleware( ...@@ -25,6 +25,7 @@ app.add_middleware(
allow_headers=["*"] allow_headers=["*"]
) )
def get_db(): def get_db():
"""Create a database session.""" """Create a database session."""
db = database.SessionLocal() db = database.SessionLocal()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment