fix(api): createApiKey expiresIn saniye cinsinden (ms değil)

30 günlük pilot anahtarı üretimi 'expiresIn is larger than the predefined
maximum value' hatasıyla düşüyordu — plugin expiresIn'i saniye bekliyor,
gün→ms çevriliyordu.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 17:27:59 +03:00
parent 773e9c35fa
commit acadd84e4a

View File

@@ -19,7 +19,8 @@ import { InternalTokenGuard } from "../common/guards/internal-token.guard";
import { DATABASE, type Database } from "../database/database.provider";
import { apikeys, users } from "../database/schema/core";
const DAY_MS = 24 * 60 * 60 * 1000;
// better-auth createApiKey `expiresIn`'i SANİYE bekler (ms değil).
const DAY_SECONDS = 24 * 60 * 60;
/**
* Public API anahtarı yönetimi — kapalı beta döneminde anahtarlar self-service
@@ -65,7 +66,7 @@ export class ApiKeysAdminController {
userId: user.id,
name: body.name ?? `${user.email} public-api`,
prefix: body.test ? "sase_test_" : "sase_live_",
...(body.expiresInDays ? { expiresIn: body.expiresInDays * DAY_MS } : {}),
...(body.expiresInDays ? { expiresIn: body.expiresInDays * DAY_SECONDS } : {}),
...(body.rateLimitMax
? { rateLimitEnabled: true, rateLimitTimeWindow: 60_000, rateLimitMax: body.rateLimitMax }
: {}),