import { applyNameOverrides } from '../pg-models/pg-sql-gen-utils'; import { RelationsTable } from '../pg-models/tables'; import { ContentEntityModelPostprocessor } from './content-entity-model-postprocessor'; import { findEntityModel } from './postprocessing-utils'; export const tvshowPostprocessor: ContentEntityModelPostprocessor = ( mainModel, otherModels, options, ) => { const tvshowGenreModel = findEntityModel(otherModels, 'tvshow_genre'); applyNameOverrides(mainModel, { cast: ['tvshow_cast', 'cast'], }); mainModel.relatedObjects.push( new RelationsTable( options, mainModel.contentEntity, [tvshowGenreModel.contentEntity], 'genres', [ { name: 'order_no', type: 'INTEGER', options: { extraParams: 'NOT NULL DEFAULT 0', indexable: true }, }, ], ), ); };