Files
pokemon-inventory/packages/contracts/public-product.js
T
2026-09-10 07:16:41 -04:00

24 lines
814 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 ?? [],
sellerDisplayName: product.sellerDisplayName ?? null,
sellerContactEmail: product.sellerContactEmail ?? null,
sellerContactPhone: product.sellerContactPhone ?? null,
createdAt: toIsoString(product.createdAt),
updatedAt: toIsoString(product.updatedAt),
};
}