Back: reworked the media/entry relation

This commit is contained in:
X4Lo committed 2024-09-10 21:32:46 +01:00
1 parent d06a21097f
commit b42e055691
5 files changed
+41 -30

No files matched your search

@@ -130,12 +130,13 @@ async function saveEntry(data) {
// ? cast
// ? images
// ? media
const downloadedImages = await getEntryMedia(data.id, is_tvseries);
console.log(`entry service, downloaded images: `, downloadedImages)
for (const image of downloadedImages) {
await Media.create({
entryId: savedEntry.id,
mediaable: 'entry',
mediaableId: savedEntry.id,
type: image.type,
path: image.path,
isLocal: true,
@@ -528,7 +529,8 @@ async function refrechEntry(entryId) {
if (downloadedImages) {
for (const image of downloadedImages) {
await Media.create({
entryId: oldEntry.id,
mediaable: 'entry',
mediaableId: oldEntry.id,
type: image.type,
path: image.path,
isLocal: true,