forked from DebaucheryLibrarian/traxxx
Changed release media association existence check, added log for details.
This commit is contained in:
parent
8cdc794a3a
commit
90bc2f3724
|
@ -17,10 +17,11 @@
|
|||
"vue/html-indent": ["error", "tab"],
|
||||
"vue/multiline-html-element-content-newline": 0,
|
||||
"vue/singleline-html-element-content-newline": 0,
|
||||
"vue/multi-word-component-names": 0,
|
||||
"no-param-reassign": ["error", {
|
||||
"props": true,
|
||||
"ignorePropertyModificationsFor": ["state", "acc"]
|
||||
}],
|
||||
}]
|
||||
},
|
||||
"globals": {
|
||||
"CONFIG": true
|
||||
|
|
|
@ -153,8 +153,8 @@ async function fetchEntity(scroll = true) {
|
|||
|
||||
this.pageTitle = entity.name;
|
||||
|
||||
const campaign = entity.campaigns.find(campaignX => !campaignX.banner)
|
||||
|| entity.parent?.campaigns.find(campaignX => !campaignX.banner);
|
||||
const campaign = entity.campaigns.find((campaignX) => !campaignX.banner)
|
||||
|| entity.parent?.campaigns.find((campaignX) => !campaignX.banner);
|
||||
|
||||
const affiliateParams = new URLSearchParams({
|
||||
...(entity.url && Object.fromEntries(new URL(entity.url).searchParams)), // preserve any query in entity URL, e.g. ?siteId=5
|
||||
|
|
19
src/media.js
19
src/media.js
|
@ -826,11 +826,12 @@ async function associateReleaseMedia(releases, type = 'release') {
|
|||
.reduce((acc, [releaseId, releaseBaseMedias]) => {
|
||||
releaseBaseMedias.forEach((baseMedia) => {
|
||||
const media = storedMediasById[baseMedia.id];
|
||||
const mediaId = media?.use || media?.entry?.id;
|
||||
|
||||
if (media) {
|
||||
if (mediaId) {
|
||||
acc.push({
|
||||
[`${type}_id`]: releaseId,
|
||||
media_id: media.use || media.entry.id,
|
||||
media_id: mediaId,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -839,11 +840,19 @@ async function associateReleaseMedia(releases, type = 'release') {
|
|||
}, [])
|
||||
.filter(Boolean);
|
||||
|
||||
if (associations.length > 0) {
|
||||
await bulkInsert(`${type}s_${role}`, associations, false);
|
||||
try {
|
||||
if (associations.length > 0) {
|
||||
await bulkInsert(`${type}s_${role}`, associations, false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(associations);
|
||||
throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(util.inspect(error.entries, null, null, { color: true }));
|
||||
if (error.entries) {
|
||||
logger.error(util.inspect(error.entries, null, null, { color: true }));
|
||||
}
|
||||
|
||||
logger.error(`Failed to store ${type} ${role}: ${error.message}`);
|
||||
}
|
||||
}, Promise.resolve());
|
||||
|
|
Loading…
Reference in New Issue