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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user