Passed
Push — master ( 7cd696...c76068 )
by Mathieu
01:46
created

Shooting.getNotice   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 closingDate: Date;
22
23
  @Column({ type: 'varchar', nullable: true })
24
  private notice: string;
25
26
  @Column('enum', { enum: ShootingStatus, nullable: false, default: ShootingStatus.DISABLED })
27
  private status: ShootingStatus;
28
29
  @ManyToOne(() => School, { nullable: false, onDelete: 'CASCADE' })
30
  private school: School;
31
32
  constructor(
33
    name: string,
34
    shootingDate: Date,
35
    closingDate: Date,
36
    status: ShootingStatus,
37
    school: School,
38
    notice?: string
39
  ) {
40
    this.name = name;
41
    this.shootingDate = shootingDate;
42
    this.closingDate = closingDate;
43
    this.status = status;
44
    this.school = school;
45
    this.notice = notice;
46
  }
47
48
  public getId(): string {
49
    return this.id;
50
  }
51
52
  public getName(): string {
53
    return this.name;
54
  }
55
56
  public getShootingDate(): Date {
57
    return this.shootingDate;
58
  }
59
60
  public getClosingDate(): Date {
61
    return this.closingDate;
62
  }
63
64
  public getNotice(): string {
65
    return this.notice;
66
  }
67
68
  public getSchool(): School {
69
    return this.school;
70
  }
71
72
  public getStatus(): ShootingStatus {
73
    return this.status;
74
  }
75
76
  public update(
77
    name: string,
78
    shootingDate: Date,
79
    closingDate: Date,
80
    notice?: string,
81
  ): void {
82
    this.name = name;
83
    this.shootingDate = shootingDate;
84
    this.closingDate = closingDate;
85
    this.notice = notice;
86
  }
87
}
88