import type { AdminMedia } from '@admin/types' export function mapMediaRow(row: { id: string url: string filename: string contentType: string size: number width: number | null height: number | null alt: string | null tags: string[] | null createdAt: string updatedAt: string createdBy: string | null updatedBy: string | null createdByUser: { id: string | null name: string | null email: string | null } | null updatedByUser: { id: string | null name: string | null email: string | null } | null }): AdminMedia { return { id: row.id, url: row.url, filename: row.filename, contentType: row.contentType, size: row.size, width: row.width, height: row.height, alt: row.alt, tags: row.tags, createdAt: row.createdAt, updatedAt: row.updatedAt, createdBy: row.createdBy, updatedBy: row.updatedBy, createdByUser: row.createdByUser?.id ? { id: row.createdByUser.id, name: row.createdByUser.name ?? '', email: row.createdByUser.email ?? '' } : null, updatedByUser: row.updatedByUser?.id ? { id: row.updatedByUser.id, name: row.updatedByUser.name ?? '', email: row.updatedByUser.email ?? '' } : null } }