diff --git a/src/app/api/history/route.ts b/src/app/api/get_paginated_history/route.ts similarity index 100% rename from src/app/api/history/route.ts rename to src/app/api/get_paginated_history/route.ts diff --git a/src/app/api/technicians/route.ts b/src/app/api/get_technicians/route.ts similarity index 72% rename from src/app/api/technicians/route.ts rename to src/app/api/get_technicians/route.ts index 97179db..39fda6b 100644 --- a/src/app/api/technicians/route.ts +++ b/src/app/api/get_technicians/route.ts @@ -3,12 +3,6 @@ import { NextResponse } from 'next/server'; import { getEmployees } from '~/server/functions'; import { auth } from '~/auth'; -type Technician = { - name: string; - status: string; - updatedAt: Date; -}; - export const GET = async (request: Request) => { try { const session = await auth(); @@ -22,12 +16,7 @@ export const GET = async (request: Request) => { ); else { const employees = await getEmployees(); - const formattedEmployees = employees.map((employee: Technician) => ({ - name: employee.name, - status: employee.status, - time: employee.updatedAt - })); - return NextResponse.json(formattedEmployees, { status: 200 }); + return NextResponse.json(employees, { status: 200 }); } } else { const employees = await getEmployees(); diff --git a/src/app/api/update_technicians/route.ts b/src/app/api/update_status_by_name/route.ts similarity index 100% rename from src/app/api/update_technicians/route.ts rename to src/app/api/update_status_by_name/route.ts diff --git a/src/components/ui/Tech_Table.tsx b/src/components/ui/Tech_Table.tsx index 2debc3f..7eb10fa 100644 --- a/src/components/ui/Tech_Table.tsx +++ b/src/components/ui/Tech_Table.tsx @@ -22,7 +22,7 @@ export default function Tech_Table({ employees }: { employees: Employee[] }) { const [employeeData, setEmployeeData] = useState(employees); const fetch_employees = useCallback(async (): Promise => { - const res = await fetch('/api/technicians', { + const res = await fetch('/api/get_technicians', { method: 'GET', headers: { 'Authorization': `Bearer ${process.env.API_KEY}`