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:
2026-01-20 21:09:29 +01:00
parent 7932fe7386
commit cd05fc8648
177 changed files with 5042 additions and 5541 deletions

View File

@@ -1,44 +1,43 @@
import { type NextRequest, NextResponse } from "next/server";
import { fetchAndParseCsv } from "../../../../lib/csvFetcher";
import { processQueuedImports } from "../../../../lib/importProcessor";
import { prisma } from "../../../../lib/prisma";
import { neonAuth } from "@/lib/auth/server";
import { fetchAndParseCsv } from "@/lib/csvFetcher";
import { processQueuedImports } from "@/lib/importProcessor";
import { prisma } from "@/lib/prisma";
export const dynamic = "force-dynamic";
// MIGRATED: Removed "export const dynamic = 'force-dynamic'" - dynamic by default with Cache Components
export async function POST(request: NextRequest) {
try {
const body = await request.json();
let { companyId } = body;
if (!companyId) {
// Try to get user from prisma based on session cookie
try {
const session = await prisma.session.findFirst({
orderBy: { createdAt: "desc" },
where: {
/* Add session check criteria here */
},
});
if (session) {
companyId = session.companyId;
}
} catch (error) {
// Log error for server-side debugging
const errorMessage =
error instanceof Error ? error.message : String(error);
// Use a server-side logging approach instead of console
process.stderr.write(`Error fetching session: ${errorMessage}\n`);
}
// Authenticate user
const { session: authSession, user: authUser } = await neonAuth();
if (!authSession || !authUser?.email) {
return NextResponse.json({ error: "Not logged in" }, { status: 401 });
}
if (!companyId) {
// Look up user to get companyId and role
const user = await prisma.user.findUnique({
where: { email: authUser.email },
select: { companyId: true, role: true },
});
if (!user || !user.companyId) {
return NextResponse.json(
{ error: "Company ID is required" },
{ status: 400 }
{ error: "User not found or no company" },
{ status: 401 }
);
}
// Check if user has ADMIN role
if (user.role !== "ADMIN") {
return NextResponse.json(
{ error: "Admin access required" },
{ status: 403 }
);
}
// Use user's companyId from auth (ignore any body params for security)
const companyId = user.companyId;
const company = await prisma.company.findUnique({
where: { id: companyId },
});