B: Added People and Credit Models for entry crew and cast
This commit is contained in:
1 parent
6bf27e5519
commit
ef9e1911f9
4 files changed
+70
-1
No files matched your search
@@ -14,6 +14,8 @@ const EntryGenre = require('../models/EntryGenre');
|
||||
const Media = require('../models/Media');
|
||||
const Network = require('../models/Network');
|
||||
const EntryNetwork = require('../models/EntryNetwork');
|
||||
const People = require('../models/People');
|
||||
const Credit = require('../models/Credit');
|
||||
|
||||
|
||||
// ? one to one
|
||||
@@ -191,4 +193,12 @@ EpisodeSeen.belongsTo(Entry, { foreignKey: 'entry_id' });
|
||||
|
||||
// * ----
|
||||
Franchise.hasMany(Entry, { foreignKey: 'franchise_id' });
|
||||
Entry.belongsTo(Franchise, { foreignKey: 'franchise_id' });
|
||||
Entry.belongsTo(Franchise, { foreignKey: 'franchise_id' });
|
||||
|
||||
// * ENTRY & Credit - ONE TO MANY
|
||||
Entry.hasMany(Credit, { foreignKey: 'entry_id', as: 'credits', onDelete: 'CASCADE', });
|
||||
Credit.belongsTo(Entry, { foreignKey: 'entry_id', as: 'entry' });
|
||||
|
||||
// * PEOPLE & CAST - ONE TO MANY
|
||||
People.hasMany(Credit, { foreignKey: 'people_id', as: 'roles', onDelete: 'CASCADE', });
|
||||
Credit.belongsTo(People, { foreignKey: 'people_id', as: 'person' });
|
||||
Reference in new issue
Block a user