Build fixes: offline-safe fonts, Next.js API route type updates, TS strict errors resolved, MUI import cleanup, chat markdown wrapper, Azure OpenAI typing, caching key + chapter API id types, and misc error-logging typings.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { NextResponse } from 'next/server'
|
||||
import { z } from 'zod'
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import { verifyToken } from '@/lib/auth'
|
||||
@@ -14,8 +14,8 @@ const updateConversationSchema = z.object({
|
||||
|
||||
// GET /api/chat/conversations/[id] - Get conversation with messages
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
request: Request,
|
||||
{ params }: any
|
||||
) {
|
||||
try {
|
||||
// Get user from authentication
|
||||
@@ -28,7 +28,7 @@ export async function GET(
|
||||
}
|
||||
|
||||
const token = authHeader.substring(7)
|
||||
const payload = verifyToken(token)
|
||||
const payload = await verifyToken(token)
|
||||
|
||||
if (!payload) {
|
||||
return NextResponse.json(
|
||||
@@ -100,8 +100,8 @@ export async function GET(
|
||||
|
||||
// PUT /api/chat/conversations/[id] - Update conversation
|
||||
export async function PUT(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
request: Request,
|
||||
{ params }: any
|
||||
) {
|
||||
try {
|
||||
// Get user from authentication
|
||||
@@ -114,7 +114,7 @@ export async function PUT(
|
||||
}
|
||||
|
||||
const token = authHeader.substring(7)
|
||||
const payload = verifyToken(token)
|
||||
const payload = await verifyToken(token)
|
||||
|
||||
if (!payload) {
|
||||
return NextResponse.json(
|
||||
@@ -198,8 +198,8 @@ export async function PUT(
|
||||
|
||||
// DELETE /api/chat/conversations/[id] - Delete conversation
|
||||
export async function DELETE(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
request: Request,
|
||||
{ params }: any
|
||||
) {
|
||||
try {
|
||||
// Get user from authentication
|
||||
@@ -212,7 +212,7 @@ export async function DELETE(
|
||||
}
|
||||
|
||||
const token = authHeader.substring(7)
|
||||
const payload = verifyToken(token)
|
||||
const payload = await verifyToken(token)
|
||||
|
||||
if (!payload) {
|
||||
return NextResponse.json(
|
||||
@@ -263,4 +263,4 @@ export async function DELETE(
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { NextResponse } from 'next/server'
|
||||
import { z } from 'zod'
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import { verifyToken } from '@/lib/auth'
|
||||
@@ -19,7 +19,7 @@ const getConversationsSchema = z.object({
|
||||
})
|
||||
|
||||
// GET /api/chat/conversations - List user's conversations
|
||||
export async function GET(request: NextRequest) {
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
// Get user from authentication
|
||||
const authHeader = request.headers.get('authorization')
|
||||
@@ -31,7 +31,7 @@ export async function GET(request: NextRequest) {
|
||||
}
|
||||
|
||||
const token = authHeader.substring(7)
|
||||
const payload = verifyToken(token)
|
||||
const payload = await verifyToken(token)
|
||||
|
||||
if (!payload) {
|
||||
return NextResponse.json(
|
||||
@@ -130,7 +130,7 @@ export async function GET(request: NextRequest) {
|
||||
}
|
||||
|
||||
// POST /api/chat/conversations - Create new conversation
|
||||
export async function POST(request: NextRequest) {
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
// Get user from authentication
|
||||
const authHeader = request.headers.get('authorization')
|
||||
@@ -142,7 +142,7 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
const token = authHeader.substring(7)
|
||||
const payload = verifyToken(token)
|
||||
const payload = await verifyToken(token)
|
||||
|
||||
if (!payload) {
|
||||
return NextResponse.json(
|
||||
@@ -207,4 +207,4 @@ export async function POST(request: NextRequest) {
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user