Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 45 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 |