import { Column , Entity , ManyToOne } from 'typeorm' ; import Doctor from './Doctor' ; import Patient from './Patient' ; /**
 * The Appointment model is a "junction model". It represents the many-to-many relationship between Doctor and Patient.
 * In this app, there is data related to this relationship (the date of the appointment), so this data gets added to
 * this model as a Column.
 *
 * This model is the many side of the one-to-many relationships it has with the Doctor and Patient models.
 */ @ Entity ( ) export default class Appointment { @ Column ( ) date : Date ; @ ManyToOne ( type => Doctor , doctor => doctor . appointments , { primary : true , nullable : false } ) doctor : Doctor ; @ ManyToOne ( type => Patient , patient => patient . appointments , { primary : true , nullable : false } ) patient : Patient ; }