Files
2026-09-10 07:40:18 -04:00

25 lines
872 B
JavaScript

function toIsoString(value) {
return value instanceof Date ? value.toISOString() : value;
}
export function toPublicProductDto(product) {
return {
id: product.id,
categoryId: product.categoryId,
name: product.name,
slug: product.slug,
description: product.description ?? null,
brand: product.brand ?? null,
setName: product.setName ?? null,
cardNumber: product.cardNumber ?? null,
eventName: product.eventName ?? null,
releaseYear: product.releaseYear ?? null,
tags: product.tags ?? [],
sellerDescription: product.sellerDescription ?? null,
sellerDisplayName: product.sellerDisplayName ?? null,
sellerContactEmail: product.sellerContactEmail ?? null,
sellerContactPhone: product.sellerContactPhone ?? null,
createdAt: toIsoString(product.createdAt),
updatedAt: toIsoString(product.updatedAt),
};
}