Passed
Push — master ( c76068...3b6dad )
by Mathieu
01:58 queued 21s
created

Shooting.getIndividualClosingDate   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm';
2
import { School } from './School.entity';
3
4
export enum ShootingStatus {
5
  ENABLED = 'enabled',
6
  DISABLED = 'disabled'
7
}
8
9
@Entity()
10
export class Shooting {
11
  @PrimaryGeneratedColumn('uuid')
12
  private id: string;
13
14
  @Column({ type: 'varchar', nullable: false })
15
  private name: string;
16
17
  @Column({ type: 'date', nullable: false })
18
  private shootingDate: Date;
19
20
  @Column({ type: 'date', nullable: false })
21
  private groupClosingDate: Date;
22
23
  @Column({ type: 'date', nullable: false })
24
  private individualClosingDate: Date;
25
26
  @Column({ type: 'varchar', nullable: true })
27
  private notice: string;
28
29
  @Column('enum', { enum: ShootingStatus, nullable: false, default: ShootingStatus.DISABLED })
30
  private status: ShootingStatus;
31
32
  @ManyToOne(() => School, { nullable: false, onDelete: 'CASCADE' })
33
  private school: School;
34
35
  constructor(
36
    name: string,
37
    shootingDate: Date,
38
    groupClosingDate: Date,
39
    individualClosingDate: Date,
40
    status: ShootingStatus,
41
    school: School,
42
    notice?: string
43
  ) {
44
    this.name = name;
45
    this.shootingDate = shootingDate;
46
    this.groupClosingDate = groupClosingDate;
47
    this.individualClosingDate = individualClosingDate;
48
    this.status = status;
49
    this.school = school;
50
    this.notice = notice;
51
  }
52
53
  public getId(): string {
54
    return this.id;
55
  }
56
57
  public getName(): string {
58
    return this.name;
59
  }
60
61
  public getShootingDate(): Date {
62
    return this.shootingDate;
63
  }
64
65
  public getGroupClosingDate(): Date {
66
    return this.groupClosingDate;
67
  }
68
69
  public getIndividualClosingDate(): Date {
70
    return this.individualClosingDate;
71
  }
72
73
  public getNotice(): string {
74
    return this.notice;
75
  }
76
77
  public getSchool(): School {
78
    return this.school;
79
  }
80
81
  public getStatus(): ShootingStatus {
82
    return this.status;
83
  }
84
85
  public update(
86
    name: string,
87
    shootingDate: Date,
88
    groupClosingDate: Date,
89
    individualClosingDate: Date,
90
    notice?: string,
91
  ): void {
92
    this.name = name;
93
    this.shootingDate = shootingDate;
94
    this.groupClosingDate = groupClosingDate;
95
    this.individualClosingDate = individualClosingDate;
96
    this.notice = notice;
97
  }
98
}
99