Fix Edge-incompatible middleware; set Node runtime on Prisma/pg routes; add full Romanian Bible import + converter; import data JSON; resync RO bookKeys; stabilize /api/bible/books locale fallback; restart dev server.

This commit is contained in:
andupetcu
2025-09-20 18:01:04 +03:00
parent 500066450d
commit 88b251c100
28 changed files with 127926 additions and 175 deletions

View File

@@ -1,6 +1,8 @@
import { NextRequest, NextResponse } from 'next/server'
import { prisma } from '@/lib/db'
export const runtime = 'nodejs'
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url)
@@ -18,18 +20,27 @@ export async function GET(request: NextRequest) {
)
}
// Find the chapter
// Find the chapter (bookId is now a string UUID)
const chapterRecord = await prisma.bibleChapter.findFirst({
where: {
bookId: parseInt(bookId),
bookId: bookId,
chapterNum: parseInt(chapter)
},
include: {
book: {
include: {
version: true
}
}
}
})
if (!chapterRecord) {
return NextResponse.json({
success: true,
verses: []
verses: [],
book: null,
chapter: null
})
}
@@ -45,6 +56,22 @@ export async function GET(request: NextRequest) {
return NextResponse.json({
success: true,
book: {
id: chapterRecord.book.id,
name: chapterRecord.book.name,
testament: chapterRecord.book.testament,
orderNum: chapterRecord.book.orderNum
},
chapter: {
id: chapterRecord.id,
chapterNum: chapterRecord.chapterNum
},
version: {
id: chapterRecord.book.version.id,
name: chapterRecord.book.version.name,
abbreviation: chapterRecord.book.version.abbreviation,
language: chapterRecord.book.version.language
},
verses: verses.map(verse => ({
id: verse.id,
verseNum: verse.verseNum,
@@ -62,4 +89,4 @@ export async function GET(request: NextRequest) {
{ status: 500 }
)
}
}
}