Completed
Push — master ( ce7cb4...236e78 )
by Nicolas
15s queued 13s
created

File.getUploadedAt   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} from 'typeorm';
2
3
@Entity()
4
export class File {
5
  @PrimaryGeneratedColumn('uuid')
6
  private id: string;
7
8
  @Column({type: 'varchar', nullable: false})
9
  private name: string;
10
11
  @Column({type: 'integer', nullable: false})
12
  private size: number;
13
14
  @Column({type: 'varchar', nullable: false})
15
  private mimeType: string;
16
17
  @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
18
  private uploadedAt: Date;
19
20
  constructor(name: string, size: number, mimeType: string) {
21
    this.name = name;
22
    this.size = size;
23
    this.mimeType = mimeType;
24
  }
25
26
  public getId(): string {
27
    return this.id;
28
  }
29
30
  public getName(): string {
31
    return this.name;
32
  }
33
34
  public getSize(): number {
35
    return this.size;
36
  }
37
38
  public getMimeType(): string {
39
    return this.mimeType;
40
  }
41
42
  public getUploadedAt(): Date {
43
    return this.uploadedAt;
44
  }
45
46
  public getOriginalName(): string {
47
    return this.name
48
      .split('_')
49
      .splice(1)
50
      .join('_');
51
  }
52
}
53