fix(internal-admin): founderId uuid → text (status_changed_by, impersonated_by)
Some checks are pending
QA Gate (P0/P1) / Test affected app (pull_request) Waiting to run
Some checks are pending
QA Gate (P0/P1) / Test affected app (pull_request) Waiting to run
Süper Panel lifecycle (suspend/ban/reactivate) ve readonly impersonation aksiyonları founderId olarak panelin Better Auth kullanıcı ID'sini (32 karakter nanoid) gönderiyor; users.status_changed_by ve sessions.impersonated_by uuid olduğu için Postgres "invalid input syntax for type uuid" ile 500 dönüyordu — panelden askıya alma hiç çalışmadı, impersonation da hiç başarılı olmamış (sessions.impersonated_by tümü NULL). İki alan da FK'sız salt audit → text. Migration 0038 (0035 numarası main'de dunning tarafından alınmıştı; eski PR #257 dalı rebase edildi). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ww3tfpuxBcettz81dDvyYt
This commit is contained in:
7
apps/api/drizzle/0038_founder_id_text.sql
Normal file
7
apps/api/drizzle/0038_founder_id_text.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Süper Panel admin aksiyonları founderId olarak panelin Better Auth
|
||||
-- kullanıcı ID'sini (32 karakter nanoid, ör. d17M1M3S6c…) gönderiyor; uuid
|
||||
-- kolonlar bunu reddedip suspend/ban'ı ve readonly impersonation'ı 500 ile
|
||||
-- düşürüyordu ("invalid input syntax for type uuid"). İki alan da FK'sız salt
|
||||
-- audit → text. Mevcut UUID değerleri USING ile aynen korunur.
|
||||
ALTER TABLE "users" ALTER COLUMN "status_changed_by" TYPE text USING "status_changed_by"::text;
|
||||
ALTER TABLE "sessions" ALTER COLUMN "impersonated_by" TYPE text USING "impersonated_by"::text;
|
||||
@@ -267,6 +267,13 @@
|
||||
"when": 1790332800000,
|
||||
"tag": "0037_rpartstore_decodes",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 38,
|
||||
"version": "7",
|
||||
"when": 1790415663270,
|
||||
"tag": "0038_founder_id_text",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,9 @@ export const users = pgTable(
|
||||
status: varchar("status", { length: 20 }).default("active").notNull(),
|
||||
statusReason: text("status_reason"),
|
||||
statusChangedAt: timestamp("status_changed_at", { withTimezone: true }),
|
||||
statusChangedBy: uuid("status_changed_by"),
|
||||
// Süper Panel founder ID'si (Better Auth nanoid) — sase users.id UUID'si
|
||||
// DEĞİL, o yüzden text. FK yok; salt audit alanı.
|
||||
statusChangedBy: text("status_changed_by"),
|
||||
referralCode: varchar("referral_code", { length: 20 }),
|
||||
referredBy: uuid("referred_by"),
|
||||
// Reward days earned via referrals that couldn't be applied to a live
|
||||
@@ -68,7 +70,8 @@ export const sessions = pgTable(
|
||||
// Süper Panel impersonation: when set, this session was created by the
|
||||
// founder via /internal/admin/users/:id/impersonate-readonly.
|
||||
// ImpersonationReadonlyGuard enforces the readonly contract.
|
||||
impersonatedBy: uuid("impersonated_by"),
|
||||
// Süper Panel founder ID'si (Better Auth nanoid), sase users.id değil → text.
|
||||
impersonatedBy: text("impersonated_by"),
|
||||
impersonationReadonly: boolean("impersonation_readonly").default(false).notNull(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),
|
||||
|
||||
Reference in New Issue
Block a user