Skip to content

Commit 71decca

Browse files
authored
Merge pull request #18 from codeforberlin/dependabot/pip/fastapi-0.109.1
Bump fastapi from 0.65.2 to 0.109.1
2 parents 562b12b + ffd08b1 commit 71decca

File tree

4 files changed

+32
-36
lines changed

4 files changed

+32
-36
lines changed

app/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def read_schools(skip: int = 0,
8989
schools = crud.get_schools(db, skip=skip, limit=limit, filter_params=filter_params)
9090
if include_raw:
9191
return schools
92-
return [school.dict(exclude={'raw'}) for school in schools]
92+
return [school.model_dump(exclude={'raw'}) for school in schools]
9393

9494

9595
@app.get("/schools/{school_id}", response_model=schemas.School, response_model_exclude_none=True)
@@ -99,7 +99,7 @@ def read_school(school_id: str, include_raw: bool = False, db: Session = Depends
9999
raise HTTPException(status_code=404, detail="School not found")
100100
if include_raw:
101101
return db_school
102-
return db_school.dict(exclude={'raw'})
102+
return db_school.model_dump(exclude={'raw'})
103103

104104

105105
@app.get("/stats", response_model=List[schemas.Statistic])

app/schemas.py

+28-32
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Optional, List
66

77
from geoalchemy2.shape import to_shape
8-
from pydantic import BaseModel
8+
from pydantic import ConfigDict, BaseModel
99

1010
from app import models
1111

@@ -33,31 +33,29 @@ class School(BaseModel):
3333
id: str
3434
name: str
3535
address: str
36-
address2: Optional[str]
37-
city: Optional[str]
38-
director: Optional[str]
39-
email: Optional[str]
40-
fax: Optional[str]
41-
latitude: Optional[float]
42-
legal_status: Optional[str]
43-
longitude: Optional[float]
44-
phone: Optional[str]
45-
provider: Optional[str]
46-
school_type: Optional[str]
47-
website: Optional[str]
48-
zip: Optional[str]
49-
raw: Optional[dict]
50-
update_timestamp: Optional[datetime]
51-
52-
class Config:
53-
orm_mode = True
36+
address2: Optional[str] = None
37+
city: Optional[str] = None
38+
director: Optional[str] = None
39+
email: Optional[str] = None
40+
fax: Optional[str] = None
41+
latitude: Optional[float] = None
42+
legal_status: Optional[str] = None
43+
longitude: Optional[float] = None
44+
phone: Optional[str] = None
45+
provider: Optional[str] = None
46+
school_type: Optional[str] = None
47+
website: Optional[str] = None
48+
zip: Optional[str] = None
49+
raw: Optional[dict] = None
50+
update_timestamp: Optional[datetime] = None
51+
model_config = ConfigDict(from_attributes=True)
5452

5553
@staticmethod
5654
def from_db(db_entry: models.School) -> School:
5755
if not db_entry.location:
58-
return School.from_orm(db_entry)
56+
return School.model_validate(db_entry)
5957
shape = to_shape(db_entry.location)
60-
school = School.from_orm(db_entry)
58+
school = School.model_validate(db_entry)
6159
school.latitude = shape.x
6260
school.longitude = shape.y
6361
return school
@@ -66,17 +64,15 @@ def from_db(db_entry: models.School) -> School:
6664
class Statistic(BaseModel):
6765
state: State
6866
count: int
69-
70-
class Config:
71-
schema_extra = {
72-
"example": [{
73-
"name": "BE",
74-
"count": 10,
75-
},
76-
{"name": "ND",
77-
"count": 12}
78-
]
79-
}
67+
model_config = ConfigDict(json_schema_extra={
68+
"example": [{
69+
"name": "BE",
70+
"count": 10,
71+
},
72+
{"name": "ND",
73+
"count": 12}
74+
]
75+
})
8076

8177

8278
class Params(BaseModel):

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
coverage==5.4
22
factory-boy==3.2.0
33
pytest==6.2.2
4-
requests==2.31.0
4+
httpx==0.27.0

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fastapi==0.65.2
1+
fastapi==0.109.1
22
GeoAlchemy2==0.15.1
33
psycopg2==2.9.9
44
Shapely==1.7.1

0 commit comments

Comments
 (0)