Forráskód Böngészése

limit all records to doctors

Matthew Trejo 6 napja
szülő
commit
ad77154df1
2 módosított fájl, 18 hozzáadás és 2 törlés
  1. 3 1
      src/app/api/chat/report/route.ts
  2. 15 1
      src/app/appointments/page.tsx

+ 3 - 1
src/app/api/chat/report/route.ts

@@ -84,7 +84,7 @@ export async function GET(request: NextRequest) {
     const userId = searchParams.get("userId")
 
     // Construir la condición where según el rol
-    const whereClause: { userId?: string } = {}
+    const whereClause: { userId?: string; chatType?: any } = {}
 
     if (session.user.role === "ADMIN") {
       // Los admins pueden ver todos los reportes o filtrar por usuario específico
@@ -101,6 +101,8 @@ export async function GET(request: NextRequest) {
     } else {
       // Los pacientes solo pueden ver sus propios reportes
       whereClause.userId = session.user.id
+      // Los pacientes NO pueden ver reportes psicológicos
+      whereClause.chatType = { not: "PSYCHOLOGICAL" }
     }
 
     const records = await prisma.record.findMany({

+ 15 - 1
src/app/appointments/page.tsx

@@ -10,7 +10,7 @@ import { AppointmentsFilter, type AppointmentFilter } from "@/components/appoint
 import { AppointmentsGrid } from "@/components/appointments/AppointmentsGrid";
 import { Pagination } from "@/components/ui/pagination";
 import { useAppointments } from "@/hooks/useAppointments";
-import { Loader2 } from "lucide-react";
+import { Loader2, AlertTriangle } from "lucide-react";
 
 const ITEMS_PER_PAGE = 5;
 
@@ -93,6 +93,20 @@ export default function AppointmentsPage() {
           showNewButton={false}
         />
 
+        {/* Warning Banner */}
+        <div className="bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-md shadow-sm">
+          <div className="flex">
+            <div className="flex-shrink-0">
+              <AlertTriangle className="h-5 w-5 text-yellow-400" aria-hidden="true" />
+            </div>
+            <div className="ml-3">
+              <p className="text-sm text-yellow-700">
+                <span className="font-bold">Nota importante:</span> El sistema se encuentra en fase de prueba. Es posible que algunas citas agendadas no lleguen a ser aprobadas.
+              </p>
+            </div>
+          </div>
+        </div>
+
         {/* Stats */}
         <AppointmentsStats
           total={stats.total}