const { ListingImages } = require('../models');

exports.saveListingImages = (listingId, files) => {
	const imagePromises =
		files?.map((file) =>
			ListingImages.create({
				listing_id: listingId,
				image: file.file,
			}),
		) || [];
	return Promise.all(imagePromises);
};
