Aggiunge la sezione Notifiche in admin e converte la dashboard a tab

Nuovo endpoint admin-only /api/public/notifiche-attive per contare e
elencare i giocatori con almeno un dispositivo iscritto alle notifiche
push. La dashboard admin passa da sezioni impilate a un menu a pillole
scorrevole (BarraSottosezioni), come già fatto in Classifica e Squadra.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-10 14:23:30 +02:00
co-authored by Claude Sonnet 5
parent e99d853987
commit d8fc6ef04f
4 changed files with 153 additions and 54 deletions
+25
View File
@@ -0,0 +1,25 @@
import { createFileRoute } from "@tanstack/react-router";
import { richiediAdmin } from "@/lib/auth-route.server";
export const Route = createFileRoute("/api/public/notifiche-attive")({
server: {
handlers: {
GET: async ({ request }) => {
const negato = await richiediAdmin(request);
if (negato) return negato;
const { supabaseAdmin } = await import("@/integrations/supabase/client.server");
const { data, error } = await supabaseAdmin
.from("push_subscriptions")
.select("giocatore_id");
if (error) {
console.error("notifiche-attive", error);
return new Response("Errore lettura", { status: 500 });
}
const giocatoreIds = [...new Set((data ?? []).map((r) => r.giocatore_id))];
return Response.json({ giocatoreIds });
},
},
},
});