feat: implement chat history deletion functionality
All checks were successful
Deploy / deploy (push) Successful in 8m4s
All checks were successful
Deploy / deploy (push) Successful in 8m4s
Added a new DELETE endpoint to allow users to clear their chat history. This functionality ensures that while the chat messages are removed, any credits spent remain intact. Additionally, updated the ListemGovde component to reflect changes in user preferences and integrated a modal for notifying users about preference changes. Enhanced the SohbetClient component to include a button for clearing chat history, improving user experience and interface clarity.
This commit is contained in:
@@ -105,6 +105,20 @@ export async function GET() {
|
||||
});
|
||||
}
|
||||
|
||||
// Kullanıcının sohbet geçmişini siler. Kredi iadesi YOK: harcanan krediler
|
||||
// ledger'da kalır, yalnızca mesajlar temizlenir (bir sonraki soruda danışman
|
||||
// sıfırdan başlar; liste/özet bağlamı prompt'tan geldiği için korunur).
|
||||
export async function DELETE() {
|
||||
const session = await getSession();
|
||||
if (!session) {
|
||||
return Response.json({ error: "Oturum gerekli." }, { status: 401 });
|
||||
}
|
||||
await appDb
|
||||
.delete(schema.chatMessages)
|
||||
.where(eq(schema.chatMessages.userId, session.user.id));
|
||||
return Response.json({ ok: true });
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
// Oturum ve gövde ayrıştırma bağımsız — paralel başlar, hata önceliği aynı
|
||||
// kalır (önce 401, sonra 400).
|
||||
|
||||
Reference in New Issue
Block a user