import { Heatmap } from '@koh/common' ; import { Exclude } from 'class-transformer' ; import { BaseEntity , Column , Entity , JoinColumn , ManyToOne , OneToMany , PrimaryGeneratedColumn , } from 'typeorm' ; import { AlertModel } from '../alerts/alerts.entity' ; import { EventModel } from '../profile/event-model.entity' ; import { UserCourseModel } from '../profile/user-course.entity' ; import { QueueModel } from '../queue/queue.entity' ; import { SemesterModel } from '../semester/semester.entity' ; import { OfficeHourModel } from './office-hour.entity' ; @ Entity ( 'course_model' ) export class CourseModel extends BaseEntity { @ PrimaryGeneratedColumn ( ) id : number ; @ OneToMany ( ( type ) => OfficeHourModel , ( oh ) => oh . course ) officeHours : OfficeHourModel [ ] ; @ OneToMany ( ( type ) => QueueModel , ( q ) => q . course ) queues : QueueModel [ ] ; @ Column ( 'text' ) name : string ; @ Column ( 'text' , { nullable : true } ) sectionGroupName : string ; @ Column ( 'text' , { nullable : true } ) coordinator_email : string ; @ Column ( 'text' , { nullable : true } ) @ Exclude ( ) icalURL : string ; @ OneToMany ( ( type ) => UserCourseModel , ( ucm ) => ucm . course ) @ Exclude ( ) userCourses : UserCourseModel ; @ ManyToOne ( ( type ) => SemesterModel , ( semester ) => semester . courses ) @ JoinColumn ( { name : 'semesterId' } ) @ Exclude ( ) semester : SemesterModel ; @ Column ( { nullable : true } ) @ Exclude ( ) semesterId : number ; @ Column ( 'boolean' , { nullable : true } ) enabled : boolean ; heatmap : Heatmap | false ; @ Column ( 'text' , { nullable : true } ) timezone : string ; @ OneToMany ( ( type ) => EventModel , ( event ) => event . course ) @ Exclude ( ) events : EventModel [ ] ; @ OneToMany ( ( type ) => AlertModel , ( alert ) => alert . course ) @ Exclude ( ) alerts : AlertModel [ ] ; @ Column ( 'boolean' , { nullable : true , default : false } ) selfEnroll : boolean ; }