diff --git a/src/app/dashboard/users/[id]/page.tsx b/src/app/dashboard/users/[id]/page.tsx index f5c1c6f..603daf0 100644 --- a/src/app/dashboard/users/[id]/page.tsx +++ b/src/app/dashboard/users/[id]/page.tsx @@ -109,7 +109,14 @@ export default function UserDetailPage() { const docsWithUrls = await Promise.all( docs.map(async (doc) => { try { - const url = await uploadService.getPresignedDownloadUrl(doc.key); + // The S3 key is stored in 'id' field from the upload service + // or in 'key' field if explicitly set. Fall back to id if key is missing. + const fileKey = doc.key || doc.id; + if (!fileKey || fileKey.startsWith('http')) { + // If no key or already a URL, return document as-is + return doc; + } + const url = await uploadService.getPresignedDownloadUrl(fileKey); return { ...doc, url }; } catch { return doc; diff --git a/src/services/users.service.ts b/src/services/users.service.ts index 4eb4976..7838853 100644 --- a/src/services/users.service.ts +++ b/src/services/users.service.ts @@ -11,7 +11,8 @@ export interface AgentType { } export interface VerificationDocument { - key: string; + id?: string; // S3 key is stored in id field from upload service + key?: string; // Alternative S3 key field name: string; size: number; type: string;