fix: bayat dev-mock raporlar tek kapıdan (kullanicininRaporu) ayıklanıyor
All checks were successful
Deploy / deploy (push) Successful in 9m25s
All checks were successful
Deploy / deploy (push) Successful in 9m25s
Dev'de API anahtarı yokken üretilen mock rapor DB'ye kaydediliyordu; anahtar sonradan eklenince kullanıcı başına tek rapor kuralı yüzünden o bayat mock gerçek AI çıktısıymış gibi servis edilmeye devam ediyordu. Rapor tablosunu okuyan her yer (sonuc/listem/yazdir/odeme-sonuc sayfaları, liste action'ları, soru API'si, dev panel) artık src/lib/rapor-kaydi.ts içindeki kullanicininRaporu() kapısından geçiyor: gerçek AI aktifken mock üretimi kayıt "yok" sayılır, kullanıcı gerçek listeyi yeniden üretir. Yeni mock kayıtlar devMock işareti taşır; eskiler metin ön ekinden tanınır. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { and, eq, sql } from "drizzle-orm";
|
||||
import { getSession, getCurrentUser } from "@/lib/session";
|
||||
import { appDb, schema } from "@/lib/appdb";
|
||||
import { kullanicininRaporu } from "@/lib/rapor-kaydi";
|
||||
import { PUAN_TURLERI, type PuanTuruKey } from "@/lib/db";
|
||||
import {
|
||||
spendCredits,
|
||||
@@ -145,9 +146,7 @@ export async function listeOlustur(input: {
|
||||
"Önceki denemen başarısız olduğu için kredin iade edilmişti. Tekrar dener misin?",
|
||||
};
|
||||
}
|
||||
const mevcut = await appDb.query.reports.findFirst({
|
||||
where: eq(schema.reports.userId, user.id),
|
||||
});
|
||||
const mevcut = await kullanicininRaporu(user.id);
|
||||
if (mevcut?.result) {
|
||||
const rapor = mevcut.result as RaporSonuc;
|
||||
return {
|
||||
@@ -225,9 +224,7 @@ export async function listeRevize(input: {
|
||||
return { ok: false, code: "HATA", error: "Geçersiz istek." };
|
||||
}
|
||||
|
||||
const rapor = await appDb.query.reports.findFirst({
|
||||
where: eq(schema.reports.userId, user.id),
|
||||
});
|
||||
const rapor = await kullanicininRaporu(user.id);
|
||||
if (!rapor?.result) {
|
||||
return { ok: false, code: "HATA", error: "Önce bir liste oluşturmalısın." };
|
||||
}
|
||||
@@ -274,9 +271,7 @@ export async function listeRevize(input: {
|
||||
"Önceki denemen başarısız olduğu için kredin iade edilmişti. Tekrar dener misin?",
|
||||
};
|
||||
}
|
||||
const guncel = await appDb.query.reports.findFirst({
|
||||
where: eq(schema.reports.userId, user.id),
|
||||
});
|
||||
const guncel = await kullanicininRaporu(user.id);
|
||||
if (guncel?.result) {
|
||||
return {
|
||||
ok: true,
|
||||
|
||||
Reference in New Issue
Block a user