Files
panel/src/app/api/all-project-tasks/route.js
RKWojs c1bb4c44fd feat: upgrade next-auth to v5.0.0-beta.29 and refactor authentication middleware
- Updated next-auth dependency in package.json to version 5.0.0-beta.29.
- Refactored create-admin script to use a valid email format.
- Implemented authentication middleware for various API routes to enforce access control.
- Refactored API route handlers to improve readability and maintainability.
- Enhanced error handling in authentication error page.
- Added detailed tests for authentication flow, including protected routes and NextAuth endpoints.
2025-06-25 12:32:13 +02:00

20 lines
565 B
JavaScript

import { getAllProjectTasks } from "@/lib/queries/tasks";
import { NextResponse } from "next/server";
import { withReadAuth } from "@/lib/middleware/auth";
// GET: Get all project tasks across all projects
async function getAllProjectTasksHandler() {
try {
const tasks = getAllProjectTasks();
return NextResponse.json(tasks);
} catch (error) {
return NextResponse.json(
{ error: "Failed to fetch all project tasks" },
{ status: 500 }
);
}
}
// Protected routes - require authentication
export const GET = withReadAuth(getAllProjectTasksHandler);