Normalize to double quotes across all files with Prettier
This commit is contained in:
1 parent
73bff72cec
commit
a5659cf4c8
190 files changed
+9523
-8859
No files matched your search
@@ -8,9 +8,7 @@ const Media = require("../models/Media");
|
||||
const Season = require("../models/Season");
|
||||
const UserCollectionEntry = require("../models/UserCollectionEntry");
|
||||
|
||||
|
||||
class CollectionService {
|
||||
|
||||
constructor() {
|
||||
if (!CollectionService.instance) {
|
||||
CollectionService.instance = this;
|
||||
@@ -22,12 +20,13 @@ class CollectionService {
|
||||
const collections = await Collection.findAll({
|
||||
include: [
|
||||
{
|
||||
model: Entry, as: 'entries',
|
||||
include: { model: Media, as: 'medias' }
|
||||
model: Entry,
|
||||
as: "entries",
|
||||
include: { model: Media, as: "medias" },
|
||||
},
|
||||
{ model: Media, as: 'medias' }
|
||||
{ model: Media, as: "medias" },
|
||||
],
|
||||
order: [['name', 'ASC']]
|
||||
order: [["name", "ASC"]],
|
||||
});
|
||||
|
||||
return collections;
|
||||
@@ -35,22 +34,26 @@ class CollectionService {
|
||||
|
||||
async getCollectionById(id) {
|
||||
const collection = await Collection.findByPk(id, {
|
||||
include: [{
|
||||
model: Entry,
|
||||
as: 'entries',
|
||||
include: [
|
||||
{ model: EntryId, as: 'entryId' },
|
||||
{ model: EntryRating, as: 'entryRating' },
|
||||
{ model: Season, as: 'seasons' },
|
||||
{ model: Media, as: 'medias' },
|
||||
{ model: Genre, as: 'genres' },
|
||||
],
|
||||
through: {
|
||||
model: UserCollectionEntry,
|
||||
attributes: ['order'], // attributes (to include) from the join model
|
||||
include: [
|
||||
{
|
||||
model: Entry,
|
||||
as: "entries",
|
||||
include: [
|
||||
{ model: EntryId, as: "entryId" },
|
||||
{ model: EntryRating, as: "entryRating" },
|
||||
{ model: Season, as: "seasons" },
|
||||
{ model: Media, as: "medias" },
|
||||
{ model: Genre, as: "genres" },
|
||||
],
|
||||
through: {
|
||||
model: UserCollectionEntry,
|
||||
attributes: ["order"], // attributes (to include) from the join model
|
||||
},
|
||||
},
|
||||
}],
|
||||
order: [[Sequelize.literal("`entries->UserCollectionEntry`.`order`"), 'ASC']], // sort by 'order' in ascending order
|
||||
],
|
||||
order: [
|
||||
[Sequelize.literal("`entries->UserCollectionEntry`.`order`"), "ASC"],
|
||||
], // sort by 'order' in ascending order
|
||||
});
|
||||
|
||||
return collection;
|
||||
@@ -63,12 +66,11 @@ class CollectionService {
|
||||
name: collectionData.name,
|
||||
posterPath: collectionData.poster_path,
|
||||
backdropPath: collectionData.backdrop_path,
|
||||
description: collectionData.overview
|
||||
description: collectionData.overview,
|
||||
},
|
||||
include: [{ model: Media, as: 'medias' }]
|
||||
include: [{ model: Media, as: "medias" }],
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = new CollectionService();
|
||||
module.exports = new CollectionService();
|
||||
Reference in new issue
Block a user