Major overhaul to the Notes/Issues. Minor tweaks to the UI. Added Profile photos

This commit is contained in:
2026-02-19 06:30:57 +02:00
parent a9a1531d57
commit f09979c653
21 changed files with 988 additions and 308 deletions

View File

@@ -6,7 +6,7 @@ from equipment.models import NoteCreate, NoteUpdate, NoteInDB
COLLECTION = "equipment_notes"
VALID_CATEGORIES = {"general", "maintenance", "installation", "issue", "other"}
VALID_CATEGORIES = {"general", "maintenance", "installation", "issue", "action_item", "other"}
def _convert_firestore_value(val):
@@ -81,7 +81,10 @@ def list_notes(
if user_id:
query = query.where("user_id", "==", user_id)
query = query.order_by("created_at", direction="DESCENDING")
# Only use order_by when no field filters are applied (avoids composite index requirement)
has_field_filters = bool(category or device_id or user_id)
if not has_field_filters:
query = query.order_by("created_at", direction="DESCENDING")
docs = query.stream()
results = []
@@ -98,6 +101,10 @@ def list_notes(
results.append(note)
# Sort client-side when we couldn't use order_by
if has_field_filters:
results.sort(key=lambda n: n.created_at or "", reverse=True)
return results