Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gender: String,
hairColor: String,
starships: [String],
});
// set discriminator Key
CharacterSchema.set('discriminatorKey', DKey);
// create base Model
export const CharacterModel = mongoose.model('Character', CharacterSchema);
// create mongoose discriminator models
export const DroidModel = CharacterModel.discriminator(enumCharacterType.DROID, DroidSchema);
export const PersonModel = CharacterModel.discriminator(enumCharacterType.PERSON, PersonSchema);
export const CharacterDTC = composeWithMongooseDiscriminators(CharacterModel, {
schemaComposer,
});
type DroidT = any;
export const DroidTC: ObjectTypeComposer = CharacterDTC.discriminator(
DroidModel
);
type PersonT = any;
export const PersonTC: ObjectTypeComposer = CharacterDTC.discriminator(
PersonModel
);