File size: 2,118 Bytes
d0c3eef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import {
  NotFoundException,
  ConflictException,
  BadRequestException,
} from '@nestjs/common';

export class CampusNotFoundException extends NotFoundException {
  constructor(id?: number) {
    super(`Campus ${id ? `with ID ${id}` : ''} not found`);
  }
}

export class DepartmentNotFoundException extends NotFoundException {
  constructor(id?: number) {
    super(`Department ${id ? `with ID ${id}` : ''} not found`);
  }
}

export class ProgramNotFoundException extends NotFoundException {
  constructor(id?: number) {
    super(`Program ${id ? `with ID ${id}` : ''} not found`);
  }
}

export class SemesterNotFoundException extends NotFoundException {
  constructor(id?: number) {
    super(`Semester ${id ? `with ID ${id}` : ''} not found`);
  }
}

export class CampusCodeAlreadyExistsException extends ConflictException {
  constructor(code: string) {
    super(`Campus code "${code}" already exists`);
  }
}

export class DepartmentCodeAlreadyExistsException extends ConflictException {
  constructor(code: string) {
    super(`Department code "${code}" already exists in this campus`);
  }
}

export class ProgramCodeAlreadyExistsException extends ConflictException {
  constructor(code: string) {
    super(`Program code "${code}" already exists in this department`);
  }
}

export class InvalidHeadOfDepartmentException extends BadRequestException {
  constructor() {
    super('Head of department must have INSTRUCTOR or ADMIN role');
  }
}

export class CannotDeleteCampusWithDepartmentsException extends ConflictException {
  constructor() {
    super('Cannot delete campus with existing departments');
  }
}

export class CannotDeleteDepartmentWithProgramsException extends ConflictException {
  constructor() {
    super('Cannot delete department with existing programs');
  }
}

export class InvalidDateRangeException extends BadRequestException {
  constructor(message: string) {
    super(`Invalid date range: ${message}`);
  }
}

export class SemesterCodeAlreadyExistsException extends ConflictException {
  constructor(code: string) {
    super(`Semester code "${code}" already exists`);
  }
}