style: clean up code formatting and remove trailing whitespace

refactor: reorganize imports and fix type imports
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:08:36 -03:00
1 parent d3704602fd
commit 47c04de6fe
232 files changed
+7140 -4798

No files matched your search

+8 -9
View File
@@ -1,7 +1,7 @@
import { NextRequest, NextResponse } from "next/server";
import { secureLogger } from "@/lib/secure-logger";
import { type NextRequest, NextResponse } from "next/server";
import { requireAuth } from "@/lib/auth/middleware";
import { markAsRead } from "@/lib/prisma/queries/notifications";
import { secureLogger } from "@/lib/secure-logger";
/**
* POST /api/notifications/[id]/read
@@ -9,7 +9,7 @@ import { markAsRead } from "@/lib/prisma/queries/notifications";
*/
export async function POST(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
{ params }: { params: Promise<{ id: string }> },
) {
try {
const authResult = await requireAuth(request);
@@ -18,10 +18,10 @@ export async function POST(
const { id } = await params;
const notificationId = parseInt(id, 10);
if (isNaN(notificationId)) {
if (Number.isNaN(notificationId)) {
return NextResponse.json(
{ success: false, error: "ID de notificação inválido" },
{ status: 400 }
{ status: 400 },
);
}
@@ -30,7 +30,7 @@ export async function POST(
if (!success) {
return NextResponse.json(
{ success: false, error: "Notificação não encontrada ou já está lida" },
{ status: 404 }
{ status: 404 },
);
}
@@ -39,7 +39,7 @@ export async function POST(
success: true,
message: "Notificação marcada como lida",
},
{ status: 200 }
{ status: 200 },
);
} catch (error) {
secureLogger.error("❌ Erro ao marcar notificação como lida", {
@@ -48,8 +48,7 @@ export async function POST(
return NextResponse.json(
{ success: false, error: "Erro ao marcar notificação como lida" },
{ status: 500 }
{ status: 500 },
);
}
}
+10 -11
View File
@@ -1,12 +1,11 @@
import { NextRequest, NextResponse } from "next/server";
import { secureLogger } from "@/lib/secure-logger";
import { type NextRequest, NextResponse } from "next/server";
import { requireAuth } from "@/lib/auth/middleware";
import {
getUserNotifications,
getUnreadCount,
markAsRead,
getUserNotifications,
markAllAsRead,
} from "@/lib/prisma/queries/notifications";
import { secureLogger } from "@/lib/secure-logger";
/**
* GET /api/notifications
@@ -25,7 +24,8 @@ export async function GET(request: NextRequest) {
: 50;
const notifications = await getUserNotifications(auth.userId, {
is_read: isRead === "true" ? true : isRead === "false" ? false : undefined,
is_read:
isRead === "true" ? true : isRead === "false" ? false : undefined,
limit,
});
@@ -37,7 +37,7 @@ export async function GET(request: NextRequest) {
notifications,
unread_count: unreadCount,
},
{ status: 200 }
{ status: 200 },
);
} catch (error) {
secureLogger.error("❌ Erro ao buscar notificações", {
@@ -47,7 +47,7 @@ export async function GET(request: NextRequest) {
return NextResponse.json(
{ success: false, error: "Erro ao buscar notificações" },
{ status: 500 }
{ status: 500 },
);
}
}
@@ -73,13 +73,13 @@ export async function POST(request: NextRequest) {
message: `${count} notificações marcadas como lidas`,
count,
},
{ status: 200 }
{ status: 200 },
);
}
return NextResponse.json(
{ success: false, error: "Ação inválida" },
{ status: 400 }
{ status: 400 },
);
} catch (error) {
secureLogger.error("❌ Erro ao marcar notificações como lidas", {
@@ -88,8 +88,7 @@ export async function POST(request: NextRequest) {
return NextResponse.json(
{ success: false, error: "Erro ao marcar notificações como lidas" },
{ status: 500 }
{ status: 500 },
);
}
}
+4 -5
View File
@@ -1,4 +1,4 @@
import { NextRequest, NextResponse } from "next/server";
import { type NextRequest, NextResponse } from "next/server";
import { requireAuth } from "@/lib/auth/middleware";
import { getUnreadCount } from "@/lib/prisma/queries/notifications";
@@ -18,13 +18,12 @@ export async function GET(request: NextRequest) {
success: true,
count,
},
{ status: 200 }
{ status: 200 },
);
} catch (error) {
} catch (_error) {
return NextResponse.json(
{ success: false, error: "Erro ao buscar contagem de notificações" },
{ status: 500 }
{ status: 500 },
);
}
}