mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-02-13 22:35:47 +01:00
fix: resolve Prettier markdown code block parsing errors
- Fix syntax errors in skills markdown files (.github/skills, .opencode/skills) - Change typescript to tsx for code blocks with JSX - Replace ellipsis (...) in array examples with valid syntax - Separate CSS from TypeScript into distinct code blocks - Convert JavaScript object examples to valid JSON in docs - Fix enum definitions with proper comma separation
This commit is contained in:
@@ -1,29 +1,19 @@
|
||||
import { type NextRequest, NextResponse } from "next/server";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "../../../../lib/auth";
|
||||
import { sessionMetrics } from "../../../../lib/metrics";
|
||||
import { prisma } from "../../../../lib/prisma";
|
||||
import type { ChatSession } from "../../../../lib/types";
|
||||
import { neonAuth } from "@/lib/auth/server";
|
||||
import { sessionMetrics } from "@/lib/metrics";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import type { ChatSession } from "@/lib/types";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
interface SessionUser {
|
||||
email: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface SessionData {
|
||||
user: SessionUser;
|
||||
}
|
||||
// MIGRATED: Removed "export const dynamic = 'force-dynamic'" - dynamic by default with Cache Components
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = (await getServerSession(authOptions)) as SessionData | null;
|
||||
if (!session?.user) {
|
||||
const { session: authSession, user: authUser } = await neonAuth();
|
||||
if (!authSession || !authUser?.email) {
|
||||
return NextResponse.json({ error: "Not logged in" }, { status: 401 });
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { email: session.user.email },
|
||||
where: { email: authUser.email },
|
||||
select: {
|
||||
id: true,
|
||||
companyId: true,
|
||||
@@ -38,8 +28,8 @@ export async function GET(request: NextRequest) {
|
||||
},
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
return NextResponse.json({ error: "No user" }, { status: 401 });
|
||||
if (!user || !user.companyId) {
|
||||
return NextResponse.json({ error: "No user or company" }, { status: 401 });
|
||||
}
|
||||
|
||||
// Get date range from query parameters
|
||||
@@ -171,7 +161,7 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
return NextResponse.json({
|
||||
metrics,
|
||||
csvUrl: user.company.csvUrl,
|
||||
csvUrl: user.company?.csvUrl,
|
||||
company: user.company,
|
||||
dateRange,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user