Spaces:
Sleeping
Sleeping
| import { | |
| Entity, | |
| PrimaryGeneratedColumn, | |
| Column, | |
| ManyToOne, | |
| OneToMany, | |
| JoinColumn, | |
| CreateDateColumn, | |
| UpdateDateColumn, | |
| Index, | |
| Unique, | |
| } from 'typeorm'; | |
| import type { Relation } from 'typeorm'; | |
| import { SectionStatus } from '../enums'; | |
| import type { Course } from './course.entity'; | |
| import type { CourseSchedule } from './course-schedule.entity'; | |
| import type { Semester } from '../../campus/entities/semester.entity'; | |
| ('course_sections') | |
| (['courseId', 'semesterId', 'sectionNumber']) | |
| (['courseId', 'semesterId']) | |
| (['semesterId', 'status']) | |
| export class CourseSection { | |
| ('increment', { | |
| name: 'section_id', | |
| type: 'bigint', | |
| unsigned: true, | |
| }) | |
| id: number; | |
| ({ | |
| type: 'bigint', | |
| unsigned: true, | |
| nullable: false, | |
| name: 'course_id', | |
| }) | |
| courseId: number; | |
| ({ | |
| type: 'bigint', | |
| unsigned: true, | |
| nullable: false, | |
| name: 'semester_id', | |
| }) | |
| semesterId: number; | |
| ({ | |
| type: 'varchar', | |
| length: 50, | |
| nullable: false, | |
| name: 'section_number', | |
| }) | |
| sectionNumber: string; | |
| ({ | |
| type: 'int', | |
| nullable: false, | |
| name: 'max_capacity', | |
| }) | |
| maxCapacity: number; | |
| ({ | |
| type: 'int', | |
| default: 0, | |
| name: 'current_enrollment', | |
| }) | |
| currentEnrollment: number; | |
| ({ | |
| type: 'varchar', | |
| length: 255, | |
| nullable: true, | |
| name: 'location', | |
| }) | |
| location: string | null; | |
| ({ | |
| type: 'enum', | |
| enum: SectionStatus, | |
| default: SectionStatus.OPEN, | |
| name: 'status', | |
| }) | |
| status: SectionStatus; | |
| ({ | |
| name: 'created_at', | |
| }) | |
| createdAt: Date; | |
| ({ | |
| name: 'updated_at', | |
| }) | |
| updatedAt: Date; | |
| ('Course', 'sections', { | |
| onDelete: 'CASCADE', | |
| }) | |
| ({ name: 'course_id' }) | |
| course: Relation<Course>; | |
| ('Semester', { | |
| onDelete: 'CASCADE', | |
| }) | |
| ({ name: 'semester_id' }) | |
| semester: Relation<Semester>; | |
| ('CourseSchedule', 'section', { | |
| cascade: true, | |
| }) | |
| schedules: Relation<CourseSchedule>[]; | |
| } | |