chore: atualizações de dependências, lint fixes e ajustes menores

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Felipe Coutinho
2026-02-15 21:35:39 +00:00
parent 2362a70b9d
commit b9f788312c
35 changed files with 637 additions and 824 deletions

View File

@@ -1,4 +1,4 @@
import { desc, eq } from "drizzle-orm";
import { and, desc, eq, isNull } from "drizzle-orm";
import { headers } from "next/headers";
import { NextResponse } from "next/server";
import { tokensApi } from "@/db/schema";
@@ -15,7 +15,7 @@ export async function GET() {
}
// Buscar tokens ativos do usuário
const tokens = await db
const activeTokens = await db
.select({
id: tokensApi.id,
name: tokensApi.name,
@@ -26,14 +26,11 @@ export async function GET() {
createdAt: tokensApi.createdAt,
})
.from(tokensApi)
.where(eq(tokensApi.userId, session.user.id))
.where(
and(eq(tokensApi.userId, session.user.id), isNull(tokensApi.revokedAt)),
)
.orderBy(desc(tokensApi.createdAt));
// Separar tokens ativos e revogados
const activeTokens = tokens.filter(
(t) => !t.expiresAt || new Date(t.expiresAt) > new Date(),
);
return NextResponse.json({ tokens: activeTokens });
} catch (error) {
console.error("[API] Error listing device tokens:", error);

View File

@@ -36,8 +36,7 @@ export async function GET() {
name: "OpenSheets",
version: APP_VERSION,
timestamp: new Date().toISOString(),
message:
error instanceof Error ? error.message : "Database connection failed",
message: "Database connection failed",
},
{ status: 503 },
);