feat: Add organization logo upload

- Add uploads router with logo upload/delete/serve endpoints
- Add logo_url column migration for organizations table
- Update /organizations/current to include logo_url
- Max 5MB, supports JPG/PNG/WebP/SVG
This commit is contained in:
2026-03-13 05:08:57 +00:00
parent 3ad71d3afc
commit 2b5910cc75
4 changed files with 172 additions and 2 deletions

View File

@@ -29,11 +29,28 @@ export async function initDB(): Promise<void> {
try {
const result = await client.queryObject`SELECT NOW()`;
console.log("✅ Database connected:", result.rows[0]);
// Run migrations
await runMigrations(client);
} finally {
client.release();
}
}
async function runMigrations(client: ReturnType<Pool["connect"]> extends Promise<infer T> ? T : never): Promise<void> {
// Add logo_url column to organizations if not exists
try {
await client.queryObject`
ALTER TABLE organizations
ADD COLUMN IF NOT EXISTS logo_url TEXT
`;
console.log("✅ Migration: logo_url column checked");
} catch (e) {
// Column might already exist, that's fine
console.log(" Migration note:", e instanceof Error ? e.message : String(e));
}
}
export function getPool(): Pool {
return pool;
}