Spaces:
Sleeping
Sleeping
| import { | |
| Entity, | |
| PrimaryGeneratedColumn, | |
| Column, | |
| ManyToOne, | |
| OneToMany, | |
| JoinColumn, | |
| CreateDateColumn, | |
| UpdateDateColumn, | |
| Index, | |
| } from 'typeorm'; | |
| import type { Relation } from 'typeorm'; | |
| import { SubmissionType, AssignmentStatus } from '../enums'; | |
| import type { Course } from '../../courses/entities/course.entity'; | |
| import type { User } from '../../auth/entities/user.entity'; | |
| import type { AssignmentSubmission } from './assignment-submission.entity'; | |
| ('assignments') | |
| (['courseId']) | |
| (['createdBy']) | |
| (['status']) | |
| export class Assignment { | |
| ('increment', { | |
| name: 'assignment_id', | |
| type: 'bigint', | |
| unsigned: true, | |
| }) | |
| id: number; | |
| ({ | |
| type: 'bigint', | |
| unsigned: true, | |
| nullable: false, | |
| name: 'course_id', | |
| }) | |
| courseId: number; | |
| ({ | |
| type: 'varchar', | |
| length: 255, | |
| nullable: false, | |
| name: 'title', | |
| }) | |
| title: string; | |
| ({ | |
| type: 'text', | |
| nullable: true, | |
| name: 'description', | |
| }) | |
| description: string | null; | |
| ({ | |
| type: 'text', | |
| nullable: true, | |
| name: 'instructions', | |
| }) | |
| instructions: string | null; | |
| ({ | |
| type: 'decimal', | |
| precision: 5, | |
| scale: 2, | |
| default: 100.0, | |
| name: 'max_score', | |
| }) | |
| maxScore: number; | |
| ({ | |
| type: 'decimal', | |
| precision: 5, | |
| scale: 2, | |
| default: 0.0, | |
| name: 'weight', | |
| }) | |
| weight: number; | |
| ({ | |
| type: 'timestamp', | |
| nullable: true, | |
| name: 'due_date', | |
| }) | |
| dueDate: Date | null; | |
| ({ | |
| type: 'timestamp', | |
| nullable: true, | |
| name: 'available_from', | |
| }) | |
| availableFrom: Date | null; | |
| ({ | |
| type: 'tinyint', | |
| width: 1, | |
| default: 0, | |
| name: 'late_submission_allowed', | |
| }) | |
| lateSubmissionAllowed: number; | |
| ({ | |
| type: 'decimal', | |
| precision: 5, | |
| scale: 2, | |
| default: 0.0, | |
| name: 'late_penalty_percent', | |
| }) | |
| latePenaltyPercent: number; | |
| ({ | |
| type: 'enum', | |
| enum: SubmissionType, | |
| default: SubmissionType.FILE, | |
| name: 'submission_type', | |
| }) | |
| submissionType: SubmissionType; | |
| ({ | |
| type: 'int', | |
| default: 10, | |
| name: 'max_file_size_mb', | |
| }) | |
| maxFileSizeMb: number; | |
| ({ | |
| type: 'longtext', | |
| nullable: true, | |
| name: 'allowed_file_types', | |
| }) | |
| allowedFileTypes: string | null; | |
| ({ | |
| type: 'enum', | |
| enum: AssignmentStatus, | |
| default: AssignmentStatus.DRAFT, | |
| name: 'status', | |
| }) | |
| status: AssignmentStatus; | |
| ({ | |
| type: 'bigint', | |
| unsigned: true, | |
| nullable: false, | |
| name: 'created_by', | |
| }) | |
| createdBy: number; | |
| ({ | |
| name: 'created_at', | |
| }) | |
| createdAt: Date; | |
| ({ | |
| name: 'updated_at', | |
| }) | |
| updatedAt: Date; | |
| ('Course', { | |
| onDelete: 'CASCADE', | |
| }) | |
| ({ name: 'course_id' }) | |
| course: Relation<Course>; | |
| ('User', { | |
| onDelete: 'CASCADE', | |
| }) | |
| ({ name: 'created_by' }) | |
| creator: Relation<User>; | |
| ('AssignmentSubmission', 'assignment') | |
| submissions: Relation<AssignmentSubmission>[]; | |
| } | |