summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/Admin/Handlers.py
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-15 08:47:02 -0500
committerBen Sima <ben@bensima.com>2025-12-15 08:47:02 -0500
commit0baab1972e30c0e4629e67152838e660b02a2537 (patch)
treed82d9402e4a0840777ee3d4e39ab4329f246918b /Biz/PodcastItLater/Admin/Handlers.py
parentadf693eb82cddd2c383cdebd3392716446ddf054 (diff)
t-265.6: Add feedback collection endpoint for PIL
- Add feedback table with migration in Core.py - Add FeedbackForm and FeedbackPage UI components - Add /feedback GET/POST routes and /api/feedback JSON endpoint - Add admin feedback view at /admin/feedback - Create Omni/Agent/Tools/Feedback.hs with feedback_list tool - Wire feedback tool into Telegram agent
Diffstat (limited to 'Biz/PodcastItLater/Admin/Handlers.py')
-rw-r--r--Biz/PodcastItLater/Admin/Handlers.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Biz/PodcastItLater/Admin/Handlers.py b/Biz/PodcastItLater/Admin/Handlers.py
index b98c551..9e06fe6 100644
--- a/Biz/PodcastItLater/Admin/Handlers.py
+++ b/Biz/PodcastItLater/Admin/Handlers.py
@@ -296,3 +296,31 @@ def admin_metrics(request: Request) -> Views.MetricsDashboard | Response:
metrics = Core.Database.get_metrics_summary()
return Views.MetricsDashboard(metrics=metrics, user=user)
+
+
+def admin_feedback(request: Request) -> Views.AdminFeedback | Response:
+ """Admin feedback view."""
+ # Check if user is logged in and is admin
+ user_id = request.session.get("user_id")
+ if not user_id:
+ return Response(
+ "",
+ status_code=302,
+ headers={"Location": "/"},
+ )
+
+ user = Core.Database.get_user_by_id(
+ user_id,
+ )
+ if not user or not Core.is_admin(user):
+ return Response(
+ "",
+ status_code=302,
+ headers={"Location": "/?error=forbidden"},
+ )
+
+ # Get feedback data
+ feedback = Core.Database.get_feedback(limit=100)
+ count = Core.Database.get_feedback_count()
+
+ return Views.AdminFeedback(feedback=feedback, count=count, user=user)