Skip to content

Instantly share code, notes, and snippets.

View Jonahbkerr's full-sized avatar

Jonahbkerr

  • Joined Feb 9, 2026
View GitHub Profile
import { query } from './db';
import { logger } from './logger';
/**
* Runs idempotent migrations on startup.
* Safe to execute on every boot — all statements use IF NOT EXISTS / IF EXISTS.
*/
export async function runStartupMigrations(): Promise<void> {
logger.info('Running startup migrations...');
@Jonahbkerr
Jonahbkerr / types.ts
Created February 23, 2026 01:26
types.ts for Replit deploy
export interface User {
id: string;
email: string;
name: string;
avatar_url: string | null;
provider: 'github' | 'google' | 'okta' | 'apple' | 'internal';
provider_id: string;
organization_id: string | null;
created_at: Date;
last_login: Date | null;
@Jonahbkerr
Jonahbkerr / debug-patch.patch
Created February 12, 2026 17:26
Debug: add version marker and raw admin value to /auth/user response
diff --git a/backend/src/db.ts b/backend/src/db.ts
index bc067d8..9fa21e9 100644
--- a/backend/src/db.ts
+++ b/backend/src/db.ts
@@ -6,7 +6,7 @@ const pool = new Pool({
connectionString: process.env.DATABASE_URL,
max: 20,
idleTimeoutMillis: 30000,
- connectionTimeoutMillis: 2000,
+ connectionTimeoutMillis: 10000,
@Jonahbkerr
Jonahbkerr / fix-admin-check.patch
Created February 12, 2026 16:58
Fix: use already-loaded user data for admin check instead of redundant DB query
diff --git a/backend/src/routes/auth.ts b/backend/src/routes/auth.ts
index 2aef333..51bdb83 100644
--- a/backend/src/routes/auth.ts
+++ b/backend/src/routes/auth.ts
@@ -369,17 +369,8 @@ router.post(
router.get('/user', authenticate, async (req, res) => {
const authReq = req as unknown as AuthenticatedRequest;
- // Check if user is a platform admin
- let is_platform_admin = false;
@Jonahbkerr
Jonahbkerr / fix-platform-login.patch
Created February 12, 2026 16:51
Fix platform dashboard login: increase DB timeout + eliminate redundant admin query
diff --git a/backend/src/db.ts b/backend/src/db.ts
index bc067d8..9fa21e9 100644
--- a/backend/src/db.ts
+++ b/backend/src/db.ts
@@ -6,7 +6,7 @@ const pool = new Pool({
connectionString: process.env.DATABASE_URL,
max: 20,
idleTimeoutMillis: 30000,
- connectionTimeoutMillis: 2000,
+ connectionTimeoutMillis: 10000,