random changes
This commit is contained in:
1 parent
5008940c59
commit
d06a21097f
7 files changed
+27
-61
No files matched your search
@@ -81,7 +81,6 @@ UserCollectionEntry.afterDestroy(async (instance, options) => {
|
||||
name: sequelize.literal('name')
|
||||
}
|
||||
|
||||
// ? updating collection poster
|
||||
const collectionsEntries = await UserCollectionEntry.findAll({
|
||||
where: {
|
||||
user_collection_id: instance.user_collection_id
|
||||
@@ -91,14 +90,15 @@ UserCollectionEntry.afterDestroy(async (instance, options) => {
|
||||
]
|
||||
})
|
||||
|
||||
// ? updating collection poster
|
||||
// ? remove the poster if the collection is empty now
|
||||
if (collectionsEntries.length == 0) {
|
||||
updates.poster = null;
|
||||
} else {
|
||||
// todo add is customPoster field
|
||||
if (userCollection.poster_path == entry.poster_path) {
|
||||
updates.poster_path = collectionsEntries[0].entry.poster_path;
|
||||
}
|
||||
// ? replace poster it belonged to the removed entry
|
||||
// if (userCollection.poster_path == entry.poster_path) {
|
||||
// updates.poster_path = collectionsEntries[0].entry.poster_path;
|
||||
// }
|
||||
}
|
||||
|
||||
// ? updating order, only if the removed entry isn't placed at the end
|
||||
|
||||
Reference in new issue
Block a user