Passed
Pull Request — master (#56)
by
unknown
03:10 queued 01:29
created

api/src/Domain/Ingestion/Ingestion.entity.ts   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 45
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 37
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 3
mnd 0
bc 0
fnc 3
bpm 0
cpm 1
noi 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A Ingestion.getSchool 0 3 1
A Ingestion.getId 0 3 1
A Ingestion.getState 0 3 1
1
import {
2
  Entity,
3
  Column,
4
  PrimaryGeneratedColumn,
5
  ManyToOne
6
} from 'typeorm';
7
import { School } from '../School/School.entity';
8
9
export enum State {
10
  INIT = 'init',
11
  UPLOAD_STARTED = 'upload_started',
12
  UPLOAD_CANCELLED = 'upload_cancelled',
13
  UPLOAD_FINISHED = 'upload_finished',
14
  FAILED = 'failed'
15
}
16
17
@Entity()
18
export class Ingestion {
19
  @PrimaryGeneratedColumn('uuid')
20
  private id: string;
21
22
  @Column('enum', { enum: State, nullable: false, default: State.INIT })
23
  private state: State;
24
25
  @ManyToOne(() => School, { nullable: false, onDelete: 'CASCADE' })
26
  private school: School;
27
28
  constructor(school: School) {
29
    this.school = school;
30
    this.state = State.INIT;
31
  }
32
33
  public getId(): string {
34
    return this.id;
35
  }
36
37
  public getState(): State {
38
    return this.state;
39
  }
40
41
  public getSchool(): School {
42
    return this.school;
43
  }
44
}
45