Compare commits
2 Commits
dev
...
fix/lifecy
| Author | SHA1 | Date | |
|---|---|---|---|
| 462da4b2c1 | |||
| a0d7e736a4 |
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,
|
"when": 1790332800000,
|
||||||
"tag": "0037_rpartstore_decodes",
|
"tag": "0037_rpartstore_decodes",
|
||||||
"breakpoints": true
|
"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(),
|
status: varchar("status", { length: 20 }).default("active").notNull(),
|
||||||
statusReason: text("status_reason"),
|
statusReason: text("status_reason"),
|
||||||
statusChangedAt: timestamp("status_changed_at", { withTimezone: true }),
|
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 }),
|
referralCode: varchar("referral_code", { length: 20 }),
|
||||||
referredBy: uuid("referred_by"),
|
referredBy: uuid("referred_by"),
|
||||||
// Reward days earned via referrals that couldn't be applied to a live
|
// 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
|
// Süper Panel impersonation: when set, this session was created by the
|
||||||
// founder via /internal/admin/users/:id/impersonate-readonly.
|
// founder via /internal/admin/users/:id/impersonate-readonly.
|
||||||
// ImpersonationReadonlyGuard enforces the readonly contract.
|
// 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(),
|
impersonationReadonly: boolean("impersonation_readonly").default(false).notNull(),
|
||||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
|
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
|
||||||
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),
|
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),
|
||||||
|
|||||||
Reference in New Issue
Block a user