44 add_pagination_wrapper , ordered_jsonify )
55from backend .database .models .user import UserRole
66from backend .database .models .agency import Unit
7- from backend .routes .search import fetch_details , build_unit_result , build_officer_result
7+ from backend .routes .search import (
8+ fetch_details , build_unit_result , build_officer_result )
89from flask import Blueprint , abort , request , jsonify
910from flask_jwt_extended .view_decorators import jwt_required
1011from backend .dto .unit import UnitQueryParams , GetUnitParams
2324
2425LOCATION_CYPHER = """
2526CALL (u) {
26- MATCH (u)-[]-(:Agency)-[]-(city:CityNode)-[]-(:CountyNode)-[]-(state:StateNode)
27+ MATCH (u)-[]-(:Agency)-[]-(city:CityNode)-[]-(:CountyNode)
28+ -[]-(state:StateNode)
2729 RETURN {
2830 coords: city.coordinates,
2931 city: city.name,
5860CALL (u) {
5961 OPTIONAL MATCH (u)<-[]-(:Employment)-[]->(:Officer)
6062 -[:ACCUSED_OF]->(a:Allegation)-[:ALLEGED]-(c:Complaint)
61- WITH count(DISTINCT c) AS total_complaints, count(DISTINCT a) AS total_allegations
63+ WITH
64+ count(DISTINCT c) AS total_complaints,
65+ count(DISTINCT a) AS total_allegations
6266 RETURN total_complaints, total_allegations
6367}
6468"""
6569
70+
6671@bp .route ("" , methods = ["GET" ])
6772@jwt_required ()
6873@min_role_required (UserRole .PUBLIC )
@@ -177,7 +182,9 @@ def get_unit(uid: str):
177182 item .model_dump () for item in officers if item
178183 ]
179184 for item in item_dump :
180- item ["last_updated" ] = item ["last_updated" ].isoformat () if item .get ("last_updated" , None ) else None
185+ item ["last_updated" ] = item [
186+ "last_updated" ].isoformat () if item .get (
187+ "last_updated" , None ) else None
181188 unit_data ["most_reported_officers" ] = item_dump
182189 idx += 1
183190 if "total_officers" in params .include :
@@ -195,4 +202,4 @@ def get_unit(uid: str):
195202 "city" : loc ["city" ],
196203 "state" : loc ["state" ]
197204 } if loc and loc .get ("coords" , None ) else None
198- return ordered_jsonify (unit_data ), 200
205+ return ordered_jsonify (unit_data ), 200
0 commit comments