implemented hooks for user-collections & user-collection-entry models to update updatedAt and order fields

This commit is contained in:
X4Lo committed 2024-04-30 22:21:17 +01:00
1 parent 36866dabe6
commit cea1b207a3
12 files changed
+170 -61

No files matched your search

+1 -15
View File
@@ -102,18 +102,4 @@ EpisodeSeen.belongsTo(Entry, { foreignKey: 'entry_id' });
// * ----
Franchise.hasMany(Entry, { foreignKey: 'franchise_id' });
Entry.belongsTo(Franchise, { foreignKey: 'franchise_id' });
// ! TRIGGERS
UserCollectionEntry.afterUpdate(async (instance, options) => {
await UserCollection.update(instance.user_collection_id, {
updatedAt: new Date()
})
});
UserCollectionEntry.afterDestroy(async (instance, options) => {
await UserCollection.update(instance.user_collection_id, {
updatedAt: new Date()
})
});
Entry.belongsTo(Franchise, { foreignKey: 'franchise_id' });