Update package.json scripts, enhance layout with new components, and improve API error handling
Some checks failed
Deploy / deploy (push) Failing after 1h28m6s

- Added new scripts for database operations and temporary production in package.json.
- Integrated KaydetBannerLazy component into the layout for improved user notifications.
- Enhanced API error handling in the soru route to mark credit exhaustion.
- Updated the IletisimPage for better button styling and user experience.
- Refactored ListemPage to streamline user flow and improve session handling.
- Removed unused ListePaneli component to clean up the codebase.
This commit is contained in:
bilalgursen
2026-08-06 02:27:42 +03:00
parent 488845ae1f
commit e62c6f07df
77 changed files with 4132 additions and 1659 deletions

View File

@@ -1,4 +1,4 @@
import { and, eq, gte, sql } from "drizzle-orm";
import { and, eq, gte, isNull, sql } from "drizzle-orm";
import { appDb, schema } from "./appdb";
const { user, creditLedger, chatMessages } = schema;
@@ -139,6 +139,8 @@ export async function grantCredits(opts: {
.set({
creditBalance: sql`${user.creditBalance} + ${opts.delta}`,
...(opts.setHasPaket ? { hasPaket: true } : {}),
// Kredi gelince bekleyen kredi-bitti hatırlatması iptal olur
krediBittiAt: null,
updatedAt: new Date(),
})
.where(eq(user.id, opts.userId));
@@ -150,3 +152,26 @@ export async function grantCredits(opts: {
throw err;
}
}
/**
* Kredi-bitti anını işaretler (48 saatlik hatırlatma e-postasının saati).
* Yalnızca ilk bitişte yazar (kolon doluysa no-op) ve hatırlatma zaten
* gönderildiyse yeniden kurmaz — e-posta ömür boyu 1 kez. Hata yolunda
* çağrıldığı için asla throw etmez.
*/
export async function krediBittiIsaretle(userId: string): Promise<void> {
try {
await appDb
.update(user)
.set({ krediBittiAt: new Date() })
.where(
and(
eq(user.id, userId),
isNull(user.krediBittiAt),
isNull(user.krediHatirlatmaGonderildiAt),
),
);
} catch (err) {
console.error(`[kredi] kredi-bitti işaretlenemedi (${userId}):`, err);
}
}