import { NextRequest, NextResponse } from 'next/server' import { prisma } from '@/lib/prisma' export async function GET( request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { try { const { id } = await params const songs = await prisma.song.findMany({ where: { artistId: id, isPublic: true, }, include: { artist: { select: { id: true, name: true, slug: true, avatarUrl: true, verified: true, }, }, album: { select: { id: true, title: true, slug: true, coverUrl: true, }, }, genres: { include: { genre: true, }, }, }, orderBy: { createdAt: 'desc', }, }) return NextResponse.json(songs) } catch (error) { console.error('Error fetching artist songs:', error) return NextResponse.json({ error: 'Failed to fetch songs' }, { status: 500 }) } }