17 lines
494 B
JavaScript
17 lines
494 B
JavaScript
function toIsoString(value) {
|
|
return value instanceof Date ? value.toISOString() : value;
|
|
}
|
|
|
|
export function toPublicListingDto(listing) {
|
|
return {
|
|
id: listing.id,
|
|
productName: listing.productName,
|
|
categoryId: listing.categoryId,
|
|
conditionId: listing.conditionId,
|
|
askingPriceMinor: listing.askingPriceMinor,
|
|
status: listing.status,
|
|
notes: listing.notes ?? null,
|
|
createdAt: toIsoString(listing.createdAt),
|
|
updatedAt: toIsoString(listing.updatedAt),
|
|
};
|
|
} |