build fix
This commit is contained in:
parent
70a921b0f5
commit
5873bb771f
@ -26,8 +26,9 @@ import { prisma } from "@/lib/prisma";
|
|||||||
*/
|
*/
|
||||||
export async function GET(
|
export async function GET(
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { id: string; eventId: string } }
|
props: { params: Promise<{ id: string; eventId: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session?.user?.username) {
|
if (!session?.user?.username) {
|
||||||
@ -105,8 +106,9 @@ export async function GET(
|
|||||||
*/
|
*/
|
||||||
export async function PUT(
|
export async function PUT(
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { id: string; eventId: string } }
|
props: { params: Promise<{ id: string; eventId: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session?.user?.username) {
|
if (!session?.user?.username) {
|
||||||
@ -208,8 +210,9 @@ export async function PUT(
|
|||||||
*/
|
*/
|
||||||
export async function DELETE(
|
export async function DELETE(
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { id: string; eventId: string } }
|
props: { params: Promise<{ id: string; eventId: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session?.user?.username) {
|
if (!session?.user?.username) {
|
||||||
|
|||||||
@ -24,10 +24,8 @@ import { prisma } from "@/lib/prisma";
|
|||||||
* - 404: Calendar not found.
|
* - 404: Calendar not found.
|
||||||
* - 500: Server error occurred while retrieving events.
|
* - 500: Server error occurred while retrieving events.
|
||||||
*/
|
*/
|
||||||
export async function GET(
|
export async function GET(req: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
req: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session?.user?.username) {
|
if (!session?.user?.username) {
|
||||||
@ -105,10 +103,8 @@ export async function GET(
|
|||||||
* @throws {400} If the required fields (title, start, end) are missing.
|
* @throws {400} If the required fields (title, start, end) are missing.
|
||||||
* @throws {500} If there is a server error during event creation.
|
* @throws {500} If there is a server error during event creation.
|
||||||
*/
|
*/
|
||||||
export async function POST(
|
export async function POST(req: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
req: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session?.user?.username) {
|
if (!session?.user?.username) {
|
||||||
|
|||||||
@ -5,10 +5,8 @@ import { prisma } from "@/lib/prisma";
|
|||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
|
|
||||||
// Non testé, généré automatiquement par IA
|
// Non testé, généré automatiquement par IA
|
||||||
export async function POST(
|
export async function POST(req: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
req: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session?.user?.username) {
|
if (!session?.user?.username) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { invalidateEmailContentCache, invalidateFolderCache } from '@/lib/redis'
|
|||||||
|
|
||||||
export async function POST(
|
export async function POST(
|
||||||
request: Request,
|
request: Request,
|
||||||
context: { params: { id: string } }
|
context: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ const invalidateCache = (userId: string, folder?: string) => {
|
|||||||
// Mark email as read
|
// Mark email as read
|
||||||
export async function POST(
|
export async function POST(
|
||||||
request: Request,
|
request: Request,
|
||||||
context: { params: { id: string } }
|
context: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import { getCachedEmailContent, invalidateEmailContentCache } from '@/lib/redis'
|
|||||||
|
|
||||||
export async function GET(
|
export async function GET(
|
||||||
request: Request,
|
request: Request,
|
||||||
context: { params: { id: string } }
|
context: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
@ -73,7 +73,7 @@ export async function GET(
|
|||||||
// Add a route to mark email as read
|
// Add a route to mark email as read
|
||||||
export async function POST(
|
export async function POST(
|
||||||
request: Request,
|
request: Request,
|
||||||
context: { params: { id: string } }
|
context: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|||||||
@ -3,10 +3,8 @@ import { getServerSession } from "next-auth/next";
|
|||||||
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(req: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
req: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session?.user?.id) {
|
if (!session?.user?.id) {
|
||||||
|
|||||||
@ -2,10 +2,8 @@ import { getServerSession } from "next-auth/next";
|
|||||||
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(req: Request, props: { params: Promise<{ groupId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { groupId: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
@ -60,10 +58,8 @@ export async function GET(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function POST(
|
export async function POST(req: Request, props: { params: Promise<{ groupId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { groupId: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
|||||||
@ -26,10 +26,8 @@ async function getAdminToken() {
|
|||||||
return data.access_token;
|
return data.access_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(req: Request, props: { params: Promise<{ groupId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { groupId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
@ -62,10 +60,8 @@ export async function GET(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PUT(
|
export async function PUT(req: Request, props: { params: Promise<{ groupId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { groupId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
@ -101,10 +97,8 @@ export async function PUT(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PATCH(
|
export async function PATCH(req: Request, props: { params: Promise<{ groupId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { groupId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
@ -140,10 +134,8 @@ export async function PATCH(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(req: Request, props: { params: Promise<{ groupId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { groupId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
|||||||
@ -21,8 +21,9 @@ async function checkAuth(request: Request) {
|
|||||||
// DELETE endpoint to remove an attachment
|
// DELETE endpoint to remove an attachment
|
||||||
export async function DELETE(
|
export async function DELETE(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { missionId: string, attachmentId: string } }
|
props: { params: Promise<{ missionId: string, attachmentId: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
try {
|
try {
|
||||||
const { authorized, userId } = await checkAuth(request);
|
const { authorized, userId } = await checkAuth(request);
|
||||||
if (!authorized || !userId) {
|
if (!authorized || !userId) {
|
||||||
|
|||||||
@ -23,8 +23,9 @@ async function checkAuth(request: Request) {
|
|||||||
// GET endpoint to download an attachment
|
// GET endpoint to download an attachment
|
||||||
export async function GET(
|
export async function GET(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { missionId: string, attachmentId: string } }
|
props: { params: Promise<{ missionId: string, attachmentId: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
try {
|
try {
|
||||||
const { authorized, userId } = await checkAuth(request);
|
const { authorized, userId } = await checkAuth(request);
|
||||||
if (!authorized || !userId) {
|
if (!authorized || !userId) {
|
||||||
|
|||||||
@ -18,10 +18,8 @@ async function checkAuth(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GET endpoint to list all attachments for a mission
|
// GET endpoint to list all attachments for a mission
|
||||||
export async function GET(
|
export async function GET(request: Request, props: { params: Promise<{ missionId: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { missionId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const { authorized, userId } = await checkAuth(request);
|
const { authorized, userId } = await checkAuth(request);
|
||||||
if (!authorized || !userId) {
|
if (!authorized || !userId) {
|
||||||
|
|||||||
@ -19,10 +19,8 @@ async function checkAuth(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GET endpoint to retrieve a mission by ID
|
// GET endpoint to retrieve a mission by ID
|
||||||
export async function GET(
|
export async function GET(request: Request, props: { params: Promise<{ missionId: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { missionId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const { authorized, userId } = await checkAuth(request);
|
const { authorized, userId } = await checkAuth(request);
|
||||||
if (!authorized || !userId) {
|
if (!authorized || !userId) {
|
||||||
@ -91,10 +89,8 @@ export async function GET(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PUT endpoint to update a mission
|
// PUT endpoint to update a mission
|
||||||
export async function PUT(
|
export async function PUT(request: Request, props: { params: Promise<{ missionId: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { missionId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const { authorized, userId } = await checkAuth(request);
|
const { authorized, userId } = await checkAuth(request);
|
||||||
if (!authorized || !userId) {
|
if (!authorized || !userId) {
|
||||||
@ -246,10 +242,8 @@ export async function PUT(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DELETE endpoint to remove a mission
|
// DELETE endpoint to remove a mission
|
||||||
export async function DELETE(
|
export async function DELETE(request: Request, props: { params: Promise<{ missionId: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { missionId: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const { authorized, userId } = await checkAuth(request);
|
const { authorized, userId } = await checkAuth(request);
|
||||||
if (!authorized || !userId) {
|
if (!authorized || !userId) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { NotificationService } from '@/lib/services/notifications/notification-s
|
|||||||
// POST /api/notifications/{id}/read
|
// POST /api/notifications/{id}/read
|
||||||
export async function POST(
|
export async function POST(
|
||||||
request: Request,
|
request: Request,
|
||||||
context: { params: { id: string } }
|
context: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
// Authenticate user
|
// Authenticate user
|
||||||
|
|||||||
@ -2,10 +2,8 @@ import { getServerSession } from "next-auth/next";
|
|||||||
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export async function PUT(
|
export async function PUT(req: Request, props: { params: Promise<{ userId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { userId: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
|||||||
@ -6,10 +6,8 @@ import { getKeycloakAdminClient } from "@/lib/keycloak";
|
|||||||
// Fix for Next.js "params should be awaited" error
|
// Fix for Next.js "params should be awaited" error
|
||||||
export const dynamic = 'force-dynamic';
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(request: Request, props: { params: Promise<{ userId?: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { userId?: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
@ -85,10 +83,8 @@ export async function GET(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PUT(
|
export async function PUT(request: Request, props: { params: Promise<{ userId?: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { userId?: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
|||||||
@ -65,7 +65,7 @@ async function deleteLeantimeUser(email: string, requestingUserId: string): Prom
|
|||||||
|
|
||||||
// Check if the requesting user has permission to delete this user
|
// Check if the requesting user has permission to delete this user
|
||||||
// This is a placeholder - implement proper permission check based on your requirements
|
// This is a placeholder - implement proper permission check based on your requirements
|
||||||
if (!await hasDeletePermission(requestingUserId, leantimeUserId)) {
|
if (!(await hasDeletePermission(requestingUserId, leantimeUserId))) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: 'Unauthorized to delete this user'
|
error: 'Unauthorized to delete this user'
|
||||||
@ -120,10 +120,8 @@ async function hasDeletePermission(requestingUserId: string, targetUserId: numbe
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(req: Request, props: { params: Promise<{ userId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { userId: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
const userId = params.userId; // Store userId from params to avoid sync access issues
|
const userId = params.userId; // Store userId from params to avoid sync access issues
|
||||||
|
|
||||||
@ -210,10 +208,8 @@ export async function DELETE(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PUT(
|
export async function PUT(req: Request, props: { params: Promise<{ userId: string }> }) {
|
||||||
req: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { userId: string } }
|
|
||||||
) {
|
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
|||||||
@ -9,10 +9,8 @@ import { simpleParser } from 'mailparser';
|
|||||||
const emailContentCache = new Map<string, { content: string, timestamp: number }>();
|
const emailContentCache = new Map<string, { content: string, timestamp: number }>();
|
||||||
const CACHE_TTL = 30 * 60 * 1000; // 30 minutes in milliseconds
|
const CACHE_TTL = 30 * 60 * 1000; // 30 minutes in milliseconds
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(request: Request, props: { params: Promise<{ id: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
console.log(`[DEBUG] GET request for single email ID: ${params.id}`);
|
console.log(`[DEBUG] GET request for single email ID: ${params.id}`);
|
||||||
|
|
||||||
@ -162,10 +160,8 @@ export async function GET(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle marking emails as read
|
// Handle marking emails as read
|
||||||
export async function POST(
|
export async function POST(request: Request, props: { params: Promise<{ id: string }> }) {
|
||||||
request: Request,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
console.log(`[DEBUG] POST request for email ID: ${params.id}`);
|
console.log(`[DEBUG] POST request for email ID: ${params.id}`);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user