Skip to content

Commit bd6b450

Browse files
authored
Merge pull request #18 from ryan-roche/dev
v1.2
2 parents 3fb213f + 9814a14 commit bd6b450

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/main.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class RouteResponseModel(BaseModel):
9494
app = FastAPI(
9595
title="GopherMaps API",
9696
summary="REST API for the GopherMaps Project",
97-
version="1.1",
97+
version="1.2",
9898
contact={
9999
"name": "Ryan Roche",
100100
"url": "https://socialcoding.net"
@@ -289,6 +289,25 @@ async def get_buildings_by_area(
289289

290290
return building_entries
291291

292+
@app.get("/buildings/all", tags=["Buildings"], operation_id="getAllBuildings")
293+
async def get_all_buildings() -> list[BuildingEntryModel]:
294+
"""
295+
Retrieves information for ALL Buildings
296+
"""
297+
with driver.session() as session:
298+
query = """
299+
MATCH (n:BuildingKey) RETURN n
300+
"""
301+
result = session.run(query)
302+
303+
results: List[Dict[str, Any]] = result.data()
304+
305+
# Use list comprehension to unwrap nodes and create BuildingEntryModel instances
306+
building_entries: List[BuildingEntryModel] = [
307+
BuildingEntryModel(**record['n']) for record in results
308+
]
309+
310+
return building_entries
292311

293312
@app.get("/destinations/{building}", tags=["Routing"], operation_id="getDestinationsForBuilding")
294313
async def get_destinations_for_building(

0 commit comments

Comments
 (0)