Quality / test (push) Canceled after 0s
Expose public condition labels and safe market values on listing details, with Storybook coverage for market value presentation.
22 lines
746 B
JavaScript
22 lines
746 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,
|
|
conditionName: listing.conditionName ?? null,
|
|
conditionCode: listing.conditionCode ?? null,
|
|
askingPriceMinor: listing.askingPriceMinor,
|
|
marketValueMinor: listing.marketValueMinor ?? null,
|
|
marketValueCurrency: listing.marketValueCurrency ?? null,
|
|
status: listing.status,
|
|
notes: listing.notes ?? null,
|
|
images: listing.images ?? [],
|
|
createdAt: toIsoString(listing.createdAt),
|
|
updatedAt: toIsoString(listing.updatedAt),
|
|
};
|
|
} |