Fixed banner seed.

This commit is contained in:
DebaucheryLibrarian
2026-02-01 22:57:20 +01:00
parent 8438d2e3b3
commit 7386aa9da7
4 changed files with 20 additions and 9 deletions

View File

@@ -996,6 +996,10 @@ async function scan(dir) {
}
function getAffiliateId(affiliate) {
if (!affiliate) {
return null;
}
if (affiliate.id) {
return affiliate.id;
}
@@ -1030,14 +1034,15 @@ exports.seed = async (knex) => {
network: network === 'banners' ? channel : network,
channel: network === 'banners' ? null : channel,
affiliateId,
affiliate: affiliate?.id,
affiliate: getAffiliateId(affiliate),
banner,
width: Number(width),
height: Number(height),
type,
tags,
};
}).filter((banner) => !!banner.affiliate);
// }).filter((banner) => !!banner.affiliate);
});
await Promise.all([
knex('campaigns').delete(),