Passed
Pull Request — master (#361)
by
unknown
02:03
created

UserAdministrative.getSustainableMobilityFee   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 { Entity, Column, PrimaryGeneratedColumn, OneToOne } from 'typeorm';
2
import { User } from './User.entity';
3
4
export enum ContractType {
5
  CDI = 'cdi',
6
  CDD = 'cdd',
7
  CTT = 'ctt',
8
  APPRENTICESHIP = 'apprenticeship',
9
  PROFESSIONALIZATION = 'professionalization'
10
}
11
12
export enum WorkingTimeType {
13
  FULL_TIME = 'full_time',
14
  PART_TIME = 'part_time'
15
}
16
17
@Entity()
18
export class UserAdministrative {
19
  @PrimaryGeneratedColumn('uuid')
20
  private id: string;
21
22
  @Column({ type: 'date', nullable: false })
23
  private joiningDate: string;
24
25
  @Column({ type: 'date', nullable: true })
26
  private leavingDate: string;
27
28
  @Column({ type: 'integer', nullable: false })
29
  private annualEarnings: number;
30
31
  @Column({ type: 'integer', default: 0, nullable: true })
32
  private transportFee: number;
33
34
  @Column({ type: 'integer', default: 0, nullable: true })
35
  private sustainableMobilityFee: number;
36
37
  @Column({ type: 'boolean', nullable: false })
38
  private healthInsurance: boolean;
39
40
  @Column({ type: 'boolean', nullable: false })
41
  private executivePosition: boolean;
42
43
  @Column('enum', { enum: ContractType, nullable: false })
44
  private contract: ContractType;
45
46
  @Column('enum', { enum: WorkingTimeType, nullable: false })
47
  private workingTime: WorkingTimeType;
48
49
  @OneToOne(
50
    type => User,
51
    user => user.userAdministrative
52
  )
53
  public user: User;
54
55
  constructor(
56
    annualEarnings: number,
57
    healthInsurance: boolean,
58
    executivePosition: boolean,
59
    contract: ContractType,
60
    workingTime: WorkingTimeType,
61
    joiningDate: string,
62
    leavingDate?: string,
63
    transportFee?: number,
64
    sustainableMobilityFee?: number
65
  ) {
66
    this.annualEarnings = annualEarnings;
67
    this.healthInsurance = healthInsurance;
68
    this.executivePosition = executivePosition;
69
    this.contract = contract;
70
    this.workingTime = workingTime;
71
    this.joiningDate = joiningDate;
72
    this.leavingDate = leavingDate;
73
    this.transportFee = transportFee;
74
    this.sustainableMobilityFee = sustainableMobilityFee;
75
  }
76
77
  public getId(): string {
78
    return this.id;
79
  }
80
81
  public getJoiningDate(): string {
82
    return this.joiningDate;
83
  }
84
85
  public getLeavingDate(): string {
86
    return this.leavingDate;
87
  }
88
89
  public getAnnualEarnings(): number {
90
    return this.annualEarnings;
91
  }
92
93
  public getTransportFee(): number {
94
    return this.transportFee;
95
  }
96
97
  public getSustainableMobilityFee(): number {
98
    return this.sustainableMobilityFee;
99
  }
100
101
  public haveHealthInsurance(): boolean {
102
    return this.healthInsurance;
103
  }
104
105
  public isExecutivePosition(): boolean {
106
    return this.executivePosition;
107
  }
108
109
  public getContract(): ContractType {
110
    return this.contract;
111
  }
112
113
  public getWorkingTime(): WorkingTimeType {
114
    return this.workingTime;
115
  }
116
117
  public update(
118
    annualEarnings: number,
119
    contract: ContractType,
120
    workingTime: WorkingTimeType,
121
    executivePosition: boolean,
122
    healthInsurance: boolean,
123
    joiningDate: string,
124
    leavingDate: string,
125
    transportFee: number,
126
    sustainableMobilityFee: number
127
  ): void {
128
    this.annualEarnings = annualEarnings;
129
    this.contract = contract;
130
    this.workingTime = workingTime;
131
    this.executivePosition = executivePosition;
132
    this.healthInsurance = healthInsurance;
133
    this.joiningDate = joiningDate;
134
    this.leavingDate = leavingDate;
135
    this.transportFee = transportFee;
136
    this.sustainableMobilityFee = sustainableMobilityFee;
137
  }
138
}
139