Normalize to double quotes across all files with Prettier

This commit is contained in:
X4Lo committed 2026-06-21 22:28:08 +01:00
1 parent 73bff72cec
commit a5659cf4c8
190 files changed
+9523 -8859

No files matched your search

+59 -47
View File
@@ -19,7 +19,6 @@ const _mediaDownloaderService = mediaDownloaderService;
const _mediaOptimizerService = mediaOptimizerService;
class CollectionManager {
constructor() {
if (!CollectionManager.instance) {
CollectionManager.instance = this;
@@ -43,7 +42,8 @@ class CollectionManager {
}
// * 2 - insert/update collection
const [oldCollection, createdCollection] = await _collectionService.createOrUpdateCollection(collectionData);
const [oldCollection, createdCollection] =
await _collectionService.createOrUpdateCollection(collectionData);
// * 3 - link related entries to the collection
let collection = oldCollection || createdCollection;
@@ -51,57 +51,62 @@ class CollectionManager {
throw new NotFoundError("Collection not found");
}
const partIds = collectionData.parts.map(part => part.id);
const partIds = collectionData.parts.map((part) => part.id);
const entries = await Entry.findAll({
include: [{
model: EntryId,
as: 'entryId',
where: {
tmdb_id: {
[Sequelize.Op.in]: partIds
}
}
}]
include: [
{
model: EntryId,
as: "entryId",
where: {
tmdb_id: {
[Sequelize.Op.in]: partIds,
},
},
},
],
});
await collection.setEntries(entries);
// * 4 - download collection media
// ? downloading
const downloadedImages = await _mediaDownloaderService.downloadCollectionMedia(collection);
const downloadedImages =
await _mediaDownloaderService.downloadCollectionMedia(collection);
// ? generating preview & inserting data
for (const image of downloadedImages) {
// ? generating preview
_mediaOptimizerService.doGeneratePreview('collections', image.type + 's', image.path).then((result) => {
const msg = `Collection Service | Generated Collection Preview`;
console.log(msg);
logToFile(msg);
}).catch((err) => {
const msg = `Collection Service | Error Generating Collection Preview`;
console.log(msg);
console.log(err);
logToFile(msg);
logToFile(err);
});
// ? generating preview
_mediaOptimizerService
.doGeneratePreview("collections", image.type + "s", image.path)
.then((result) => {
const msg = `Collection Service | Generated Collection Preview`;
console.log(msg);
logToFile(msg);
})
.catch((err) => {
const msg = `Collection Service | Error Generating Collection Preview`;
console.log(msg);
console.log(err);
logToFile(msg);
logToFile(err);
});
// ? inserting data
await Media.create({
mediaable: 'collection',
mediaable: "collection",
mediaableId: collection.id,
type: image.type,
path: image.path,
isLocal: true,
isSelected: true
})
isSelected: true,
});
}
// * 5 - return the collection
return await _collectionService.getCollectionById(collection.id);
}
/**
* Fetches the corresponding collection for a given entry (movie) if it is missing.
* If the entry belongs to a collection, the collection is fetched and saved.
@@ -118,15 +123,16 @@ class CollectionManager {
}
const oldEntry = await Entry.findByPk(id, {
include: [
{ model: EntryId, as: 'entryId' }
]
})
include: [{ model: EntryId, as: "entryId" }],
});
if (!oldEntry) {
throw new NotFoundError("Entry not found");
}
const entryData = await fetchEntryData(oldEntry.entryId.tmdb_id, oldEntry.is_tvseries);
const entryData = await fetchEntryData(
oldEntry.entryId.tmdb_id,
oldEntry.is_tvseries,
);
if (!entryData) {
throw new InternalServerError(`Counldn't fetch data from TMDB`);
}
@@ -172,19 +178,21 @@ class CollectionManager {
// * 3 - fetch missing entries and save them and linked already
// * existing ones to the collection
const partIds = collectionData.parts.map(part => part.id);
const partIds = collectionData.parts.map((part) => part.id);
// ? get all the related entries that are already in the library
const entries = await Entry.findAll({
include: [{
model: EntryId,
as: 'entryId',
where: {
tmdb_id: {
[Sequelize.Op.in]: partIds
}
}
}]
include: [
{
model: EntryId,
as: "entryId",
where: {
tmdb_id: {
[Sequelize.Op.in]: partIds,
},
},
},
],
});
// ? link entries already existing in the library
@@ -194,8 +202,12 @@ class CollectionManager {
collectionData.parts.forEach(async (part) => {
if (entries.filter((e) => e.entryId.tmdb_id == part.id).length == 0) {
const isTvSeries = false;
const _entryManager = require('./entryManager.js');
const entry = await _entryManager.fetchAndSaveNewEntry(part.id, isTvSeries, false)
const _entryManager = require("./entryManager.js");
const entry = await _entryManager.fetchAndSaveNewEntry(
part.id,
isTvSeries,
false,
);
await collection.addEntries([entry.id]);
}
@@ -203,4 +215,4 @@ class CollectionManager {
}
}
module.exports = new CollectionManager();
module.exports = new CollectionManager();