feat: resolve project logo URLs server-side, show logos in admin + observer
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m30s

Add attachProjectLogoUrls utility mirroring avatar URL pattern. Pipe
project.list and analytics.getAllProjects through logo URL resolver so
ProjectLogo components receive presigned URLs. Add logos to observer
projects table and mobile cards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 13:29:54 +01:00
parent a39e27f6ff
commit 267d26581d
5 changed files with 919 additions and 41 deletions

View File

@@ -0,0 +1,35 @@
import { createStorageProvider, type StorageProviderType } from '@/lib/storage'
/**
* Generate a pre-signed download URL for a project logo.
* Returns null if the project has no logo.
*/
export async function getProjectLogoUrl(
logoKey: string | null | undefined,
logoProvider: string | null | undefined
): Promise<string | null> {
if (!logoKey) return null
try {
const providerType = (logoProvider as StorageProviderType) || 's3'
const provider = createStorageProvider(providerType)
return await provider.getDownloadUrl(logoKey)
} catch {
return null
}
}
/**
* Batch-generate logo URLs for multiple projects.
* Adds `logoUrl` field to each project object.
*/
export async function attachProjectLogoUrls<
T extends { logoKey?: string | null; logoProvider?: string | null }
>(projects: T[]): Promise<(T & { logoUrl: string | null })[]> {
return Promise.all(
projects.map(async (project) => ({
...project,
logoUrl: await getProjectLogoUrl(project.logoKey, project.logoProvider),
}))
)
}