Passed
Push — master ( 22b733...fe8595 )
by Mathieu
02:34
created

Photo.getClassroom   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
c 0
b 0
f 0
rs 10
cc 1
1
import {
2
  Entity,
3
  Column,
4
  PrimaryGeneratedColumn,
5
  ManyToOne
6
} from 'typeorm';
7
import { Classroom } from './Classroom.entity';
8
9
export enum PhotoType {
10
  UNIT = 'unit',
11
  BROTHERS_SISTERS = 'brothers_sisters',
12
  GROUP = 'group'
13
}
14
15
@Entity()
16
export class Photo {
17
  @PrimaryGeneratedColumn('uuid')
18
  private id: string;
19
20
  @Column('enum', { enum: PhotoType, nullable: false })
21
  private type: PhotoType;
22
23
  @Column({ type: 'varchar', nullable: false })
24
  private name: string;
25
26
  @Column({ type: 'varchar', nullable: false })
27
  private path: string;
28
29
  @Column({ type: 'varchar', nullable: false })
30
  private token: string;
31
32
  @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
33
  private createdAt: Date;
34
35
  @ManyToOne(() => Classroom, { nullable: false, onDelete: 'CASCADE' })
36
  private classroom: Classroom;
37
38
  constructor(
39
    type: PhotoType,
40
    name: string,
41
    path: string,
42
    token: string,
43
    classroom: Classroom
44
  ) {
45
    this.type = type;
46
    this.name = name;
47
    this.path = path;
48
    this.token = token;
49
    this.classroom = classroom;
50
  }
51
52
  public getId(): string {
53
    return this.id;
54
  }
55
56
  public getType(): PhotoType {
57
    return this.type;
58
  }
59
60
  public getName(): string {
61
    return this.name;
62
  }
63
64
  public getPath(): string {
65
    return this.path;
66
  }
67
68
  public getToken(): string {
69
    return this.token;
70
  }
71
72
  public getCreatedAt(): Date {
73
    return this.createdAt;
74
  }
75
76
  public getClassroom(): Classroom {
77
    return this.classroom;
78
  }
79
}
80