Add complete Biblical Guide web application with Material UI
Implemented comprehensive Romanian Biblical Guide web app: - Next.js 15 with App Router and TypeScript - Material UI 7.3.2 for modern, responsive design - PostgreSQL database with Prisma ORM - Complete Bible reader with book/chapter navigation - AI-powered biblical chat with Romanian responses - Prayer wall for community prayer requests - Advanced Bible search with filters and highlighting - Sample Bible data imported from API.Bible - All API endpoints created and working - Professional Material UI components throughout - Responsive layout with navigation and theme 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
65
app/api/bible/verses/route.ts
Normal file
65
app/api/bible/verses/route.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { prisma } from '@/lib/db'
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = new URL(request.url)
|
||||
const bookId = searchParams.get('bookId')
|
||||
const chapter = searchParams.get('chapter')
|
||||
|
||||
if (!bookId || !chapter) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
error: 'Missing bookId or chapter parameter',
|
||||
verses: []
|
||||
},
|
||||
{ status: 400 }
|
||||
)
|
||||
}
|
||||
|
||||
// Find the chapter
|
||||
const chapterRecord = await prisma.bibleChapter.findFirst({
|
||||
where: {
|
||||
bookId: parseInt(bookId),
|
||||
chapterNum: parseInt(chapter)
|
||||
}
|
||||
})
|
||||
|
||||
if (!chapterRecord) {
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
verses: []
|
||||
})
|
||||
}
|
||||
|
||||
// Get verses for this chapter
|
||||
const verses = await prisma.bibleVerse.findMany({
|
||||
where: {
|
||||
chapterId: chapterRecord.id
|
||||
},
|
||||
orderBy: {
|
||||
verseNum: 'asc'
|
||||
}
|
||||
})
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
verses: verses.map(verse => ({
|
||||
id: verse.id,
|
||||
verseNum: verse.verseNum,
|
||||
text: verse.text
|
||||
}))
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Error fetching verses:', error)
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
error: 'Failed to fetch verses',
|
||||
verses: []
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user