refactor: migrate authentication to NextAuth and clean up related services
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { TeamReviewService } from "@/services/team-review-service";
|
||||
import { AuthService } from "@/services/auth-service";
|
||||
import { auth } from "@/auth";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
// Vérifier l'authentification
|
||||
const { userProfile } = await AuthService.requireAuthenticatedUser();
|
||||
const session = await auth();
|
||||
|
||||
if (!session?.user) {
|
||||
return NextResponse.json(
|
||||
{ error: "Non authentifié" },
|
||||
{ status: 401 }
|
||||
);
|
||||
}
|
||||
|
||||
const teamId = userProfile.teamId;
|
||||
const teamId = session.user.teamId;
|
||||
const data = await TeamReviewService.getTeamReviewData(teamId);
|
||||
|
||||
return NextResponse.json(data);
|
||||
|
||||
Reference in New Issue
Block a user