HotTRDealsBackend/adapters/requests/dealCreate.adapter.js
2026-01-20 12:16:14 +00:00

33 lines
653 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function mapCreateDealRequestToDealCreateData(
data,
userId
) {
return {
title: data.title,
description: data.description ?? null,
url: data.url ?? null,
price: data.price ?? null,
// 🔑 adapter burada sellerı “custom” gibi yazar
// service bunu düzeltecek
customCompany: data.sellerName,
user: {
connect: { id: userId },
},
images: data.images?.length
? {
create: data.images.map((imgUrl, index) => ({
imageUrl: imgUrl,
order: index,
})),
}
: undefined,
}
}
module.exports = {
mapCreateDealRequestToDealCreateData,
}