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

@@ -2,6 +2,7 @@ import { z } from 'zod'
import { router, observerProcedure } from '../trpc'
import { normalizeCountryToCode } from '@/lib/countries'
import { getUserAvatarUrl } from '../utils/avatar-url'
import { getProjectLogoUrl } from '../utils/project-logo-url'
import { aggregateVotes } from '../services/deliberation'
const editionOrRoundInput = z.object({
@@ -1020,6 +1021,8 @@ export const analyticsRouter = router({
teamName: true,
status: true,
country: true,
logoKey: true,
logoProvider: true,
assignments: {
select: {
roundId: true,
@@ -1048,7 +1051,7 @@ export const analyticsRouter = router({
ctx.prisma.project.count({ where }),
])
const mapped = projects.map((p) => {
const mapped = await Promise.all(projects.map(async (p) => {
const submitted = p.assignments
.map((a) => a.evaluation)
.filter((e) => e?.status === 'SUBMITTED')
@@ -1080,6 +1083,8 @@ export const analyticsRouter = router({
else if (drafts.length > 0) observerStatus = 'UNDER_REVIEW'
else observerStatus = 'NOT_REVIEWED'
const logoUrl = await getProjectLogoUrl(p.logoKey, p.logoProvider)
return {
id: p.id,
title: p.title,
@@ -1087,12 +1092,13 @@ export const analyticsRouter = router({
status: p.status,
observerStatus,
country: p.country,
logoUrl,
roundId: furthestRoundState?.round?.id ?? roundAssignment?.round?.id ?? '',
roundName: furthestRoundState?.round?.name ?? roundAssignment?.round?.name ?? '',
averageScore,
evaluationCount: submitted.length,
}
})
}))
// Filter by observer-derived status in JS
const observerStatusFilter = input.status && OBSERVER_DERIVED_STATUSES.includes(input.status)