import { NextResponse } from "next/server"; import { SkillsService } from "@/services"; import { SkillCategory } from "@/lib/types"; export async function GET() { try { const skillCategories = await SkillsService.getSkillCategories(); return NextResponse.json(skillCategories); } catch (error) { console.error("Error loading skills:", error); return NextResponse.json( { error: "Failed to load skills" }, { status: 500 } ); } } export async function POST(request: Request) { try { const categoryData: { id: string; name: string; icon: string } = await request.json(); // Validate required fields if (!categoryData.id || !categoryData.name || !categoryData.icon) { return NextResponse.json( { error: "Missing required fields: id, name, icon" }, { status: 400 } ); } await SkillsService.createSkillCategory(categoryData); return NextResponse.json({ success: true }, { status: 201 }); } catch (error) { console.error("Error creating skill category:", error); return NextResponse.json( { error: "Failed to create skill category" }, { status: 500 } ); } }